debug
debug copied to clipboard
Multiple observations of the same variable in a function call
Consider the example
debug [d|
listcomp y = sum [x | x <- [1..y]]
|]
The expression listcomp 3
Produces the trace
* listcomp 3 = 6
x = 1
x = 2
x = 3
$arg1 = 3
y = 3
sum = 6
$result = 6
This is not unique to list comprehensions, it happens also for a mapped lambda:
debug [d|
listmap y = sum $ map (\x -> x) [1..y]
|]
listmap 3 produces the same trace as listcomp 3
The Hoed backend is not affected by this.