Module

Control.Monad.ST.Ref

Package
purescript-st
Repository
purescript/purescript-st

Re-exports from Control.Monad.ST.Internal

#STRef Source

data STRef :: Region -> Type -> Type

The type STRef r a represents a mutable reference holding a value of type a, which can be used with the ST r effect.

#write Source

write :: forall a r. a -> STRef r a -> ST r a

Set the value of a mutable reference.

#read Source

read :: forall a r. STRef r a -> ST r a

Read the current value of a mutable reference.

#new Source

new :: forall a r. a -> ST r (STRef r a)

Create a new mutable reference.

#modify' Source

modify' :: forall r a b. (a -> { state :: a, value :: b }) -> STRef r a -> ST r b

Update the value of a mutable reference by applying a function to the current value, computing a new state value for the reference and a return value.

#modify Source

modify :: forall r a. (a -> a) -> STRef r a -> ST r a

Modify the value of a mutable reference by applying a function to the current value. The modified value is returned.