chan-split-0.5.0: Concurrent Chans as read/write pairs. Also provides generic Chan pair class.

Safe HaskellNone

Control.Concurrent.STM.TChan.Split

Contents

Synopsis

Documentation

Much of the STM chan functionality exists in the SplitTChan and class, which you should see for documentation.

TChan pairs

data InTChan a Source

The input side of an unbounded FIFO channel.

data OutTChan a Source

The output side of an unbounded FIFO channel.

Construction

See also the NewSplitTChan class.

newInTChan :: STM (InTChan a)Source

Create a new write end of a TChan. Use dupTChan to get an OutChan that values can be read from.

In IO

newSplitTChanIO :: IO (OutTChan a, InTChan a)Source

IO version of newTChan. This is useful for creating top-level TChans using unsafePerformIO, because using atomically inside unsafePerformIO isn't possible.

newInTChanIO :: IO (InTChan a)Source

IO version of newInTChan.

Putting values back

unGetTChan :: OutTChan a -> a -> STM ()Source

Put a data item back onto a channel, where it will be the next item read.

Duplication

dupTChan :: InTChan a -> STM (OutTChan a)Source

Create a duplicate OutChan from an InChan. The OutChan starts empty but will receive a copy of all subsequent values written.

cloneTChan :: OutTChan a -> STM (OutTChan a)Source

Clone a TChan: similar to dupTChan, but the cloned channel starts with the same content available as the original channel.