ivar-simple: Write once concurrency primitives.

[ concurrency, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

IVars are write-once (immutable) variables.

They can be read, an operation that will block until a value was written to the variable. They can be written to exactly once.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.2, 0.3, 0.3.1, 0.3.2, 0.3.3
Change log Changelog
Dependencies base (>=4.7 && <5) [details]
License MIT
Copyright (c) 2008-2020 Bertram Felgenhauer
Author
Maintainer Bertram Felgenhauer <int-e@gmx.de>
Category Concurrency
Source repo head: git clone https://github.com/int-e/ivar-simple
Uploaded by BertramFelgenhauer at 2020-10-05T22:53:57Z
Distributions NixOS:0.3.3
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 4711 total (39 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-10-05 [all 1 reports]

Readme for ivar-simple-0.3.3

[back to package description]

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.)