[Haskell-cafe] Re: Existencial quantification and polymorphic datatypes (actually, components...)

Mauricio briqueabraque at yahoo.com
Tue Jan 20 14:51:02 EST 2009


>> But how is this:
>> data SomeNum = forall a. SN a
>> different from:
>> data SomeNum = SN (forall a. a)

> At a glance they look the same to me — but only the first is accepted by 
> ghc.

Following the link you pointed in the last
message, I found this at 8.8.4.1:

data T a = T1 (forall b. b -> b -> b) a

If I understand properly, it can be activated
with -XPolymorphicComponents. It's different
from my example, but I would like to know what
it does that this can't:

data T a = forall b. T1 (b->b->b) a

(The last one I think I understand well after the
previous message, although I see no use for this
particular form, since after pattern match there's
no other 'b' value to which we could aply that
function field.)

Link for convenience:

http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html

Maurício



More information about the Haskell-Cafe mailing list