Safe Haskell | None |
---|---|
Language | Haskell2010 |
Place buffers between two machines. This is most useful with irregular production rates.
- bufferConnect :: MonadBaseControl IO m => Int -> MachineT m k b -> ProcessT m b c -> MachineT m k c
- rollingConnect :: MonadBaseControl IO m => Int -> MachineT m k b -> ProcessT m b c -> MachineT m k c
- mediatedConnect :: forall m t b k c. MonadBaseControl IO m => t -> (t -> b -> BufferRoom t) -> (t -> Maybe (b, t)) -> MachineT m k b -> ProcessT m b c -> MachineT m k c
- data BufferRoom a
Blocking buffers
bufferConnect :: MonadBaseControl IO m => Int -> MachineT m k b -> ProcessT m b c -> MachineT m k c Source #
Non-blocking (rolling) buffers
rollingConnect :: MonadBaseControl IO m => Int -> MachineT m k b -> ProcessT m b c -> MachineT m k c Source #
Internal helpers
mediatedConnect :: forall m t b k c. MonadBaseControl IO m => t -> (t -> b -> BufferRoom t) -> (t -> Maybe (b, t)) -> MachineT m k b -> ProcessT m b c -> MachineT m k c Source #
Mediate a MachineT
and a ProcessT
with a buffer.
mediatedConnect z snoc view source sink
pipes source
into
sink
through a buffer initialized to z
and updated with
snoc
. Upstream is blocked if snoc
indicates that the buffer is
full after adding a new element. Downstream blocks if view
indicates that the buffer is empty. Otherwise, view
is expected
to return the next element to process and an updated buffer.
data BufferRoom a Source #
Indication if the payload value is "full" or not.
Eq a => Eq (BufferRoom a) Source # | |
Ord a => Ord (BufferRoom a) Source # | |
Show a => Show (BufferRoom a) Source # | |