dejafu-0.3.0.0: Overloadable primitives for testable, potentially non-deterministic, concurrency.

Safe HaskellNone
LanguageHaskell2010

Control.Concurrent.Classy.Chan

Contents

Description

Unbounded channels.

Deviations: Chan as defined here does not have an Eq instance, this is because the MonadConc MVar type does not have an Eq constraint. The deprecated unGetChan and isEmptyCHan functions are not provided. Furthermore, the getChanContents function is not provided as it needs unsafe I/O.

Synopsis

The Chan type

data Chan m a Source

Chan is an abstract type representing an unbounded FIFO channel.

Operations

newChan :: MonadConc m => m (Chan m a) Source

Build and returns a new instance of Chan.

writeChan :: MonadConc m => Chan m a -> a -> m () Source

Write a value to a Chan.

readChan :: MonadConc m => Chan m a -> m a Source

Read the next value from the Chan.

dupChan :: MonadConc m => Chan m a -> m (Chan m 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.

Stream interface

writeList2Chan :: MonadConc m => Chan m a -> [a] -> m () Source

Write an entire list of items to a Chan.