newtype and existentials

Simon Peyton-Jones simonpj at microsoft.com
Fri Nov 18 08:48:07 EST 2005


true.  GHC's intermediate language has first-class universal
quantification, but not first-class existentials. I can't claim that is
the Right Thing, but it might explain why GHC at least makes the choices
it does

Simon

| -----Original Message-----
| From: Ross Paterson [mailto:ross at soi.city.ac.uk]
| Sent: 18 November 2005 13:44
| To: Simon Peyton-Jones
| Cc: Ralf Hinze; glasgow-haskell-bugs at haskell.org
| Subject: Re: newtype and existentials
| 
| On Fri, Nov 18, 2005 at 01:31:46PM -0000, Simon Peyton-Jones wrote:
| > 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.
| 
| The first argument, but not the second, also applies to
| 
| 	newtype T = MkT (forall a. S)




More information about the Glasgow-haskell-bugs mailing list