Blog44.1K views1,843 votes0 replies1,447 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.