logo       

GADTs: polymorphic type arguments: msg#00037

lang.haskell.glasgow.bugs

Subject: GADTs: polymorphic type arguments

GHC currently forbids (G)ADTS with polymorphic type arguments:

> {-# OPTIONS -fglasgow-exts #-}
> data Com :: (* -> *) where
> I :: Com (forall a . a -> a)

> eval :: Com t -> t
> eval I = id

This seems, however, rather benign. Unlike, for instance,
[forall a . a -> a], which is a list of polymorphic values.

Omitting the forall yields a working declaration:

> data Com :: (* -> *) where
> I :: Com (a -> a)

Now, `I' has type forall a . Com (a -> a) rather than
Com (forall a . a -> a) and `eval' type checks ...

Cheers, Ralf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise