
#9123: Need for higher kinded roles -------------------------------------+------------------------------------- Reporter: simonpj | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Project (more Type of failure: | than a week) None/Unknown | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by goldfire): Replying to [comment:32 simonpj]:
I'm sure you can't be saying * Reject a constraint `C a Int` as "exotic" * Accept a constraint `forall a. C a Int` as fine
Indeed, I was suggesting that implication constraints could be considered not exotic. Perhaps it would make the most sense to simply recur in the implication case, ruling out the example above, but accepting `(forall a b. Coercible a b => Coercible (m a) (m b))` (although I seem to recall that anything with a repeated variable is considered exotic). In any case, I have very little intuition as to how to set the exotic- checker and could be convinced to do just about anything. Here's a fresh approach to the problem: Don't rule out exotic contexts at all (subject to having the right language extensions on, as with all inferred types). Instead, issue a warning (on by default) when the context is exotic. The warning would exhort programmers to use standalone-deriving to suppress it. (Or, of course, there would be `-fno-warn-exotic-inferred- contexts`.) This should allow strictly more programs to type-check than today, so it's not a regression. And, as I understand it, the Haskell Report doesn't specify this end of the language, so we wouldn't be going against spec. With such a warning mechanism in place, I would favor a more stringent exotic-checker. With this warning behavior, `deriving (Monad)` would work (with `-XImplicationContexts`) and just issue a warning. (Without `-XImplicationContexts`, it would advise turning on `-XImplicationContexts`, of course!) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9123#comment:33 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler