Copyright | (c) Harvard University 2006-2011 (c) Geoffrey Mainland 2011-2014 |
---|---|
License | BSD-style |
Maintainer | Geoffrey Mainland <mainland@cs.drexel.edu> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell98 |
Documentation
class Monad m => MonadRef m where Source #
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.
newRef :: a -> m (Ref m a) Source #
Create a new reference
readRef :: Ref m a -> m a Source #
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
modifyRef' :: Ref m a -> (a -> a) -> m () Source #
Strict version of modifyRef
MonadRef IO Source # | |
MonadRef STM Source # | |
MonadRef (ST s) Source # | |
MonadRef m => MonadRef (MaybeT m) Source # | |
MonadRef m => MonadRef (ListT m) Source # | |
(Monoid w, MonadRef m) => MonadRef (WriterT w m) Source # | |
(Monoid w, MonadRef m) => MonadRef (WriterT w m) Source # | |
MonadRef m => MonadRef (StateT s m) Source # | |
MonadRef m => MonadRef (StateT s m) Source # | |
MonadRef m => MonadRef (IdentityT * m) Source # | |
(Error e, MonadRef m) => MonadRef (ErrorT e m) Source # | |
MonadRef m => MonadRef (ExceptT e m) Source # | |
MonadRef m => MonadRef (ReaderT * r m) Source # | |
MonadRef m => MonadRef (ContT * r m) Source # | |
class MonadRef m => MonadAtomicRef m where Source #
atomicModifyRef :: Ref m a -> (a -> (a, b)) -> m b Source #
Atomically mutate the contents of a reference
atomicModifyRef' :: Ref m a -> (a -> (a, b)) -> m b Source #
Strict version of atomicModifyRef. This forces both the value stored in the reference as well as the value returned.
MonadAtomicRef IO Source # | |
MonadAtomicRef STM Source # | |
MonadAtomicRef m => MonadAtomicRef (MaybeT m) Source # | |
MonadAtomicRef m => MonadAtomicRef (ListT m) Source # | |
(Monoid w, MonadAtomicRef m) => MonadAtomicRef (WriterT w m) Source # | |
(Monoid w, MonadAtomicRef m) => MonadAtomicRef (WriterT w m) Source # | |
MonadAtomicRef m => MonadAtomicRef (StateT s m) Source # | |
MonadAtomicRef m => MonadAtomicRef (StateT s m) Source # | |
MonadAtomicRef m => MonadAtomicRef (IdentityT * m) Source # | |
(Error e, MonadAtomicRef m) => MonadAtomicRef (ErrorT e m) Source # | |
MonadAtomicRef m => MonadAtomicRef (ReaderT * r m) Source # | |
MonadAtomicRef m => MonadAtomicRef (ContT * r m) Source # | |