foldMap package:streaming

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} :> ()