>This syntax would also have the advantage that you can apply different
>contexts to different constructors.

Er, you can already do that as I just pointed out:

data (Ord a,Num b) => Either a b = Left a | Right b 

Note that to constrain the same type variable differently
for different constructors would be a type error. In other
words this:

        data Either a = 
                Num a => Left a
                Ord a => Right a

Is not valid, because (forall a . Num a) is not the same
type as (forall a . Ord a). So infact the current way
of writing it as

        data (Num a) => Either a = Left a | Right a

Is better because it does not allow you to make that mistake.

        Regards,
        Keean.
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to