[Haskell] Re: [Haskell-cafe] ANNOUNCE: Generic Haskell 1.80 (Emerald)

Thomas van Noort thomas at cs.ru.nl
Mon Apr 14 04:59:36 EDT 2008

Pablo Nogueira wrote:
>> This has certainly been taken into account when comparing approaches to
>>  generic programming. I quote from page 18/19 from the work you and Bulat
> Indeed I was not aware of it. Missed that. Thanks for pointing it out!
>>  Thus, full reflexivity of an approach is taken into account. This suggests
>>  constrained types are part of Haskell98. So, I'm a bit confused at the
>>  moment as well.
> After reading the Haskell 98 report more carefully I think constrained
> types are part of Haskell98. The syntax for algebraic datatype
> declarations given is:
>  > data cx => T u1 ... uk = K1 t11 ... t1k1 | ...| Kn tn1 ... tnkn
> Certainly, they are implemented in a peculiar way, with constraints
> associated with value constructors and not the type, perhaps to keep
> the class and kinds orthogonal (eg, the BinTree type has * -> * kind
> instead of Ord -> * kind).

You are completely right, constraints are optional for data and newtype 
declarations in Haskell98:


In addition, GHC supports liberalised type synonyms which allows you to 
define constraints:


Seems like the mystery is solved now..

> At any rate, this has been discussed before in other threads.
> Thanks Thomas for your help
> P.

You're welcome,

More information about the Haskell mailing list