
#12542: Unexpected failure.. (bug?) -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 simonpj): Ah now I see. The offending where clause is equivalent to this: {{{ where t = (viewVar, vewBnd) a = case t of (a,b) -> a b = case t of (a,b) -> b }}} What type does `t` get? {{{ t :: forall d1 d2 a1 a2 b2. Binding d1, Binding d2) => (d1 a1 -> Maybe Integer, d2 (Fun a2 b2) -> Maybe Integer) }}} Now when we call `t` in the RHS of `a` we get the error message you see, because nothing fixes `d2` and hence we can't resolve `Binding d2` even though it is not in fact used. This doesn't arise when there is just one variable; try the same desugaring and you'll see. The monomorphism restriction means that we don't attempt to generalise over `Binding d1` etc, so none of this happens. I agree that this is perplexing, but I don't really know how to improve it. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12542#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler