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]
Versions [faq],,
Change log CHANGELOG.md
Dependencies base (>=4.10 && <5), deepseq, primitive (>=0.6.4) [details]
License BSD-3-Clause
Copyright Alexey Kuleshevich
Author Alexey Kuleshevich
Maintainer alexey@kuleshevi.ch
Revised Revision 2 made by lehins at 2020-03-19T04:21:46Z
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-18T03:16:31Z
Distributions NixOS:
Downloads 374 total (53 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-03-18 [all 1 reports]


[Index] [Quick Jump]


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

For package maintainers and hackage trustees

Readme for pvar-

[back to package description]


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


| Language | Travis | Azure | Coveralls | |:--------:|:------:|:-----:|:---------:| | GitHub top language | Travis | Build Status | Coverage Status

| Package | Hackage | Nightly | LTS | |:-------------------|:-------:|:-------:|:---:| | pvar| Hackage| Nightly| Nightly


Main features include:

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