
#13242: Panic "StgCmmEnv: variable not found" with ApplicativeDo and ExistentialQuantification -------------------------------------+------------------------------------- Reporter: ljli | Owner: simonmar Type: bug | Status: new Priority: highest | Milestone: 8.0.3 Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmar): @simonpj, so the new code doesn't bring constraints into scope from existential bindings, even in statements that sequentially follow the existential pattern match. e.g. {{{ Prelude> data T where A :: forall a . Eq a => a -> T Prelude> :set -XApplicativeDo Prelude> do { A x <- undefined; y <- return (); return (x == x) } <interactive>:7:48: error: • Could not deduce (Eq a) arising from a use of ‘==’ from the context: Monad f bound by the inferred type of it :: Monad f => f Bool at <interactive>:7:1-56 Possible fix: add (Eq a) to the context of the inferred type of it :: Monad f => f Bool • In a stmt of a 'do' block: return (x == x) In the expression: do A x <- undefined y <- return () return (x == x) In an equation for ‘it’: it = do A x <- undefined y <- return () return (x == x) }}} I understand why - because the implementation specifically only binds Ids - but it's somewhat surprising. Is this fixable, or should I try to document it? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13242#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler