zip package:io-streams
Combines two input streams. Continues yielding elements from both
input streams until one of them finishes.
Combines two input streams using the supplied function. Continues
yielding elements from both input streams until one of them finishes.
Combines two input streams using the supplied monadic function.
Continues yielding elements from both input streams until one of them
finishes.
Given two
OutputStreams, returns a new stream that "unzips" the
tuples being written, writing the two elements to the corresponding
given streams.
You can use this together with
contramap (\ x -> (x,
x)) to "fork" a stream into two.
Since: 1.5.2.0
Takes apart a stream of pairs, producing a pair of input streams.
Reading from either of the produced streams will cause a pair of
values to be pulled from the original stream if necessary. Note that
reading n values from one of the returned streams will cause
n values to be buffered at the other stream.
Access to the original stream is thread safe, i.e. guarded by a lock.