Module documentation for 0.4
drinkery is a yet another stream processing library themed on liquors. While it offers a simple interface, it also tries to be as expressive as possible.
drinkery supports three types of producers:
Producer r s is a monad transformer to produce a stream of type
s. It is good
at interactively serving values.
yield :: s -> Producer r s m a is the primary action.
A barman can also accept requests from the downstream using
ListT r is a list-like backtracking monad (also known as ListT done right).
It is useful for sampling elements of containers with effects.
sample :: Foldable f => f s -> ListT r m s samples elements in any
inquire to interact with the downstream.
Tap is an endless producer. This can be connected to a ‘Patron’ or a ‘Distiller’.
ListT are converted to
Sink tap is a monad transformer which consumes
drink :: m sGet one element.
leftover :: s -> m ()Leave one element.
request :: r -> m ()Send a request.
(+&) :: (Monoid r, CloseRequest r, Monad m) => Tap r s m -> Sink (Tap r s) m a -> m a
connects a tap with a drinker.
Distiller tap m r s is a stream transducer which
It is actually a
Tap where the underlying monad is
There are two composition operators:
$ means a tap, a drinker, and a distiller respectively. The middle
characters of these operators signify the resulting structures.
drinkery is designed to be fully featured and complements other libraries’ missing functionalities.
pipes is quite similar in that both
Distiller are bidirectional.
Still there are some differences:
Distillerdoes not terminate.
- Unlike pipes’
++$propagates inner requests:
(++$) :: Monad m => Distiller tap m p q -> Distiller (Tap p q) (Sink tap m) r s -> Distiller tap m r s
(>->) :: Proxy a' a () b m r -> Proxy () b c' c m r -> Proxy a' a c' c m r
Sink, the consumer monad, may leave unconsumed inputs.
drinkeryhas much fewer operators.
conduit support leftovers, closing operation, and end of stream.
The main difference is interactivity.
machines does not support leftovers, nor interactive producers.
drinkery support multi-channel input.
iteratee has an ability to handle requests but those are untyped (
drinkery provides a more robust interface for handling requests, and monadic producers.