base-4.7.0.0: Basic libraries

Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityexperimental
Portabilitynon-portable (concurrency)
Safe HaskellTrustworthy
LanguageHaskell2010

Control.Concurrent.Chan

Contents

Description

Unbounded channels.

Synopsis

The Chan type

data Chan a Source

Chan is an abstract type representing an unbounded FIFO channel.

Instances

Eq (Chan a) 
Typeable (★ → ★) Chan 

Operations

newChanIO (Chan a) Source

Build and returns a new instance of Chan.

writeChanChan a → a → IO () Source

Write a value to a Chan.

readChanChan a → IO a Source

Read the next value from the Chan.

dupChanChan 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.)

unGetChanChan a → a → IO () Source

Deprecated: if you need this operation, use Control.Concurrent.STM.TChan instead. See http://ghc.haskell.org/trac/ghc/ticket/4154 for details

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

isEmptyChanChan a → IO Bool Source

Deprecated: if you need this operation, use Control.Concurrent.STM.TChan instead. See http://ghc.haskell.org/trac/ghc/ticket/4154 for details

Returns True if the supplied Chan is empty.

Stream interface

getChanContentsChan a → IO [a] Source

Return a lazy list representing the contents of the supplied Chan, much like hGetContents.

writeList2ChanChan a → [a] → IO () Source

Write an entire list of items to a Chan.