newtype wrappers

Simon Peyton-Jones simonpj at microsoft.com
Mon Sep 9 14:51:40 UTC 2013


| However, there is perhaps a middle road: what if much of the
| infrastructure is merged, without the user-facing feature? From a user's
| point of view, these coercions feel much more like a library than a
| language feature. Yes, the instances appear out of thin air, but
| otherwise, the 'coerce' function is totally normal-looking. Unless I'm
| mistaken, there is no new syntax. If we merge much (all?) of the
| implementation but don't export "coerce" and "Coercible" anywhere, then we
| can continue to tinker with the design in HEAD, and perhaps release with
| 7.8.2. Does that make sense?

Yes.  We did this with type families in 7.4.  Much of the infrastructure was there, but it wasn't an advertised feature so we did not feel constrained (for example) to apply bug fixes to the 7.4 branch.  Let's do the same here.  Essentially a full impl, but simply not advertised.

OK?

Note to other ghc-devs.  The issue under discussion is whether to merge Joachim's "newtype wrapper" feature. I'm keen to do so because it's very cool.  But arguably the design needs some time to "settle".  Proposed outcome is to merge the code but not advertise the feature, like we did for type functions in 7.4.

Simon

| 
| Richard
| 
| On Sep 7, 2013, at 1:41 PM, Simon Peyton-Jones <simonpj at microsoft.com>
| wrote:
| 
| > For a release we want
| > * A stable design
| > * An implementation that works pretty reliably
| > It doesn't have to do everything; and we can improve the impl
| incrementally.
| >
| > Let's see what Richard thinks
| >
| > Simon
| >
| > | -----Original Message-----
| > | From: Joachim Breitner [mailto:mail at joachim-breitner.de]
| > | Sent: 07 September 2013 18:37
| > | To: Simon Peyton-Jones
| > | Cc: Richard Eisenberg (eir at cis.upenn.edu)
| > | Subject: Re: newtype wrappers
| > |
| > | Hi,
| > |
| > | Am Samstag, den 07.09.2013, 17:17 +0000 schrieb Simon Peyton-Jones:
| > | > I'm beginning to think that newtype wrappers might be done enough to
| > | > put into 7.8.  (Feature freeze is on Friday.)
| > | >
| > | > What do you think?  It's a very attractive new feature, and fits
| > | > nicely with the new roles.
| > |
| > | I'm reluctant; I haven't even started to think what happens when I try
| > | to coerce between more fancy stuff like newtype families. Maybe it all
| > | works smoothly (after all, this is Haskell and the code typechecks),
| but
| > | I'm not too confident.
| > |
| > | Furthermore there is some code smell in the way I mark the newtype
| > | constructors as used, where I had to drill a hole in the TcS
| > | abstraction.
| > |
| > | If you are not worried about these, then it just remains to
| > |  * extend the user documentation and
| > |  * add coerce and Coercible to GHC.Exts.
| > | which is certainly possible to do until Friday.
| > |
| > | Greetings,
| > | Joachim
| > |
| > | --
| > | Joachim "nomeata" Breitner
| > |   mail at joachim-breitner.de * http://www.joachim-breitner.de/
| > |   Jabber: nomeata at joachim-breitner.de  * GPG-Key: 0x4743206C
| > |   Debian Developer: nomeata at debian.org
| >





More information about the ghc-devs mailing list