Why is NoExt inhabited?

Carter Schonwald carter.schonwald at gmail.com
Sat Jun 29 15:48:14 UTC 2019


Phrased differently is a magic stand in for 0 ary sum and products ?

Or do you mean how n-ary sum and product are the same structure when n=1?

Forgot to cc list. Pardon the double send :)

On Mon, Jun 24, 2019 at 11:22 PM Richard Eisenberg <rae at richarde.dev> wrote:

> I forget if I'm the contributor Ben mentions below, but regardless: NoExt
> is used in two separate ways within GHC. It's used both as the extension of
> a sum (new constructor) and the extension of a product (new field in a
> constructor). But the identity for sum is different than the identity for
> products. To me, it makes good sense for the NoExt used as a product
> extension (new field) to have the 1 trivial inhabitant (thus forming the
> identity for products), but the NoExt used as a sum extension (new
> constructor) to have 0 inhabitants (thus forming the identity for sums).
> Clearly, one of these will need a new name.
>
> Thanks,
> Richard
>
> > On Jun 24, 2019, at 4:57 PM, Ben Gamari <ben at smart-cactus.org> wrote:
> >
> > Hi Shayan,
> >
> > During code review a contributor asked about a TTG extension point.
> > While answering his question I realized I didn't have a good explanation
> > for why NoExt is inhabited; as far as I can tell it should rather be
> > unhabited.
> >
> > If there is a reason for this then can you:
> >
> > 1. describe why this is so in #16863 [1]
> > 2. open an MR documenting the reason in Note [Trees that Grow].
> >
> > If not, perhaps we should consider changing it; the current state of
> > things is a bit awkward.
> >
> > Cheers,
> >
> > - Ben
> >
> >
> > [1] https://gitlab.haskell.org/ghc/ghc/issues/16863
> > _______________________________________________
> > ghc-devs mailing list
> > ghc-devs at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20190629/3da8ea3e/attachment.html>


More information about the ghc-devs mailing list