Concurrency for the streaming ecosystem
There are two primary higher-level use-cases for this library:
-
Merge multiple
Streams together. -
A conceptual
Stream-based equivalent toparMap(albeit utilising concurrency rather than true parallelism).
However, low-level functions are also exposed so you can construct
your own methods of concurrently using Streams (and there are also
non-Stream-specific functions if you wish to use it with other data
types).
Conceptually, the approach taken is to consider a typical
correspondence system with an in-basket/tray for receiving messages
for others, and an out-basket/tray to be later dealt with. Inputs are
thus provided into the InBasket and removed once available from the
OutBasket.
The code here is heavily based upon -- and borrows the underlying
Buffer code from -- Gabriel Gonzalez's pipes-concurrency. It
differs from it primarily in being more bracket-oriented rather than
providing a spawn primitive, thus not requiring explicit garbage
collection.
Another main difference is that the naming of the input and output
types has been switched around: pipes-concurrency seems to consider
them from the point of view of the supplying/consuming Pipes,
whereas here they are considered from the point of view of the
Buffer itself.