[Haskell-cafe] advanced class constraints in Haskell 98?

Henning Thielemann lemming at henning-thielemann.de
Thu Jan 8 16:27:59 EST 2009


On Thu, 8 Jan 2009, Henning Thielemann wrote:

> On Fri, 9 Jan 2009, Miguel Mitrofanov wrote:
>
>> On 8 Jan 2009, at 23:59, Henning Thielemann wrote:
>> 
>>> 
>>> GHC accepts a class declaration like
>>> class Monad (m Maybe) => C m where
>>>    ...
>>> without having any language extension switched on. But it isn't Haskell 
>>> 98, is it?
>> 
>> It is.
>> 
>> From Report:
>> 
>> ========================
>> 
>> A class assertion has form qtycls tyvar, and indicates the membership of 
>> the type tyvar in the class qtycls. A class identifier begins with an 
>> uppercase letter. A context consists of zero or more class assertions, and 
>> has the general form
>> 
>> ( C1 u1, ..., Cn un )
>> 
>> where C1, ..., Cn are class identifiers, and each of the u1, ..., un is 
>> either a type variable, or the application of type variable to one or more 
>> types.
>
> A nice. I jumped into 4.3 and found
>
> § §  R  32  ©

... copying from Haskell 98 report did not only insert rubbish, but also 
triggered sending the e-mail. I hope it did not more damage ...


scontext -> simpleclass
          | (simpleclass_1, ..., simpleclass_n)

simpleclass -> qtycls tyvar

So it must be 'atype' instead of 'tyvar'? Haskell 98 is really mighty.


More information about the Haskell-Cafe mailing list