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

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


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  ©
         ¦                               6                              
©      ¦ 32       ¢ R                             ¨         © ¥

7

  ¤ ¢                            ¨ 7

5© ¥   ¦
                                                     class 
=>                                                        where
    ¢

§               §                         §              §
    ¥   ¦ ¡ 2 §
                                     6 
© R©
  7


More information about the Haskell-Cafe mailing list