MyNixOS website logo
Description

Write once concurrency primitives.

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.

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

Version

0.3.3

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows