-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A monad transformer version of the ST monad -- -- A monad transformer version of the ST monad @package STMonadTrans @version 0.1 -- | This library provides a monad transformer version of the ST monad. module Control.Monad.ST.Trans -- | STT is the monad transformer providing polymorphic updateable -- references data STT s m a -- | Executes a computation in the STT monad transformer runST :: (Monad m) => (forall s. STT s m a) -> m a -- | Mutable references data STRef s a -- | Create a new reference newSTRef :: (Monad m) => a -> STT s m (STRef s a) -- | Reads the value of a reference readSTRef :: (Monad m) => STRef s a -> STT s m a -- | Modifies the value of a reference writeSTRef :: (Monad m) => STRef s a -> a -> STT s m () -- | Mutable arrays data STArray s i e -- | Creates a new mutable array newSTArray :: (Ix i, Monad m) => (i, i) -> e -> STT s m (STArray s i e) -- | Retrieves an element from the array readSTArray :: (Ix i, Monad m) => STArray s i e -> i -> STT s m e -- | Modifies an element in the array writeSTArray :: (Ix i, Monad m) => STArray s i e -> i -> e -> STT s m () -- | Returns the lowest and highest indices of the array boundsSTArray :: STArray s i e -> (i, i) -- | Returns the number of elements in the array numElementsSTArray :: STArray s i e -> Int -- | Copy a mutable array and turn it into an immutable array freezeSTArray :: (Ix i, Monad m) => STArray s i e -> STT s m (Array i e) -- | Copy an immutable array and turn it into a mutable array thawSTArray :: (Ix i, Monad m) => Array i e -> STT s m (STArray s i e) -- | A safe way to create and work with a mutable array before returning an -- immutable array for later perusal. This function avoids copying the -- array before returning it. runSTArray :: (Ix i, Monad m) => (forall s. STT s m (STArray s i e)) -> m (Array i e) instance Eq (STArray s i e) instance (MonadWriter w m) => MonadWriter w (STT s m) instance (MonadState s m) => MonadState s (STT s' m) instance (MonadReader r m) => MonadReader r (STT s m) instance (MonadError e m) => MonadError e (STT s m) instance Eq (STRef s a) instance MonadTrans (STT s) instance (Monad m) => Monad (STT s m)