
#10845: Incorrect behavior when let binding implicit CallStack object -------------------------------------+------------------------------------- Reporter: nitromaster101 | Owner: gridaphobe Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #10846 | Differential Rev(s): -------------------------------------+------------------------------------- Comment (by gridaphobe): Ah, I wasn't suggesting to treat `getCallStack` specially, it was just the simplest way to get GHC to instantiate the ?x's type with `CallStack` in the RHS of the local let-binder, which is a key ingredient in this bug. Suppressing the special case for `CallStack` seems to get us part of the way, we defer solving the CallStack until we get a toplevel implication {{{ Implic { TcLevel = 3 Skolems = No-eqs = False Status = Unsolved Given = $dIP_anO :: ?loc::CallStack Wanted = WC {wc_impl = Implic { TcLevel = 5 Skolems = No-eqs = False Status = Unsolved Given = Wanted = WC {wc_simple = [W] $dIP_anT :: ?loc::CallStack (CNonCanonical)} Binds = EvBindsVar<anU> the inferred type of y_anr :: t_anQ[tau:5] }} Binds = EvBindsVar<anY> the type signature for: f :: (?loc::CallStack) => [(String, SrcLoc)] } }}} Unfortunately the wanted in this implication is itself an implication, so GHC raises the TcLevel again when it enters the nested implication and our special case remains suppressed. I find it a bit strange though that the nested implication has no givens. Why emit an implication with no givens when we could just emit a simple wanted? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10845#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler