Debugging

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Fri, 29 Aug 2003 10:49:09 +0100


Konrad Hinsen <hinsen@cnrs-orleans.fr> writes:

> But if I can only see the results of named function calls, I don't get the 
> intermediate values.
> 
> A typical situation would be a function that looks like
> 
>    f x = sum [...]
> 
> When my unit test reports that the sum is wrong, I'd then like to use a 
> debugging tool to look at the list before summation.

... so in hat-observe, you could ask to see "sum _" only in the context
of a call from f, which might report something like

    sum [1,2,3] = 6
    sum [1,2,4] = 9

and you could then use hat-trail to examine why the second equation
gave the wrong answer, by looking into its internals.  Or on the
other hand, the addition may be correct but the fault is that the
wrong list argument was passed to "sum" in the first place, in which
case you explore where that came from instead.

Regards,
    Malcolm