foldMap package:streamly-core

Definition:
>>> foldMap f = Fold.lmap f Fold.mconcat
Make a fold from a pure function that folds the output of the function using mappend and mempty.
>>> sum = Fold.foldMap Data.Monoid.Sum

>>> Stream.fold sum $ Stream.enumerateFromTo 1 10
Sum {getSum = 55}
Definition:
>>> foldMapM f = Fold.lmapM f Fold.mconcat
Make a fold from a monadic function that folds the output of the function using mappend and mempty.
>>> sum = Fold.foldMapM (return . Data.Monoid.Sum)

>>> Stream.fold sum $ Stream.enumerateFromTo 1 10
Sum {getSum = 55}