ivar-simple-0.3.3: Write once concurrency primitives.

Copyright(c) 2008-2015 Bertram Felgenhauer
LicenseMIT
MaintainerBertram Felgenhauer <int-e@gmx.de>
Stabilityexperimental
Portabilityghc
Safe HaskellNone
LanguageHaskell2010

Data.IVar.Simple.MIChan

Description

An MIChan is a multicast channel built on top of an IChan.

Like IChan, this channel supports multiple readers. It is comparable to a Control.Concurrent.Chan.Chan for the writing end: Each write will append an element to the channel. No writes will fail.

Synopsis

Documentation

Comparison to Control.Concurrent.Chan:

Control.Concurrent.Chan.Chan => Data.MIChan
newChan                      => new
writeChan                    => write
getChanContents              => read
writeList2Chan               => writeList

These can't be implemented:

readChan     (can't steal items from other readers)
unGetChan    (there is no separate reading end)
isEmptyChan  (needs an IO interface for reading)
dupChan      (not needed)

data MIChan a Source #

A multicast channel.

Instances
Eq (MIChan a) Source # 
Instance details

Defined in Data.IVar.Simple.MIChan

Methods

(==) :: MIChan a -> MIChan a -> Bool #

(/=) :: MIChan a -> MIChan a -> Bool #

new :: IO (MIChan a) Source #

Create a new multicast channel.

read :: MIChan a -> IO [a] Source #

Return the list of values that the channel represents.

write :: MIChan a -> a -> IO () Source #

Send a value across the channel.

writeList :: MIChan a -> [a] -> IO () Source #

Send several values across the channel, atomically.