TypeCompose-0.9.14: Type composition classes & instances

Copyright(c) Conal Elliott 2007
LicenseBSD3
Maintainerconal@conal.net
Stabilityexperimental
PortabilityMPTC
Safe HaskellSafe
LanguageHaskell98

Data.RefMonad

Description

Monads with references, taken from John Hughes's "Global Variables in Haskell" (http://citeseer.ist.psu.edu/473734.html).

Synopsis

Documentation

class Monad m => RefMonad m r | m -> r where Source #

Class of monads with references.

Methods

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

readRef :: r a -> m a Source #

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

Instances
RefMonad IO IORef Source # 
Instance details

Defined in Data.RefMonad

Methods

newRef :: a -> IO (IORef a) Source #

readRef :: IORef a -> IO a Source #

writeRef :: IORef a -> a -> IO () Source #

RefMonad (ST s) (STRef s) Source # 
Instance details

Defined in Data.RefMonad

Methods

newRef :: a -> ST s (STRef s a) Source #

readRef :: STRef s a -> ST s a Source #

writeRef :: STRef s a -> a -> ST s () Source #

modifyRef :: RefMonad m r => r a -> (a -> a) -> m () Source #

Change the contents of a ref