box-0.6.0: boxes

Safe HaskellNone
LanguageHaskell2010

Box.Queue

Description

queues Follows pipes-concurrency

Synopsis

Documentation

data Queue a Source #

Queue specifies how messages are queued

queueC :: MonadConc m => (Committer m a -> m l) -> (Emitter m a -> m r) -> m l Source #

create an unbounded queue, returning the emitter result

queueE :: MonadConc m => (Committer m a -> m l) -> (Emitter m a -> m r) -> m r Source #

create an unbounded queue, returning the emitter result

waitCancel :: MonadConc m => m b -> m a -> m b Source #

wait for the first action, and then cancel the second

ends :: MonadSTM stm => Queue a -> stm (a -> stm (), stm a) Source #

create a queue, returning the ends

withQE :: MonadConc m => Queue a -> (Queue a -> m (Box m a a, m ())) -> (Committer m a -> m l) -> (Emitter m a -> m r) -> m r Source #

connect a committer and emitter action via spawning a queue, and wait for both to complete.

withQC :: MonadConc m => Queue a -> (Queue a -> m (Box m a a, m ())) -> (Committer m a -> m l) -> (Emitter m a -> m r) -> m l Source #

connect a committer and emitter action via spawning a queue, and wait for both to complete.

toBox :: MonadSTM stm => Queue a -> stm (Box stm a a, stm ()) Source #

turn a queue into a box (and a seal)

toBoxM :: MonadConc m => Queue a -> m (Box m a a, m ()) Source #

turn a queue into a box (and a seal), and lift from stm to the underlying monad.

liftB :: MonadConc m => Box (STM m) a b -> Box m a b Source #

lift a box from STM

concurrentlyLeft :: MonadConc m => m a -> m b -> m a Source #

run two actions concurrently, but wait and return on the left result.

concurrentlyRight :: MonadConc m => m a -> m b -> m b Source #

run two actions concurrently, but wait and return on the right result.

fromAction :: MonadConc m => (Box m a b -> m r) -> Cont m (Box m b a) Source #

turn a box action into a box continuation

fuseActions :: MonadConc m => (Box m a b -> m r) -> (Box m b a -> m r') -> m r' Source #

connect up two box actions via two queues