Radu Grosu | 12 Oct 1993 19:45
Picon
Favicon

subtyping variants


What is the current state of art in (sub)typing variants?
For example consider the following data type declaration:

data I1 = Xcoord | Ycoord | Mv(Real,Real)

I would like to write something like

data I2 = Color | I1

instead of

data I3 = Color | Coerce(I1)

If one considers only non-recursive (polymorphic) data type 
declarations then:

1) Are type reconstruction algorithms awailable to compute 
   the principal type of functions defined by using the 
   constructors of I2?

2) Is there any functional of the form:

   I2-w :: x -> (I1 -> x) -> I2 -> x

   I2-w (a)(f)(x) = case x of
      Color     => a
      otherwise => f x

   corresponding to the functional obtained for I3:
(Continue reading)


Gmane