
#8745: GeneralizedNewtypeDeriving is still not Safe -------------------------------------------------+------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | 7.8.1-rc1 Operating System: Unknown/Multiple | Keywords: Safe Type of failure: None/Unknown | Architecture: Test Case: | Unknown/Multiple should_fail/TcCoercibleFailSafe | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by goldfire): The role annotation story is this: the annotations, if provided, simply override defaults (phantom for datatypes, nominal for classes). Then role inference happens (annotations or no). If, after inference, the annotations disagree with the inferred roles, the annotation is rejected. Because it's perfectly type-safe to have a class with a representational parameter, the role annotation is accepted and works. This can be useful if, say, someone wanted to have something like `Coercible` implemented in user-land somehow -- note that `Coercible`'s parameters are representational. One way forward here is to allow role annotations on classes only when we have !IncoherentInstances. In fact, I rather like that solution -- a role annotation on a class quickly leads to the possibility of incoherence, and this solution also neatly prohibits such annotations in Safe Haskell. Thoughts? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8745#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler