Unpacking single-field, single-strict-constructor GADTs and existentials

AntC anthony_clayden at clear.net.nz
Sun May 29 00:19:23 UTC 2016


> Simon Peyton Jones <simonpj <at> microsoft.com> writes:
> 
> Oh, that's helpful thank you.  I have added comments!
> 

I've added a further use case (Example 3 -- from my one-eyed focus on Records).

And apologies if these are two dumb questions, but is there a bigger prize here?

If we can figure out rules for when a GADT can be 'newtype'd; 
then can we also figure it out for ordinary 'data'?

Then 'newtype' becomes more of an optimisation pragma
than a distinct declaration.

And we can smooth over that nervous cluelessness for newbies
agonising about what/whether they can newtype.
(Ref the examples in Haskell 12010 report 4.2.3.)

Also: are the conditions under which we can newtype a GADT
also the conditions under which we can implement deriving ...
That is, deriving as part of the decl, rather than standalone.
(A Summer-of-code project?)

AntC



More information about the ghc-devs mailing list