chp-1.5.0: An implementation of concurrency ideas from Communicating Sequential ProcessesSource codeContentsIndex
Control.Concurrent.CHP.Channels
Contents
Channel Creation and Types
Channel-Ends
Reading and Writing with Channels
Useful Type and Function Synonyms
Description

The module containing all the different types of channels in CHP.

A communication in CHP is always synchronised: the writer must wait until the reader arrives to take the data. There is thus no automatic or underlying buffering of data. (If you want to use buffers, see the Control.Concurrent.CHP.Buffers module).

If it helps, a channel communication can be thought of as a distributed binding. Imagine you have a process that creates a channel and then becomes the parallel composition of two sub-processes that at some point communicate on that channel (formatted here as two columns for illustration):

 do                      c <- oneToOneChannel
                                    (<||>)
    do p                                   do p'
       q                                      y <- q'
       x <- readChannel (reader c)            writeChannel (writer c) y
       r                                      r'
       s x                                    s'

It is as if, at the point where the two processes want to communicate, they come together and directly bind the value from one process in the other:

 do                      c <- oneToOneChannel
                                    (<||>)
    do p                                   do p'
       q                                      y <- q'
       x                            <-        return y
       r                                      r'
       s x                                    s'

The Control.Concurrent.CHP.Channels.Creation contains functions relating to the creation of channels. Channels are used via their ends -- see the Control.Concurrent.CHP.Channels.Ends module, and the Control.Concurrent.CHP.Channels.Communication module.

Broadcast and reduce channels are available in the Control.Concurrent.CHP.Channels.BroadcastReduce module, which is not automatically re-exported here.

This module was split into several smaller modules in version 1.5.0. Since it re-exports all the new modules, your code should not be affected at all.

Synopsis
module Control.Concurrent.CHP.Channels.Creation
getChannelIdentifier :: Chan r w a -> Unique
module Control.Concurrent.CHP.Channels.Ends
module Control.Concurrent.CHP.Channels.Communication
module Control.Concurrent.CHP.Channels.Synonyms
Channel Creation and Types
module Control.Concurrent.CHP.Channels.Creation
getChannelIdentifier :: Chan r w a -> UniqueSource
Gets the channel's identifier. Useful if you need to be able to identify a channel in the trace later on.
Channel-Ends
module Control.Concurrent.CHP.Channels.Ends
Reading and Writing with Channels
module Control.Concurrent.CHP.Channels.Communication
Useful Type and Function Synonyms
module Control.Concurrent.CHP.Channels.Synonyms
Produced by Haddock version 2.4.2