| Portability | non-portable (concurrency) |
|---|---|
| Stability | experimental |
| Maintainer | libraries@haskell.org |
| Safe Haskell | Trustworthy |
Control.Concurrent.Chan
Description
Unbounded channels.
The Chan type
Chan is an abstract type representing an unbounded FIFO channel.
Operations
dupChan :: Chan a -> IO (Chan a)Source
Duplicate a Chan: 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.
(Note that a duplicated channel is not equal to its original.
So: fmap (c /=) $ dupChan c returns True for all c.)
unGetChan :: Chan a -> a -> IO ()Source
Put a data item back onto a channel, where it will be the next item read.
Stream interface
getChanContents :: Chan a -> IO [a]Source
Return a lazy list representing the contents of the supplied
Chan, much like hGetContents.