Re: We need to add role annotations for 7.8
Brandon Allbery <[email protected]> Mon, 24 Mar 2014 10:32:40 -0400
| Newsgroups | gmane.comp.lang.haskell.libraries,gmane.comp.lang.haskell.cvs.ghc |
|---|---|
| Message-ID | <CAKFCL4V7=cpX8K9BQo3veh3VB7AP9293KzbRZeoSg9xvbTEjzQ@mail.gmail.com> |
--===============5649648734940760622== Content-Type: multipart/alternative; boundary=f46d043894cf9f710d04f55b1b46 --f46d043894cf9f710d04f55b1b46 Content-Type: text/plain; charset=UTF-8 On Mon, Mar 24, 2014 at 10:28 AM, Brandon Allbery <[email protected]>wrote: > On Mon, Mar 24, 2014 at 10:14 AM, Mark Lentczner <[email protected] > > wrote: > >> On Fri, Mar 14, 2014 at 2:36 AM, Johan Tibell <[email protected]>wrote: >> >>> I'm quite worried about this change though. I thought the default rolefor 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 <[email protected]> >> 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. > By the way, since I suspected (and was subsequently proved out) that appropriate warnings are difficult, perhaps there should be some mechanism to specify to ghc 7.8 whether a compile should default to representational or nominal so that authors have a way to test their code / look for problems. -- brandon s allbery kf8nh sine nomine associates [email protected] [email protected] unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net --f46d043894cf9f710d04f55b1b46 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On M= on, Mar 24, 2014 at 10:28 AM, Brandon Allbery <span dir=3D"ltr"><<a href= =3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&g= t;</span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_extra">= <div class=3D"gmail_quote"><div class=3D"">On Mon, Mar 24, 2014 at 10:14 AM= , Mark Lentczner <span dir=3D"ltr"><<a href=3D"mailto:mark.lentczner@gma= il.com" target=3D"_blank">[email protected]</a>></span> wrote:<br= > <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_extra">= On Fri, Mar 14, 2014 at 2:36 AM, Johan Tibell <span dir=3D"ltr"><<a href= =3D"mailto:[email protected]" target=3D"_blank">[email protected]= </a>></span> wrote:<br> </div><div class=3D"gmail_extra"><div class=3D"gmail_quote"><div><blockquot= e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width= :1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-lef= t:1ex"> <div dir=3D"ltr"><div>I'm quite worried about this change though. I tho= ught the default <span>role</span> for data type was nominal, as that's= the safe default. <b>If the default is representational, every package aut= hor will <span>need</span> to be aware of this feature and update their pac= kages.</b> That's quite a high cost.</div> </div><div></div></blockquote></div></div><br>On Fri, Mar 14, 2014 at 6:00 = AM, Brandon Allbery=C2=A0<span dir=3D"ltr"><<a href=3D"mailto:allbery.b@= gmail.com" target=3D"_blank">[email protected]</a>></span>=C2=A0wrote:= <div> <br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor= der-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:sol= id;padding-left:1ex"> <div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><div= ><b>Nominal default breaks everything that uses newtype deriving and doesn&= #39;t have role annotations, doesn't it?</b> Representational default m= eans things behave in 7.8 as they did in earlier GHCs.</div> </div></div></div></blockquote><div><br></div></div><div>Am I reading these= pair of statements correctly? It seems to imply to me that <i>every</i> pa= rameterized type that uses a type constraint on a parameter <i>must</i>=C2= =A0be reviewed and possibly annotated to work correctly, one way or the oth= er!</div> </div></div></blockquote><div><br></div></div><div>No; if the default is re= presentational, everything works as it did in earlier versions, potential b= ugs/unsafety and all. If the default is immediately switched to nominal, *t= hen* every affected type must be reviewed immediately. My counter-proposal = was to have 7.8 default to representational to give library maintainers a r= elease cycle to add the necessary annotations, then switch the default to n= ominal in 7.10 to get the additional safety.</div> </div></div></div></blockquote><div><br></div><div>By the way, since I susp= ected (and was subsequently proved out) that appropriate warnings are diffi= cult, perhaps there should be some mechanism to specify to ghc 7.8 whether = a compile should default to representational or nominal so that authors hav= e a way to test their code / look for problems.=C2=A0</div> </div><div><br></div>-- <br><div dir=3D"ltr"><div>brandon s allbery kf8nh = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sine nomine associates</div><div><a href=3D= "mailto:[email protected]" target=3D"_blank">[email protected]</a> =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"mailto:ballbery@sinenom= ine.net" target=3D"_blank">[email protected]</a></div> <div>unix, openafs, kerberos, infrastructure, xmonad =C2=A0 =C2=A0 =C2=A0 = =C2=A0<a href=3D"http://sinenomine.net" target=3D"_blank">http://sinenomine= .net</a></div></div> </div></div> --f46d043894cf9f710d04f55b1b46-- --===============5649648734940760622== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/libraries --===============5649648734940760622==--