ivar-simple

Write once concurrency primitives.

Latest on Hackage:0.3.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

MIT licensed
Maintained by Bertram Felgenhauer

What is this?

ivar-simple provides immutable, write-once variables (IVars) in the Data.IVar.Simple module.

It also provides two more experimental channel implementations built on top of IVars,

  • 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 IVar with data-ivar is an IO operation. In ivar-simple it's a pure function.
  • data-ivar provides a Reader monoid, monad, etc. for reading from one of several IVars. ivar-simple has no such functionality.
  • The data-ivar implementation can, in principle, add arbitrary IO actions that are called when an IVar is 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 IVar for a second time is as cheap as evaluating a record selector. (I have no performance numbers for this.)

Changes

0.3.2 (2015-10-29)
* add Eq instances for `IVar` and `MIChan`

0.3.1 (2015-07-02)
* fix building with ghc 7.8

0.3 (2012-07-24)
* change NonTermination to a custom BlockedIndefinitelyOnIVar
exception, and require base >= 4. (using NonTermination leads to
<<loop>> messages)

0.2 (2012-07-23)
* change BlockedIndefinitely exception (gone since ghc 7.0) to
NonTermination

0.1.0.2 (2009-06-03)
* depend on base < 5 instead of base.

0.1.0.1 (2009-01-11)
* make Data.IVar.Simple.tryWrite exception safe
(noticed by Chris Kuklewicz)

0.1.0.0 (2009-01-11)
* initial version
Depends on:
Used by 1 package:
comments powered byDisqus