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

David Feuer david.feuer at gmail.com
Tue May 24 20:20:41 UTC 2016


No, because the pattern matching semantics are different. Matching on
the constructor *must* force the contents to maintain type safety.
It's really strict data with the newtype optimization, rather than a
bona fide newtype.

On Tue, May 24, 2016 at 4:18 PM, Ben Gamari <ben at well-typed.com> wrote:
> David Feuer <david.feuer at gmail.com> writes:
>
>> Not really. It's really just the newtype optimization, although it's not a
>> newtype.
>
> Ahh, I see. Yes, you are right. I was being silly.
>
> However, in this case wouldn't it make more sense to just call it a newtype?
>
> Cheers,
>
> - Ben


More information about the ghc-devs mailing list