-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A type class for monads with references using type families. -- -- Contains a MonadRef type class that abstracts over the details -- of manipulating references, allowing one to write code that can -- operate in either the ST monad or the IO monad. @package ref-tf @version 0.1 -- | Mutable references in the (strict) ST monad. module Control.Monad.Ref -- | 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. class (Monad m) => MonadRef m where { type family Ref m :: * -> *; { modifyRef r f = readRef r >>= writeRef r . f } } newRef :: (MonadRef m) => a -> m (Ref m a) readRef :: (MonadRef m) => Ref m a -> m a writeRef :: (MonadRef m) => Ref m a -> a -> m () modifyRef :: (MonadRef m) => Ref m a -> (a -> a) -> m () instance MonadRef IO instance MonadRef (ST s)