We need to add role annotations for 7.8

Simon Peyton Jones simonpj at microsoft.com
Mon Mar 24 14:46:22 UTC 2014


When Brandon says “potential bugs/unsafety and all” he means GeneralisedNewtypeDeriving (GND).  That already exists, and already allows you to do bad things (Trac #1496 among others).

See the thread on https://ghc.haskell.org/trac/ghc/ticket/8827, starting especially at comment 17 for more discussion and some insightful comments.  As Edward (on the ticket) and Brandon (here) point out, going to “nominal by default” will be very safe but it’ll break many Haskell packages which use GND.

This is really a library/user question, not a GHC one.  We can implement whatever default you want.  But GHC 7.8 is about to be released and this debate has been going on for some weeks, at high intensity on ghc-devs, plus Richard specifically advertised it to the libraries list back in November<http://www.haskell.org/pipermail/libraries/2013-November/021707.html>, and again a couple of weeks ago<http://www.haskell.org/pipermail/libraries/2014-March/022321.html>.

I think the status quo is not unreasonable.  One question you might want to debate is whether, as Brandon suggests, you want to move to “nominal by default” in due course.

Simon

From: Libraries [mailto:libraries-bounces at haskell.org] On Behalf Of Brandon Allbery
Sent: 24 March 2014 14:28
To: Mark Lentczner
Cc: GHC Development Mailing List; libraries at haskell.org Libraries
Subject: Re: We need to add role annotations for 7.8

On Mon, Mar 24, 2014 at 10:14 AM, Mark Lentczner <mark.lentczner at gmail.com<mailto:mark.lentczner at gmail.com>> wrote:
On Fri, Mar 14, 2014 at 2:36 AM, Johan Tibell <johan.tibell at gmail.com<mailto:johan.tibell at gmail.com>> wrote:
I'm quite worried about this change though. I thought the default role for data type was nominal, as that's the safe default. If the default is representational, every package author will need to be aware of this feature and update their packages. That's quite a high cost.

On Fri, Mar 14, 2014 at 6:00 AM, Brandon Allbery <allbery.b at gmail.com<mailto:allbery.b at gmail.com>> wrote:

Nominal default breaks everything that uses newtype deriving and doesn't have role annotations, doesn't it? Representational default means things behave in 7.8 as they did in earlier GHCs.

Am I reading these pair of statements correctly? It seems to imply to me that every parameterized type that uses a type constraint on a parameter must be reviewed and possibly annotated to work correctly, one way or the other!

No; if the default is representational, everything works as it did in earlier versions, potential bugs/unsafety and all. If the default is immediately switched to nominal, *then* every affected type must be reviewed immediately. My counter-proposal was to have 7.8 default to representational to give library maintainers a release cycle to add the necessary annotations, then switch the default to nominal in 7.10 to get the additional safety.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com<mailto:allbery.b at gmail.com>                                  ballbery at sinenomine.net<mailto:ballbery at sinenomine.net>
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140324/9653b74b/attachment.html>


More information about the ghc-devs mailing list