We need to add role annotations for 7.8

Johan Tibell johan.tibell at gmail.com
Thu Mar 13 18:49:11 UTC 2014


If you send a pull request for containers I'll merge it and make a release.
It needs to be backwards compatible with the last 3 major GHC releases. I
think we need to bump the minor version number so people can reliable write
dependency bounds to depend on the role being there (as that might be the
difference between code compiling or not).

Here's a guess which params should be representational:

Map k v -- k: nominal, v: represententional
Set a -- k: nominal
IntMap v -- v: represententional
Sequence a -- a: represententional
Tree a -- a: represententional


On Thu, Mar 13, 2014 at 7:41 PM, Richard Eisenberg <eir at cis.upenn.edu>wrote:

> Hi libraries, Johan, Edward,
>
> tl;dr: We really should add role annotations to the libraries that ship
> with GHC 7.8.
>
> In November, I sent this out:
> http://www.haskell.org/pipermail/libraries/2013-November/021707.html
> It got several good responses. Some time later, Joachim and I noticed that
> no action was taken, so we made a bug report, #8718, with a milestone of
> 7.8.1. I believe we both assumed that would take care of it. However, Simon
> PJ and I were surprised earlier this week to discover that Map and Set
> still do not have role annotations. Perhaps the GHC Trac isn't the right
> place for libraries issues, but posting here didn't quite work, so that
> seemed like the logical next step.
>
> In any case, now that we have the ability to prevent abuses of datatypes
> like Map and Set through erroneous use of GeneralizedNewtypeDeriving (and
> the new `coerce`), we should take advantage of this fact for 7.8. See my
> earlier email for a full explanation.
>
> Possibly folks' unfamiliarity with roles are in part to blame for not
> adding these role annotations. I am happy to help sort out what goes where.
> But, I need to work with someone with an intimate familiarity with the
> libraries themselves to help determine what the correct annotations are.
> For example, Map's first parameter should be nominal (its Ord instance is
> very relevant) but its second should be representational (there are no
> particular invariants related to the values of a map). Map is
> straightforward in this respect; other types probably aren't. Furthermore,
> I don't have anywhere near a complete list of what even needs attention.
> (It should be any type abstractly exported from a library.)
>
> Can someone help? I've included Johan as the most recent uploader of
> `containers` and Edward as the head of the core libraries committee.
>
> Thanks!
> Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140313/e9311583/attachment.html>


More information about the Libraries mailing list