
#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): Wiki Page: | -------------------------------------+------------------------------------- Comment (by gridaphobe): Alas, we can't simply remove the no-given solver for CallStacks, what about {{{ f :: CallStack f = ?callStack }}} Here we're given a type signature, so we won't pass through `simplifyInfer`. In general, I'm pretty sure we need the no-given solver for CallStacks at levels 1 and 3. Unfortunately that doesn't cut it either, consider our friend `fail` {{{ class Monad m where fail :: String -> m a fail s = error s }}} `fail` gives rise to an implication {{{ Implic { TcLevel = 3 Skolems = (m_anr[ssk] :: * -> *) No-eqs = False Status = Unsolved Given = $dMonad_aon :: T10845.Monad m_anr[ssk] Wanted = WC {wc_impl = Implic { TcLevel = 5 Skolems = a_aop[sk] No-eqs = False Status = Unsolved Given = Wanted = WC {wc_simple = [W] $dIP_aot :: ?callStack::CallStack (CNonCanonical)} Binds = EvBindsVar<aov> the type signature for: T10845.fail :: String -> m_anr[ssk] a_aop[sk] }} Binds = EvBindsVar<aow> the class declaration for ‘T10845.Monad’ } }}} which has the CallStack wanted stuck back at level 5! Ugh.. Perhaps what we really want is to move the no-given solver to `simplifyTop`, not `simplifyInfer`. I see that `simplifyTop` handles type- class defaulting, which feels similar in spirit to the no-given solver (ie we're defaulting the insoluble CallStacks to contain just the current source location). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10845#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler