GADTs: polymorphic type arguments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

GADTs: polymorphic type arguments

Ralf Hinze
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
_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs