pvar-0.1.1.0: README.md
# pvar
Interface for a mutable veriable `PVar` that can hold values that have `Prim` instance.
## Status
| Language | Travis | Azure | Coveralls |
|:--------:|:------:|:-----:|:---------:|
|  | [](https://travis-ci.org/lehins/pvar) | [](https://dev.azure.com/kuleshevich/pvar/_build/latest?definitionId=1?branchName=master) | [](https://coveralls.io/github/lehins/pvar?branch=master)
| Package | Hackage | Nightly | LTS |
|:-------------------|:-------:|:-------:|:---:|
| [`pvar`](https://github.com/lehins/pvar)| [](https://hackage.haskell.org/package/pvar)| [](https://www.stackage.org/nightly/package/pvar)| [](https://www.stackage.org/lts/package/pvar)
# 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 `PVar`s with `Int` values. This includes a unique function that is
not availiable in `ghc-prim` out of the box:
```haskell
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.