Require -XIncoherentInstances to write role annotations on class definitions
With a role annotation declaring a representational role for a class parameter, it is very easy to create instance incoherence. See this comment. The solution: require -XIncoherentInstances when writing such a role annotation. This also has the knock-on effect (happily) of preventing such shenanigans in Safe Haskell.
Class role annotations asking GHC to infer roles or with nominal roles, although rather useless, will still be accepted without -XIncoherentInstances.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.1-rc1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |