Strictness analyzer fails on an implementation of foldl
foldB has O(1) complexity, but foldA O(N). Looks like a strictness analyzer failure.
module Main where
foldA :: (a -> e -> a) -> a -> [e] -> a
foldA _ r [] = r
foldA op r (x:xs) = foldA op (op r x) xs
foldB :: (a -> e -> a) -> a -> [e] -> a
foldB _ r [] = r
foldB op r (x:xs) = r' `seq` foldB op r' xs where r' = op r x
l :: [Int]
l = [1..100*1000*1000]
main = print $ foldl (+) 0 l