| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
RIO.Prelude.URef
Contents
- class (Vector Vector a, MVector MVector a) => Unbox a
- data URef s a
- type IOURef = URef (PrimState IO)
- newURef :: (PrimMonad m, Unbox a) => a -> m (URef (PrimState m) a)
- readURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> m a
- writeURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> a -> m ()
- modifyURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> (a -> a) -> m ()
Unboxed references
class (Vector Vector a, MVector MVector a) => Unbox a #
Instances
| Unbox Bool | |
| Unbox Char | |
| Unbox Double | |
| Unbox Float | |
| Unbox Int | |
| Unbox Int8 | |
| Unbox Int16 | |
| Unbox Int32 | |
| Unbox Int64 | |
| Unbox Word | |
| Unbox Word8 | |
| Unbox Word16 | |
| Unbox Word32 | |
| Unbox Word64 | |
| Unbox () | |
| Unbox a => Unbox (Complex a) | |
| (Unbox a, Unbox b) => Unbox (a, b) | |
| (Unbox a, Unbox b, Unbox c) => Unbox (a, b, c) | |
| (Unbox a, Unbox b, Unbox c, Unbox d) => Unbox (a, b, c, d) | |
| (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Unbox (a, b, c, d, e) | |
| (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Unbox (a, b, c, d, e, f) | |
An unboxed reference. This works like an IORef, but the data is
stored in a bytearray instead of a heap object, avoiding
significant allocation overhead in some cases. For a concrete
example, see this Stack Overflow question:
https://stackoverflow.com/questions/27261813/why-is-my-little-stref-int-require-allocating-gigabytes.
The first parameter is the state token type, the same as would be
used for the ST monad. If you're using an IO-based monad, you
can use the convenience IOURef type synonym instead.
Since: 0.0.2.0
newURef :: (PrimMonad m, Unbox a) => a -> m (URef (PrimState m) a) Source #
Create a new URef
Since: 0.0.2.0
readURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> m a Source #
Read the value in a URef
Since: 0.0.2.0