ref-fd-0.1: A type class for monads with references using functional dependencies.

Portabilitynon-portable (uses Control.Monad.ST)
Stabilityexperimental
Maintainermainland@eecs.harvard.edu

Control.Monad.Ref

Description

Mutable references in the (strict) ST monad.

Synopsis

Documentation

class Monad m => MonadRef r m | m -> r whereSource

The MonadRef type class abstracts over the details of manipulating references, allowing one to write code that uses references and can operate in either the ST monad or the IO monad.

Methods

newRef :: a -> m (r a)Source

Create a new reference

readRef :: r a -> m aSource

Read the value of a reference

writeRef :: r a -> a -> m ()Source

Write a new value to a reference

modifyRef :: r a -> (a -> a) -> m ()Source

Mutate the contents of a reference

Instances