Iterate a fold generator on a stream. The initial value
b is
used to generate the first fold, the fold is applied on the stream and
the result of the fold is used to generate the next fold and so on.
>>> import Data.Monoid (Sum(..))
>>> f x = return (Fold.take 2 (Fold.sconcat x))
>>> s = fmap Sum $ Stream.fromList [1..10]
>>> Stream.fold Fold.toList $ fmap getSum $ Stream.foldIterateM f (pure 0) s
[3,10,21,36,55,55]
This is the streaming equivalent of monad like sequenced application
of folds where next fold is dependent on the previous fold.
Pre-release