ghci debugger: showing function argumetns when stopped at its definition

Simon Marlow marlowsd at gmail.com
Mon Jul 13 06:24:48 EDT 2009


On 10/07/2009 15:31, Peter Hercek wrote:
> Hi,
>
> It would be cool if ghci debugger could grab not only the free variables
> in the selected expression but in one case a bit more. The case is when
> we stop at a function definition the first time (when just entering it).
> In this case it should provide bindings of the function arguments. Is it
> doable without bad consequences? Looks to me like it should not result in
> some memory leak problems though I do not have idea whether it is hard to
> do.

The problem is that functions can be defined with multiple equations, 
each giving different names for the arguments. e.g. in

f x 0 = x
f 0 x = x

when we stop at f, what do you want to see?

I think the current policy is to stop at the outer level (no bindings), 
and the next breakpoint is on the right-hand side of the equation taken, 
with the appropriate free variables bound.

I suppose you could use a scheme whereby the bindings are named if there 
is only one equation, or otherwise use "_arg1" "_arg2", etc.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list