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 [hidden email] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs signature.asc (497 bytes) Download Attachment |
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 <[hidden email]> 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 > [hidden email] > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs _______________________________________________ ghc-devs mailing list [hidden email] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs |
NoFExt (“Field”) and NoCExt (“Constructor”), maybe? On Tue, Jun 25, 2019 at 5:22 AM Richard Eisenberg <[hidden email]> 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. _______________________________________________ ghc-devs mailing list [hidden email] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs |
In reply to this post by Richard Eisenberg-5
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 <[hidden email]> 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. _______________________________________________ ghc-devs mailing list [hidden email] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs |
No -- I just mean that 0 (that is, Void) is the identity for sums and 1 (that is, Unit) is the identity for products. Sorry if this wasn't clear! Richard
_______________________________________________ ghc-devs mailing list [hidden email] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs |
Free forum by Nabble | Edit this page |