foldM package:streaming

Strict, monadic fold of the elements of a Stream (Of a)
Control.Foldl.impurely foldM' :: Monad m => FoldM a b -> Stream (Of a) m r -> m (b, r)
Thus to accumulate the elements of a stream as a vector, together with a random element we might write:
>>> L.impurely S.foldM (liftA2 (,) L.vectorM L.random) $ each [1..10::Int] :: IO (Of (Vector Int, Maybe Int) ())
([1,2,3,4,5,6,7,8,9,10],Just 9) :> ()
Strict, monadic fold of the elements of a Stream (Of a)
Control.Foldl.impurely foldM :: Monad m => FoldM a b -> Stream (Of a) m () -> m b
Map each element of the stream to a monoid, and take the monoidal sum of the results.
>>> S.foldMap Sum $ S.take 2 (S.stdinLn)
1<Enter>
2<Enter>
3<Enter>
Sum {getSum = 6} :> ()