[Haskell-beginners] foldl' vs seq

Gabi bugspynet at gmail.com
Mon Feb 1 05:34:32 EST 2010

I am trying to understand the behavior of foldl' and seq.
Why is the following code is much slower than the foldl' version ?
(which is foldl' (+)  0)
I thought the the below code is equivalent to foldr' but apparently I was wrong.

mySum :: [Integer] -> Integer
mySum[] = 0
mySum (x:xs) = seq x (mySum xs + x)

More information about the Beginners mailing list