debug icon indicating copy to clipboard operation
debug copied to clipboard

Multiple observations of the same variable in a function call

Open pepeiborra opened this issue 8 years ago • 0 comments

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.

pepeiborra avatar Jan 23 '18 21:01 pepeiborra