
#8773: Require -XIncoherentInstances to write role annotations on class definitions ------------------------------------+------------------------------------- Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.1-rc1 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8745 | ------------------------------------+------------------------------------- With a role annotation declaring a representational role for a class parameter, it is very easy to create instance incoherence. See [https://ghc.haskell.org/trac/ghc/ticket/8745#comment:5 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`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8773 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler