We need to add role annotations for 7.8

Mikhail Glushenkov the.dead.shall.rise at gmail.com
Fri Mar 14 15:41:08 UTC 2014

Hi Richard,

On 14 March 2014 15:22, Richard Eisenberg <eir at cis.upenn.edu> wrote:
> There has been some thought about making `coerce`'s behavior different with
> -XSafe than without. See, for example, tickets #8745
> (https://ghc.haskell.org/trac/ghc/ticket/8745) and #8827
> (https://ghc.haskell.org/trac/ghc/ticket/8827). In the end, we decided to
> remove this, instead believing authors' role annotations (or lack thereof).

Interesting, it looks like the paper hasn't yet been updated to reflect this.

> Note that 7.8 does not actually give users a new way to break abstractions
> -- GeneralizedNewtypeDeriving has been around for a while. What 7.8 provides
> is a way to break abstractions more easily (`coerce`) and a way to prevent
> this from happening (role annotations).

Isn't this false in the case of -XSafe? In 7.8 one will be able to
coerce 'Map Int a' to 'Map Age a' (provided that there is no role
annotation for Map), which didn't work previously because SafeHaskell
prohibited GND.

More information about the Libraries mailing list