How to avoid correctness space leaks on a lazy setting in Haskell (2023)
Summary
Analyzes correctness space leaks in lazy Haskell evaluation and classifies leaks into strictness, liveness, and excessive sharing. It provides actionable remedies, including forcing evaluation with seq, scrutinizing monadic binds like (>>=), using cost centers, and patterns to avoid sharing leaks in generators. The post also discusses techniques for liveness leaks and advocates defensive coding and understanding STG to optimize real-world Haskell programs.