https://wiki.haskell.org/index.php?title=HaskellImplementorsWorkshop/2013/Eisenberg&feed=atom&action=historyHaskellImplementorsWorkshop/2013/Eisenberg - Revision history2024-03-29T06:08:47ZRevision history for this page on the wikiMediaWiki 1.35.5https://wiki.haskell.org/index.php?title=HaskellImplementorsWorkshop/2013/Eisenberg&diff=56842&oldid=prevEdward Z Yang: Created page with "= GeneralizedNewtypeDeriving is now type-safe: How "Roles" save the day = ''Richard A. Eisenberg'' The flaw with GeneralizedNewtypeDeriving and how it can cause Haskell prog..."2013-09-16T06:34:20Z<p>Created page with "= GeneralizedNewtypeDeriving is now type-safe: How "Roles" save the day = ''Richard A. Eisenberg'' The flaw with GeneralizedNewtypeDeriving and how it can cause Haskell prog..."</p>
<p><b>New page</b></p><div>= GeneralizedNewtypeDeriving is now type-safe: How "Roles" save the day =<br />
<br />
''Richard A. Eisenberg''<br />
<br />
The flaw with GeneralizedNewtypeDeriving and how it can cause Haskell programs<br />
to crash first made itself known on the GHC Trac with bug #1496 in July 2007.<br />
Type safety is compromised because GeneralizedNewtypeDeriving essentially can<br />
allow a programmer to equate two distinct types, using either type families or<br />
GADTs. The solution to the problem -- known as roles -- was the subject of a<br />
POPL 2011 paper, "Generative type abstraction and type-level computation."<br />
Roles allow for two distinct notions of equality: representational equality<br />
that states that two types have the same representation (but may still be<br />
considered different by type families), and nominal equality that states that<br />
two types are wholly the same. As roles denote a choice of equality relation, a<br />
role is given for every coercion (equality proof) and axiom manipulated by GHC.<br />
Roles must also get attached to the type parameters of datatypes, classes and<br />
type synonyms, indicating how they use these parameters.<br />
<br />
In this talk, I will give an overview of roles, focusing on how roles might<br />
affect contributors to GHC and its libraries.</div>Edward Z Yang