[Haskell-cafe] advanced class constraints in Haskell 98?
Miguel Mitrofanov
miguelimo38 at yandex.ru
Thu Jan 8 16:16:22 EST 2009
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.
========================
"atype" is defined as
========================
atype -> gtycon
| tyvar
| ( type1 , ... , typek ) (tuple type, k>=2)
| [ type ] (list type)
| ( type ) (parenthesised constructor)
========================
> Hugs 2005 also accepts this.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list