chan-split: Concurrent Chans as read/write pairs. Also provides generic Chan pair class.
An implementation of concurrent channels identical to Control.Concurrent.Chan, except that the channel is represented as a pair, one of which allows only read operations, the other write operations.
This makes code easier to reason about (the types strictly
delegate read/write permission), suggests useful instances
(e.g. Functor
and Contravariant
are easily defined)
on the chan pairs, and simplifies the API.
Furthermore this allows messages sent to channels with no readers to be trivially garbage-collected, without relying on inlining optimizations.
We also provide a module that defines a class SplitChan
which defines the basic methods any pair of Chan types
should provide, allowing easy swapping of Chan
implementations.
To use standard Chans with these polymorphic functions, import as follows:
import Control.Concurrent.Chan hiding (readChan,writeChan,writeList2Chan) import Control.Concurrent.Chan.Class
When used alongside standard Chans, the Split module can be imported qualified like:
import qualified Control.Concurrent.Chan.Split as S
Its interface is mostly backwards compatible with Chan. Note, we do not implement the deprecated unGetChan and isEmptyChan functions.
This module is used internally by the "simple-actors" package.
CHANGES: 0.4.0 -> 0.5.0
modify TChan v2.4 code into split version
depend on STM
clean up Extensions section and broken links
Modules
[Index]
Downloads
- chan-split-0.5.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1.2, 0.1.3, 0.2.0, 0.3.0, 0.4.0, 0.5.0 |
---|---|
Dependencies | base (>=4 && <5), stm (>2 && <3) [details] |
License | BSD-3-Clause |
Author | Brandon Simmons |
Maintainer | brandon.m.simmons@gmail.com |
Category | Concurrency |
Home page | http://brandon.si/code/module-chan-split-released/ |
Source repo | head: git clone https://github.com/jberryman/chan-split.git |
Uploaded | by BrandonSimmons at 2012-10-27T00:01:29Z |
Distributions | NixOS:0.5.0 |
Reverse Dependencies | 2 direct, 0 indirect [details] |
Downloads | 5202 total (35 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs uploaded by user Build status unknown [no reports yet] |