What is this?
ivar-simple provides immutable, write-once variables (
IVars) in the
It also provides two more experimental channel implementations built on
Data.IVar.Simple.IChan: multi-cast channels with write-once semantics.
Data.IVar.Simple.MIChan: channels with write semantics similar to Control.Concurrent.Chan
Comparison to data-ivar
Both data-ivar and ivar-simple provide a write-once variable. That's where the similarities end:
- Reading an
IVarwith data-ivar is an
IOoperation. In ivar-simple it's a pure function.
- data-ivar provides a
Readermonoid, monad, etc. for reading from one of several
IVars. ivar-simple has no such functionality.
- The data-ivar implementation can, in principle, add arbitrary
IOactions that are called when an
IVaris written. (This detail is not exposed, however)
- Technically, ivar-simple tries for efficiency by exploiting the existing
locking structures in the RTS; in particular, reading a full
IVarfor a second time is as cheap as evaluating a record selector. (I have no performance numbers for this.)
* add Eq instances for `IVar` and `MIChan`
* fix building with ghc 7.8
* change NonTermination to a custom BlockedIndefinitelyOnIVar
exception, and require base >= 4. (using NonTermination leads to
* change BlockedIndefinitely exception (gone since ghc 7.0) to
* depend on base < 5 instead of base.
* make Data.IVar.Simple.tryWrite exception safe
(noticed by Chris Kuklewicz)
* initial version