I was trying to debug this simple function with recursion. Debuging and stepping works, but list variables (xs,ys,zs) are empty (_),
combinations' :: Int -> [a] -> [[a]]
combinations' 0 _ = [  ]
combinations' n xs = [ y:ys | y:zs <- tails xs, ys <- combinations' (n-1) zs]
I suspect it has to do with Haskell being lazy, but is there a way to see the current state of list variables in a breakpoint step (without changing the source, like with trace)?
xs = [1,2,3]
zs = [2,3] ...
In the "Variables" view of the "Debug" perspective, in the "Value" column, when you see "_", select the cell and enter a value (like a single space). This will cause a force calculation of the value, that will then appear in the cell.
Note that forcing values may change behavior of your program in terms of space usage, for example, but is useful for debugging.
I tried it and it evaluates all the steps of recursion from that point to the end.
Seems logical, but not exactly what I expected.
Thanks for the tip, it helps.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.