What causes “Error C stack overflow” in haskell usually
问题 What are the usual causes of "Error C stack overflow" in the Hugs Haskell implementation. 回答1: This can come up if you are used to functional languages in which it is common to do tail-recursion factorization. Say you have a function: sum = go 0 where go accum [] = accum go accum (x:xs) = go (accum+x) xs Which, incidentally, is the same as sum = foldl (+) 0 If we evaluate the function we can see the problem: sum [1,2,3,4] go 0 [1,2,3,4] go (0+1) [2,3,4] go ((0+1)+2) [3,4] go (((0+1)+2)+3) [4]