
8 Jul
2011
8 Jul
'11
5:34 a.m.
John Lato
I want to find out the culprit function and rewrite it tail-recursively. Is there a way to find out which function is causing this error other than reviewing the code manually?
I'd like to point out that a stack-space overflow in Haskell isn't quite the same thing as in other functional languages. In particular, it's possible for tail-recursive functions to overflow the stack because of laziness.
..in fact, you often want to *avoid* tail recursion (e.g. as implemented in foldl) and use something that is not tail recursive (e.g. foldr) but more laziness-friendly. Or use strictness (foldl'). -k -- If I haven't seen further, it is by standing in the footprints of giants