Require -XIncoherentInstances to write role annotations on class definitions
|Reported by:||goldfire||Owned by:||goldfire|
|Type of failure:||None/Unknown||Test Case:||roles/should_fail/T8773|
|Related Tickets:||#8745||Differential Rev(s):|
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