sousit-0.3: Source/Sink/Transform: An alternative to lazy IO and iteratees.

Safe HaskellSafe-Inferred

Data.SouSiT.STM

Contents

Synopsis

Sinks

stmSink :: MonadIO m => (a -> STM (Maybe r)) -> Sink a m (Maybe r)Source

A sink that executes (atomically) a STM action for every input received. The sink continues as long as the action returns Nothing. When the action returns Just, then that value is the result of the sink.

stmSink' :: MonadIO m => (a -> STM ()) -> Sink a m ()Source

A sink that executes (atomically) a STM action for every input received. The sink never terminates.

tchanSink :: MonadIO m => TChan a -> Sink a m ()Source

Sink that writes all items into a TChan.

Sources

stmSource :: MonadIO m => STM (Maybe a) -> FeedSource m aSource

Source that executes a STM action to get a new item. When the action returns Nothing then the source is depleted.

stmSource' :: MonadIO m => STM a -> FeedSource m aSource

Source that executes a STM action to get a new item. Does never run out of items.

tchanSource :: MonadIO m => TChan a -> FeedSource m aSource

Source that reads from a TChan. Does never run out of items (just waits for new ones written to the TChan).