pvar: Mutable variable with primitive values

[ bsd3, data, library ] [ Propose Tags ]

Mutable variable PVar that is backed by a single value MutableByteArray


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.2.0.0, 1.0.0.0
Change log CHANGELOG.md
Dependencies base (>=4.9 && <6), deepseq, primitive (>=0.7.1.0) [details]
License BSD-3-Clause
Copyright 2020 Alexey Kuleshevich
Author Alexey Kuleshevich
Maintainer alexey@kuleshevi.ch
Revised Revision 1 made by lehins at 2020-10-19T15:09:31Z
Category Data
Home page https://github.com/lehins/pvar#readme
Bug tracker https://github.com/lehins/pvar/issues
Source repo head: git clone https://github.com/lehins/pvar
Uploaded by lehins at 2020-10-19T15:00:28Z
Distributions LTSHaskell:1.0.0.0, Stackage:1.0.0.0
Reverse Dependencies 1 direct, 15 indirect [details]
Downloads 3381 total (62 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2020-10-19 [all 1 reports]

Readme for pvar-1.0.0.0

[back to package description]

pvar

Interface for a mutable variable 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:

  • Performance. 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 available in ghc-prim out of the box:
atomicModifyIntPVar :: PrimMonad m => PVar m Int -> (Int -> (Int, a)) -> m a
  • Works in PrimMonad, therefore it is 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.