logo       

RE: newtype and existentials: msg#00030

lang.haskell.glasgow.bugs

Subject: RE: newtype and existentials

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@xxxxxxxxxxx
[mailto:glasgow-haskell-bugs-
| bounces@xxxxxxxxxxx] On Behalf Of Ralf Hinze
| Sent: 18 November 2005 13:28
| To: glasgow-haskell-bugs@xxxxxxxxxxx
| 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@xxxxxxxxxxx
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

News | FAQ | advertise