pipes-misc-0.5.0.0: Miscellaneous utilities for pipes, required by glazier-tutorial

Safe HaskellSafe
LanguageHaskell2010

Pipes.Misc.Concurrent

Synopsis

Documentation

fromInputSTM :: Input a -> Producer' a STM () Source #

Like Pipes.Concurrent.fromInput, but stays in STM. Using hoist atomically to convert to IO monad seems to work. Do not use unsafeHoist atomically. Each transaction is atomically scoped around each yield, so be careful when filter or similar pipes to remove yields as this results in larger transactions and it may cause BlockIndefinitelyOnSTM exceptions. Intead, use Monoids to yield mempty so that the STM state changes.

toOutputSTM :: Output a -> Consumer' a STM () Source #

Like Pipes.Concurrent.toOutput, but stays in STM. Using hoist atomically to convert to IO monad seems to work. Do not use unsafeHoist atomically.

toOutputMaybeT :: Output a -> a -> MaybeT STM () Source #

Convert PC.Output a -> STM Bool to a -> MaybeT STM ()

mkProducerSTM :: Buffer a -> Producer a IO () -> IO (Producer a STM ()) Source #

Converts a Producer in IO monad to a producer in STM monad.

mkProducerSTM' :: Buffer a -> Producer a IO () -> IO (STM (), Producer a STM ()) Source #

Converts a Producer in IO monad to a producer in STM monad. Also returns the seal.

batch :: Input a -> Input (NonEmpty a) Source #

Reads as much as possible from an input and return a list of all unblocked values read. Blocks if the first value read is blocked.

execInput :: (MonadTrans t, Monad (t STM)) => Input a -> (a -> t STM b) -> Producer' b (t STM) () Source #

Combine a Input and a 'a -> t STM b' into a Producer of the result b. That is, given a input of messages, and something that executes the messages to produce a result b, combine them to get a Producer of the executed results.