Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- fromInputSTM :: Input a -> Producer' a STM ()
- toOutputSTM :: Output a -> Consumer' a STM ()
- toOutputMaybeT :: Output a -> a -> MaybeT STM ()
- mkProducerSTM :: Buffer a -> Producer a IO () -> IO (Producer a STM ())
- mkProducerSTM' :: Buffer a -> Producer a IO () -> IO (STM (), Producer a STM ())
- batch :: Input a -> Input (NonEmpty a)
- execInput :: (MonadTrans t, Monad (t STM)) => Input a -> (a -> t STM b) -> Producer' b (t STM) ()
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.