Mauricio wrote:
But how is this:
data SomeNum = forall a. SN a
different from:
data SomeNum = SN (forall a. a)
In the first case the constructor SN can be applied to the monomorphic
value of any type, it effectively hides the type of the argument. For
example, you can have a list like [SN True, SN "foo", SN 42], because
for all x SN x has type SomeNum.
In the second case, SN can be applied only to polymorphic values, SN
True or SN "foo" won't compile.
The only thing that both types have in common - they are both useless.
Polymorphic and existential types must have more structure to be useful
- you cannot _construct_ SomeNum #2 and you cannot do anything to the
value you _extract_ from SomeNum #1.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe