Portability | non-portable |
---|---|
Maintainer | Roman Leshchinskiy <rl@cse.unsw.edu.au> |
Safe Haskell | None |
Primitive boxed mutable variables
- data MutVar s a = MutVar (MutVar# s a)
- newMutVar :: PrimMonad m => a -> m (MutVar (PrimState m) a)
- readMutVar :: PrimMonad m => MutVar (PrimState m) a -> m a
- writeMutVar :: PrimMonad m => MutVar (PrimState m) a -> a -> m ()
- atomicModifyMutVar :: PrimMonad m => MutVar (PrimState m) a -> (a -> (a, b)) -> m b
- modifyMutVar :: PrimMonad m => MutVar (PrimState m) a -> (a -> a) -> m ()
Documentation
A MutVar
behaves like a single-element mutable array associated
with a primitive state token.
newMutVar :: PrimMonad m => a -> m (MutVar (PrimState m) a)Source
Create a new MutVar
with the specified initial value
writeMutVar :: PrimMonad m => MutVar (PrimState m) a -> a -> m ()Source
Write a new value into a MutVar