#15422 closed bug (fixed)

GHCi debugger doesn't see free variables when using ApplicativeDo

Reported by: simonmar Owned by:
Priority: normal Milestone: 8.6.1
Component: Compiler Version: 8.4.3
Keywords: ApplicativeDo Cc:
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 (last modified by simonmar)

> 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

Change History (4)

comment:1 Changed 14 months ago by simonmar

Description: modified (diff)

comment:2 Changed 14 months ago by Krzysztof Gogolewski <krz.gogolewski@…>

In 4ea9311/ghc:

Fix the GHCi debugger with ApplicativeDo

Summary:
`collectLStmtsBinders` was returning nothing for `ApplicativeStmts`, which
caused the debugger to not track free variables in many cases when using
`ApplicativeDo`.

Test Plan:
* new test case
* validate

Reviewers: bgamari, erikd

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15422

Differential Revision: https://phabricator.haskell.org/D4991

comment:3 Changed 14 months ago by monoidal

Status: newmerge

comment:4 Changed 14 months ago by bgamari

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.