We need to add role annotations for 7.8

Richard Eisenberg eir at cis.upenn.edu
Thu Mar 13 18:41:42 UTC 2014

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.


More information about the Libraries mailing list