newtype and existentials
Simon Peyton-Jones
simonpj at microsoft.com
Fri Nov 18 08:31:46 EST 2005
yes. a newtype declares a new type isomorphic to an existing type.
newtype T = MkT S
declares T to be isomorphic to S.
There is no existing Haskell type isomorphic to your Dynamic.
In concrete terms, the newtype constructor is discarded before we get to
System F; but we can't do that with an existential.
S
| -----Original Message-----
| From: glasgow-haskell-bugs-bounces at haskell.org
[mailto:glasgow-haskell-bugs-
| bounces at haskell.org] On Behalf Of Ralf Hinze
| Sent: 18 November 2005 13:28
| To: glasgow-haskell-bugs at haskell.org
| Subject: newtype and existentials
|
| Is there a strong reason why
|
| > {-# OPTIONS -fglasgow-exts #-}
| > data Type :: (* -> *) where
| > Int :: Type Int
| > data Dynamic = forall a . Dyn (a, Type a)
|
| works, but not
|
| > newtype Dynamic = forall a . Dyn (a, Type a)
|
| Cheers, Ralf
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| Glasgow-haskell-bugs at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
More information about the Glasgow-haskell-bugs
mailing list