primitive-0.5.0.1: Primitive memory-related operations

Portabilitynon-portable
MaintainerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Safe HaskellNone

Data.Primitive.MutVar

Description

Primitive boxed mutable variables

Synopsis

Documentation

data MutVar s a Source

A MutVar behaves like a single-element mutable array associated with a primitive state token.

Constructors

MutVar (MutVar# s a) 

Instances

Typeable2 MutVar 
Eq (MutVar s a) 

newMutVar :: PrimMonad m => a -> m (MutVar (PrimState m) a)Source

Create a new MutVar with the specified initial value

readMutVar :: PrimMonad m => MutVar (PrimState m) a -> m aSource

Read the value of a MutVar

writeMutVar :: PrimMonad m => MutVar (PrimState m) a -> a -> m ()Source

Write a new value into a MutVar

atomicModifyMutVar :: PrimMonad m => MutVar (PrimState m) a -> (a -> (a, b)) -> m bSource

Atomically mutate the contents of a MutVar

modifyMutVar :: PrimMonad m => MutVar (PrimState m) a -> (a -> a) -> m ()Source

Mutate the contents of a MutVar