-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell references backed by an IntMap for persistence and reversibility. -- @package persistent-refs @version 0.4 -- | Mutable references in the persistent ST monad. module Data.STRef.Persistent data STRef s a -- | Get the underlying Int from an STRef. Useful for -- debugging. asInt :: STRef s a -> Int -- | 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. class Monad m => MonadRef (r :: * -> *) (m :: * -> *) | m -> r newRef :: MonadRef r m => a -> m (r a) readRef :: MonadRef r m => r a -> m a writeRef :: MonadRef r m => r a -> a -> m () modifyRef :: MonadRef r m => r a -> (a -> a) -> m () modifyRef' :: MonadRef r m => r a -> (a -> a) -> m () instance Eq (STRef s a) instance Show (STRef s a) instance Monad m => MonadRef (STRef s) (STT s m) -- | This library provides support for a persistent version of the -- ST monad. Internally, references are backed by a IntMap, -- rather than being mutable variables on the heap. This decreases -- performance, but can be useful in certain settings, particularly those -- involving backtracking. module Control.Monad.ST.Persistent -- | A persistent version of the ST monad. type ST s = STT s Identity -- | Run a computation that uses persistent references, and return a pure -- value. The rank-2 type offers similar guarantees to runST. runST :: (forall s. ST s a) -> a data STT s m a -- | Run a computation that uses persistent references, and return a pure -- value. The rank-2 type offers similar guarantees to runST. runSTT :: Monad m => (forall s. STT s m a) -> m a