HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

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.

  • 1 type
  • 11 values

TChans

1 declaration
datadata TChan (stm :: Type -> Type) a
#

TChan is an abstract type representing an unbounded FIFO channel.

Construction

4 declarations
valuedupTChan :: MonadSTM stm => TChan stm a -> stm (TChan stm a)
#

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

7 declarations
valuepeekTChan :: MonadSTM stm => TChan stm a -> stm a
#

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

valueunGetTChan :: MonadSTM stm => TChan stm a -> a -> stm ()
#

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