
#14921: Type inference breaks on constraint-kinded parameter used by a Rank-2 callback -------------------------------------+------------------------------------- Reporter: glittershark | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #10651 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #10651 Comment: This is more or less expected behavior. See #10651 for a similar scenario. In general, GHC doesn't unify underneath equalities or something that might turn into an equality, such as `cls k` (this is why `a` is untouchable in your error message, as you'd have to unify it underneath `cls k`). As SPJ notes in https://ghc.haskell.org/trac/ghc/ticket/10651#comment:2, this limitation is explained in Section 5 of the [http://research.microsoft.com/~simonpj/papers/constraints/jfp- outsidein.pdf OutsideIn paper], and it's unknown how to improve this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14921#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler