Copyright (c) Peter Robinson 2009 The University of Glasgow 2004 BSD-style (see the file LICENSE) Peter Robinson experimental non-portable (requires STM) None Haskell2010

Description

Synopsis

# Documentation

data TChan a Source #

TChan is an abstract type representing an unbounded FIFO channel.

Build and returns a new instance of TChan

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

Read the next value from the TChan.

writeTChan :: MonadAdvSTM m => TChan a -> a -> m () Source #

Write a value to a TChan.

dupTChan :: MonadAdvSTM m => TChan a -> m (TChan a) Source #

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.

unGetTChan :: MonadAdvSTM m => TChan a -> a -> m () Source #

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

isEmptyTChan :: MonadAdvSTM m => TChan a -> m Bool Source #

Returns True if the supplied TChan is empty.