concurrency-1.6.0.0: Typeclasses, functions, and data types for concurrency and STM.

Copyright(c) 2016 Michael Walker
LicenseMIT
MaintainerMichael Walker <mike@barrucadu.co.uk>
Stabilitystable
Portabilityportable
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.

Since: concurrency-1.0.0.0

Operations

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

Build and returns a new instance of Chan.

Since: concurrency-1.0.0.0

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

Write a value to a Chan.

Since: concurrency-1.0.0.0

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

Read the next value from the Chan.

Since: concurrency-1.0.0.0

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.

Since: concurrency-1.0.0.0

Stream interface

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

Write an entire list of items to a Chan.

Since: concurrency-1.0.0.0