[Haskell-cafe] Adding Ord constraint to instance Monad Set?

Wolfgang Jeltsch wolfgang at jeltsch.net
Wed Mar 31 14:09:49 EST 2004


Am Mittwoch, 31. März 2004 13:51 schrieb Henning Thielemann:
> [...]

> > A data type declaration creates two things - the data type itself
> > and the constructor function.
> >
> > If you consider the constrains in the data type declaration to
> > apply only to the constructor then it all makes sense.
>
> If this is the meaning then in my opinion the syntax is misleading and it
> should be instead like
>   data Either a b =
>       (Ord a) => Left a
>
>     | (Num b) => Right b
>
>   (just a fictive example)

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

Wolfgang



More information about the Haskell-Cafe mailing list