gambler-0.1.0.0: Composable, streaming, and efficient left folds
Safe HaskellSafe-Inferred
LanguageGHC2021

Fold.Pure.Run

Synopsis

Documentation

run :: Foldable f => Fold a b -> f a -> b Source #

Fold a listlike container to a single summary result

run monoid ["a", "b", "c"] = "abc"

scan :: Foldable f => Fold a b -> f a -> [b] Source #

Rather than only obtain a single final result, scanning gives a running total that shows the intermediate result at each step along the way

scan monoid ["a", "b", "c"] = ["","a","ab","abc"]

prescan :: Traversable t => Fold a b -> t a -> t b Source #

Scan where the last input is excluded

prescan monoid ["a", "b", "c"] = ["","a","ab"]

postscan :: Traversable t => Fold a b -> t a -> t b Source #

Scan where the first input is excluded

postscan monoid ["a", "b", "c"] = ["a","ab","abc"]