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

Safe HaskellSafe-Inferred

Control.Concurrent.STM.TChan.Class

Synopsis

Documentation

class SplitTChan i o | i -> o, o -> i whereSource

A class capturing Chan operations in STM.

Methods

writeTChan :: i a -> a -> STM ()Source

Write a value to the in chan.

readTChan :: o a -> STM aSource

Read the next value from the out chan.

peekTChan :: o a -> STM aSource

Get the next value from the TChan without removing it, retrying if the channel is empty.

tryPeekTChan :: o a -> STM (Maybe a)Source

A version of peekTChan which does not retry. Instead it returns Nothing if no value is available.

tryReadTChan :: o a -> STM (Maybe a)Source

A version of readTChan which does not retry. Instead it returns Nothing if no value is available.

isEmptyTChan :: o a -> STM BoolSource

Returns True if the supplied TChan is empty.

class SplitTChan i o => NewSplitTChan i o whereSource

A class for SplitTChan types that can be instantiated without programmer input. e.g. the standard haskell TChan is a member of this class, however a bounded chan type that took an Int to define the buffer size would not.

Methods

newSplitTChan :: STM (i a, o a)Source