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.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
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.