Jose Romildo Malaquias <[EMAIL PROTECTED]> writes:

> Hello.
> 
> Is there any Haskell implementation that supports
> extensible data types, in which new value constructors
> can be added to a previously declared data type,
> like
> 
>       data Fn = Sum | Pro | Pow
>       ...
>       extend data Fn = Sin | Cos | Tan
> 
> where first the Fn datatype had only three values,
> (Sum, Pro and Pow) but later it was extended with
> three new values (Sin, Cos and Tan)?


I don't know of any implementation that directly supports this.
Somebody else pointed you at TREX.  The theoretical underpinnings of
TREX are discussed in the following paper:

A Polymorphic Type System for Extensible Records and Variants,
Benedict R. Gaster and Mark P. Jones, Technical report NOTTCS-TR-96-3,
November 1996, Department of Computer Science, University of
Nottingham, University Park, Nottingham NG7 2RD, England.

(you can download a copy from http://www.cse.ogi.edu/~mpj/pubs.html).
As mentioned in the title of the paper, the type system described
supports both extensible records and extensible variants.  The TREX
extension only implemented the "extensible records" portion.  I've
often wished that the "extensible variants" were also implemented;
they seem more useful than extensible records to me.

Carl Witty

Reply via email to