
#14539: untouchable type inside the constraints -------------------------------------+------------------------------------- Reporter: Lemming | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.2.2 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by goldfire): This is correct behavior by GHC. Untouchable variables are explained accessibly in the [https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/jfp- outsidein.pdf OutsideIn paper], sections 5.1 and 5.2. (I think you'll be able to get most of the meaning without reading prior sections.) Essentially, any type that GHC has to guess cannot be affected from code where an equality assumption is in effect. Your `sign :: Sign Double` happens in a context where the `FullShape sh ~ sh` equality can be assumed. It cannot thus affect the type that GHC guesses for `sign`, which is introduced outside the scope of that equality constraint. The solution is simply to annotate the type of `sign` when it is introduced: `... \(sign :: Sign Double) -> ...`, and you should be OK. If you agree with this analysis, please close the ticket. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14539#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler