BSD-3-Clause licensed by Alexey Kuleshevich
Maintained by alexey@kuleshevi.ch

Module documentation for 0.1.1.0

This version can be pinned in stack with:pvar-0.1.1.0@sha256:4715f603c0e87dbccdd49e1958554f8771f7730c8a61561552690b929223aa8f,1798

pvar

Interface for a mutable veriable PVar that can hold values that have Prim instance.

Status

Language Travis Azure Coveralls
GitHub top language Travis Build Status Coverage Status
Package Hackage Nightly LTS
pvar Hackage Nightly Nightly

Overview

Main features include:

  • Perfomance. There is practically no overhead when compared to operating on pure values, although there is a higher memory overhead, since PVar is backed by a MutableByteArray#
  • Atomic operations for PVars with Int values. This includes a unique function that is not availiable in ghc-prim out of the box:
atomicModifyIntPVar :: PrimMonad m => PVar m Int -> (Int -> (Int, a)) -> m a
  • Works in PrimMonad, therfore usable with ST, IO and various transformer monads.
  • Easy access to PVar contents with Storable
  • isByteArrayPinned, isMutableByteArrayPinned function that work on ghc-7.10 and ghc-8.0 as well as all the newer ones.

Changes

Changelog for pvar

0.1.1.0

  • Addition of backwards compatible:
    • isByteArrayPinned, isMutableByteArrayPinned (that work on ghc-7.10 and ghc-8.0)
    • Primitive versions isByteArrayPinned#, isMutableByteArrayPinned#
  • Support for GHC 7.10 and GHC 8.0
  • Re-export sizeOf and alignment for easier compatibility with older primitive versions.

0.1.0.0

  • Initial release