Skip to content

GHCi debugger doesn't see free variables when using ApplicativeDo

> 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
Edited by Simon Marlow
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information