pvar: Mutable variable with primitive values

[ bsd3, data, library ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/lehins/pvar#readme


[Skip to Readme]

Downloads

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.8 && <6), deepseq, primitive (>=0.5.4.0) [details]
License BSD-3-Clause
Copyright Alexey Kuleshevich
Author Alexey Kuleshevich
Maintainer alexey@kuleshevi.ch
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-03-19T04:20:37Z
Distributions LTSHaskell:1.0.0.0, NixOS:1.0.0.0, Stackage:1.0.0.0
Reverse Dependencies 1 direct, 15 indirect [details]
Downloads 3421 total (60 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-03-19 [all 1 reports]

Readme for pvar-0.1.1.0

[back to package description]

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.