ref-tf-0.2: A type class for monads with references using type families.

Portabilitynon-portable
Stabilityexperimental
Maintainermainland@eecs.harvard.edu

Control.Monad.Ref

Description

 

Synopsis

Documentation

class Monad m => MonadRef m whereSource

The MonadRef type class abstracts over the details of manipulating references, allowing one to write code that uses references and can operate in any monad that supports reference operations.

Associated Types

type Ref m :: * -> *Source

Methods

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

Create a new reference

readRef :: Ref m a -> m aSource

Read the value of a reference

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

Write a new value to a reference

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

Mutate the contents of a reference

Instances