Safe Haskell | None |
---|
- data InTChan a
- data OutTChan a
- newInTChan :: STM (InTChan a)
- newSplitTChanIO :: IO (OutTChan a, InTChan a)
- newInTChanIO :: IO (InTChan a)
- unGetTChan :: OutTChan a -> a -> STM ()
- dupTChan :: InTChan a -> STM (OutTChan a)
- cloneTChan :: OutTChan a -> STM (OutTChan a)
Documentation
Much of the STM chan functionality exists in the SplitTChan
and class,
which you should see for documentation.
TChan pairs
The input side of an unbounded FIFO channel.
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
TChan
s 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.