Composable, streaming strict left folds for Haskell
open sourceBSD-3-Clausefree
foldl gives Haskell strict left folds that stream in constant memory and combine in Applicative style, so you can compute several results (say, a sum and a length) in a single pass over the data without space leaks or hand-written strict accumulators. The combined fold is often as efficient as one written by hand, and because a Fold keeps its step function and accumulator, the same fold works on things other than pure collections, such as a pipes Producer. Gabriella Gonzalez wrote it.
Problems it solves
- compute several statistics over a list in one pass in Haskell
- avoid space leaks when folding large data in Haskell
- write reusable folds for streaming data
Features
- strict left folds that run in constant memory
- combine folds with Applicative to compute several results in one pass
- built-in folds such as sum and length
- reuse the same fold on streams such as pipes producers
