Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | mainland@eecs.harvard.edu |
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.
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
MonadRef IO | |
MonadRef STM | |
MonadRef (ST s) | |
MonadRef m => MonadRef (MaybeT m) | |
MonadRef m => MonadRef (ListT m) | |
MonadRef m => MonadRef (IdentityT m) | |
(Monoid w, MonadRef m) => MonadRef (WriterT w m) | |
(Monoid w, MonadRef m) => MonadRef (WriterT w m) | |
MonadRef m => MonadRef (StateT s m) | |
MonadRef m => MonadRef (StateT s m) | |
MonadRef m => MonadRef (ReaderT r m) | |
(Error e, MonadRef m) => MonadRef (ErrorT e m) | |
MonadRef m => MonadRef (ContT r m) |
class MonadRef m => MonadAtomicRef m whereSource
atomicModifyRef :: Ref m a -> (a -> (a, b)) -> m bSource
Atomically mutate the contents of a reference
MonadAtomicRef IO | |
MonadAtomicRef STM | |
MonadAtomicRef m => MonadAtomicRef (MaybeT m) | |
MonadAtomicRef m => MonadAtomicRef (ListT m) | |
MonadAtomicRef m => MonadAtomicRef (IdentityT m) | |
(Monoid w, MonadAtomicRef m) => MonadAtomicRef (WriterT w m) | |
(Monoid w, MonadAtomicRef m) => MonadAtomicRef (WriterT w m) | |
MonadAtomicRef m => MonadAtomicRef (StateT s m) | |
MonadAtomicRef m => MonadAtomicRef (StateT s m) | |
MonadAtomicRef m => MonadAtomicRef (ReaderT r m) | |
(Error e, MonadAtomicRef m) => MonadAtomicRef (ErrorT e m) | |
MonadAtomicRef m => MonadAtomicRef (ContT r m) |