Theme 1 – Clarity/abstraction of folds vs explicit recursion
- “If you do [know folds], then a quick glance at whether you’re using foldl’ or foldr tells you about what the function is allowed to do, which cuts down a little on comprehension.” – bos
- “There's a relatively popular point of view amongst Haskell programmers that explicit recursion is the goto of functional programming; a dedicated folding or traversing function provides more clarity on what exactly the function intends to do.” – s‑zeng
- “Folding 'fold' into contortions to use it as a generic List iterator does not 'provide clarity'.” – someonebaggy (shows the opposing view but still part of the same debate).
Theme 2 – Performance, laziness, and optimization benefits
- “One of the links (on Fusion) points out that GHC in particular has a lot of optimizations and rewrite rules for folds and many Prelude functions written as simple recursion also include optimized fold representations to suggest to various stages of GHC's optimizer.” – WorldMaker
- “Main takeaway: foldl can be tail recursive.” – woadwarrior01
- “What I learned, many years ago, is that foldr was a footgun, and that foldl1' was almost certainly what I wanted.” – Y_Y
Theme 3 – When folds are appropriate vs alternatives / criticisms
- “At some point doesn't it become easier to write the function explicitly? … instead of hacking it together with a fold?” – someonebaggy
- “I noticed that AI likes to overuse foldl' and foldr (especially foldr) … even when there are simpler and more straightforward ways to achieve the same thing.” – kccqzy
- “Then the reader doesn’t have to think about the asymmetric accumulation function and instead think about the mapping operation and the associative combine function separately.” – kccqzy (advocating foldMap/monoid over raw foldr).