Blog44.1K views1,434 votes0 replies3,817 following
Avoiding Space Leaks in Haskell: When to Prefer foldl' Over foldl
Lazy foldl can build a huge chain of thunks, causing space leaks. Use foldl’ and strictness annotations to keep memory constant, and verify with GHC’s +RTS -s runtime statistics.