Extensible Algebraic Data Types

Carl R. Witty cwitty@newtonlabs.com
05 Mar 2001 14:22:45 -0800


Ashley Yakeley <ashley@semantic.org> writes:

> I think it would be useful to extend Haskell so that one could create 
> algebraic data types in one module that could be union-extended in 
> another. Something like this:
> 
> data Thing = CharThing Char | IntThing Int | _
> 
> ...later...
> 
> data Thing |= StringThing String

You might be able to use the Gaster and Jones extensible variants from
"A Polymorphic Type System for Extensible Records and Variants"
(http://www.cse.ogi.edu/~mpj/pubs/polyrec.html).  As far as I know,
the extensible variants described in this paper have never been
implemented (although the extensible records are implemented in Hugs).

I've often thought that extensible variants would be at least as
useful, if not more useful, than extensible records.

Carl Witty