-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell references backed by an IntMap for persistence and reversibility. -- -- This library provides support for a persistent version of the -- Control.Monad.ST.ST monad. Internally, references are backed by -- a Data.IntMap.IntMap, rather than being mutable variables on -- the heap. This decreases performance, but can be useful in certain -- settings, particularly those involving backtracking. @package persistent-refs @version 0.1 -- | Mutable references in the persistent ST monad. module Data.STRef.Persistent data STRef s a -- | 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 MonadRef (STRef s) (ST s) -- | 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. data ST s a -- | 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