We need to add role annotations for 7.8

Edward Kmett ekmett at gmail.com
Thu Mar 13 18:54:11 UTC 2014


Interestingly I guess the s in `ST s` and `MVector s a` is nominal despite
being used as a deliberate phantom. =)


On Thu, Mar 13, 2014 at 2:53 PM, Edward Kmett <ekmett at gmail.com> wrote:

> Note with vector, Data.Vector.Vector is has a representational arg, but
> all the other vector types have nominal args.
>
>
> On Thu, Mar 13, 2014 at 2:52 PM, Edward Kmett <ekmett at gmail.com> wrote:
>
>> Yep.
>>
>> The role annotation should be CPP guarded.
>>
>>
>> On Thu, Mar 13, 2014 at 2:51 PM, Carter Schonwald <
>> carter.schonwald at gmail.com> wrote:
>>
>>> it'd just need some CPP to maintain compat right?
>>> We need it for vector and friends too right?
>>>
>>>
>>> On Thu, Mar 13, 2014 at 2:49 PM, Johan Tibell <johan.tibell at gmail.com>wrote:
>>>
>>>> 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
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Libraries mailing list
>>>> Libraries at haskell.org
>>>> http://www.haskell.org/mailman/listinfo/libraries
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Libraries mailing list
>>> Libraries at haskell.org
>>> http://www.haskell.org/mailman/listinfo/libraries
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140313/dc5f5633/attachment.html>


More information about the Libraries mailing list