concat -package:relude package:streaming

Make a stream of foldable containers into a stream of their separate elements. This is just
concat str = for str each
>>> S.print $ S.concat (each ["xy","z"])
'x'
'y'
'z'
Note that it also has the effect of catMaybes, rights map snd and such-like operations.
>>> S.print $ S.concat $ S.each [Just 1, Nothing, Just 2]
1
2

>>> S.print $  S.concat $ S.each [Right 1, Left "Error!", Right 2]
1
2

>>> S.print $ S.concat $ S.each [('A',1), ('B',2)]
1
2
Dissolves the segmentation into layers of Stream f m layers.
Fold streamed items into their monoidal sum
>>> S.mconcat $ S.take 2 $ S.map (Data.Monoid.Last . Just) S.stdinLn
first<Enter>
last<Enter>
Last {getLast = Just "last"} :> ()