
#15422: GHCi debugger doesn't see free variables when using ApplicativeDo -------------------------------------+------------------------------------- Reporter: simonmar | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4991 Wiki Page: | -------------------------------------+------------------------------------- Description changed by simonmar: Old description:
```
ghci break029.hs GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( break029.hs, interpreted ) Ok, one module loaded. *Main> :!cat break029.hs {-# LANGUAGE ApplicativeDo #-}
f :: Int -> IO Int f x = do y <- return (x + 1) return (y * 2) *Main> :step f 3 Stopped in Main.f, break029.hs:(4,7)-(6,16) _result :: IO Int = _ x :: Int = 3 [break029.hs:(4,7)-(6,16)] [break029.hs:(4,7)-(6,16)] *Main> :list 3 f :: Int -> IO Int 4 f x = do 5 y <- return (x + 1) 6 return (y * 2) 7 [break029.hs:(4,7)-(6,16)] [break029.hs:(4,7)-(6,16)] *Main> :step Stopped in Main.f, break029.hs:5:8-21 _result :: IO Int = _ x :: Int = 3 [break029.hs:5:8-21] [break029.hs:5:8-21] *Main> :list 4 f x = do 5 y <- return (x + 1) 6 return (y * 2) [break029.hs:5:8-21] [break029.hs:5:8-21] *Main> :step Stopped in Main.f, break029.hs:6:11-15 _result :: Int = _ [break029.hs:6:11-15] [break029.hs:6:11-15] *Main> y
<interactive>:7:1: error: Variable not in scope: y ```
New description: {{{
ghci break029.hs GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( break029.hs, interpreted ) Ok, one module loaded. *Main> :!cat break029.hs {-# LANGUAGE ApplicativeDo #-}
f :: Int -> IO Int f x = do y <- return (x + 1) return (y * 2) *Main> :step f 3 Stopped in Main.f, break029.hs:(4,7)-(6,16) _result :: IO Int = _ x :: Int = 3 [break029.hs:(4,7)-(6,16)] [break029.hs:(4,7)-(6,16)] *Main> :list 3 f :: Int -> IO Int 4 f x = do 5 y <- return (x + 1) 6 return (y * 2) 7 [break029.hs:(4,7)-(6,16)] [break029.hs:(4,7)-(6,16)] *Main> :step Stopped in Main.f, break029.hs:5:8-21 _result :: IO Int = _ x :: Int = 3 [break029.hs:5:8-21] [break029.hs:5:8-21] *Main> :list 4 f x = do 5 y <- return (x + 1) 6 return (y * 2) [break029.hs:5:8-21] [break029.hs:5:8-21] *Main> :step Stopped in Main.f, break029.hs:6:11-15 _result :: Int = _ [break029.hs:6:11-15] [break029.hs:6:11-15] *Main> y <interactive>:7:1: error: Variable not in scope: y }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15422#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler