TChan is an abstract type representing an unbounded FIFO channel.
Moduleconcurrency-1.11.0.3Haskell2010
Control.Concurrent.Classy.STM.TChan
Transactional channels
Deviations: TChan as defined here does not have an Eq
instance, this is because the MonadSTM TVar type does not have
an Eq constraint. Furthermore, the newTChanIO and
newBroadcastTChanIO functions are not provided.
Contents
Synopsis
- data TChan
- value newTChan
- value newBroadcastTChan
- value dupTChan
- value cloneTChan
- value readTChan
- value tryReadTChan
- value peekTChan
- value tryPeekTChan
- value writeTChan
- value unGetTChan
- value isEmptyTChan
- Packageconcurrency-1.11.0.3
- Exports12
- LanguageHaskell2010
- LicenceMIT
- SourceTChan.hs
TChans
Construction
Build and return a new instance of TChan
Duplicate a TChan: the duplicate channel begins empty, but data written to either channel from then on will be available from both. Hence this creates a kind of broadcast channel, where data written by anyone is seen by everyone else.
Reading and writing
Read the next value from the TChan.
A version of readTChan which does not retry. Instead it
returns Nothing if no value is available.
Get the next value from the TChan without removing it, retrying if the channel is empty.
A version of peekTChan which does not retry. Instead it
returns Nothing if no value is available.
Write a value to a TChan.
Put a data item back onto a channel, where it will be the next item read.