Copyright | (c) Dong Han 2017~2019 |
---|---|
License | BSD-style |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Z.Data.PrimRef.PrimSTRef
Contents
Description
This package provide fast unboxed references for ST monad. Unboxed reference is implemented using single cell MutableByteArray s to eliminate indirection overhead which MutVar# s a carry, on the otherhand unboxed reference only support limited type(instances of Prim
class).
Synopsis
- newtype PrimSTRef s a = PrimSTRef (MutableByteArray s)
- newPrimSTRef :: Prim a => a -> ST s (PrimSTRef s a)
- readPrimSTRef :: Prim a => PrimSTRef s a -> ST s a
- writePrimSTRef :: Prim a => PrimSTRef s a -> a -> ST s ()
- modifyPrimSTRef :: Prim a => PrimSTRef s a -> (a -> a) -> ST s ()
Unboxed ST references
newtype PrimSTRef s a Source #
A mutable variable in the ST monad which can hold an instance of Prim
.
Constructors
PrimSTRef (MutableByteArray s) |