| |||||||||||||||||||||
| |||||||||||||||||||||
| Description | |||||||||||||||||||||
All the channel-ends in CHP are instances of ReadableChannel (for ends that you can read from) or WriteableChannel (for ends that you can write to). The readChannel and writeChannel functions are the standard way to communicate on a channel. These functions wait for the other party in the communication to arrive, then exchange the data, then complete. In pseudo-code, the semantics are like this when two parties (shown here as two columns) communicate: do sync sync
x <- return y
done done
Further options are offered by the extReadChannel and extWriteChannel channels, which allow either side to perform additional (so-called extended) actions during the communication. The semantics when both sides are performing extended actions are: do sync sync
y <- extWriteAction
x <- return y
x' <- extReadAction x done
done done
return x'
Neither end need know that the other is performing an extended action, and any combination is possible (e.g. a normal writeChannel with an extReadChannel). | |||||||||||||||||||||
| Synopsis | |||||||||||||||||||||
| |||||||||||||||||||||
| Documentation | |||||||||||||||||||||
| |||||||||||||||||||||
| |||||||||||||||||||||
| |||||||||||||||||||||
| |||||||||||||||||||||
| |||||||||||||||||||||
A useful synonym for flip writeChannel. Especially useful with claim so that instead of writing claim output (flip writeChannel 6) you can write claim output (writeValue 6). Added in version 1.5.0. | |||||||||||||||||||||
| |||||||||||||||||||||
A helper function that uses the parallel strategies library (see the paper: "Algorithm + Strategy = Parallelism", P.W. Trinder et al, JFP 8(1) 1998, http://www.macs.hw.ac.uk/~dsg/gph/papers/html/Strategies/strategies.html) to make sure that the value sent down a channel is strictly evaluated by the sender before transmission. This is useful when you want to write worker processes that evaluate data and send it back to some "harvester" process. By default the values sent back may be unevaluated, and thus the harvester might end up doing the evaluation. If you use this function, the value is guaranteed to be completely evaluated before sending. Added in version 1.0.2. | |||||||||||||||||||||
| Produced by Haddock version 2.4.2 |