-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A faster variant of the RWS monad transformers. -- @package stateWriter @version 0.2.3 module Control.Monad.Trans.RSS.Strict -- | A monad containing an environment of type r, output of type -- w and an updatable state of type s. type RSS r w s = RSST r w s Identity -- | Construct an RSS computation from a function. (The inverse of -- runRSS.) rss :: Monoid w => (r -> s -> (a, s, w)) -> RSS r w s a -- | Unwrap an RSS computation as a function. (The inverse of rss.) runRSS :: Monoid w => RSS r w s a -> r -> s -> (a, s, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final value and output, discarding the final state. evalRSS :: Monoid w => RSS r w s a -> r -> s -> (a, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final state and output, discarding the final value. execRSS :: Monoid w => RSS r w s a -> r -> s -> (s, w) withRSS :: (r' -> s -> (r, s)) -> RSS r w s a -> RSS r' w s a -- | A monad transformer adding reading an environment of type r, -- collecting an output of type w and updating a state of type -- s to an inner monad m. data RSST r w s m a runRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (a, s, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final value and output, discarding the final state. evalRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (a, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final state and output, discarding the final value. execRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (s, w) -- | withRSST f m executes action m with an -- initial environment and state modified by applying f. -- --
withRSST :: (r' -> s -> (r, s)) -> RSST r w s m a -> RSST r' w s m a instance (Monoid w, Monad m) => MonadRWS r w s (RSST r w s m) instance (Monoid w, Monad m) => MonadWriter w (RSST r w s m) instance Monad m => MonadReader r (RSST r w s m) instance Monad m => MonadState s (RSST r w s m) instance MonadIO m => MonadIO (RSST r w s m) instance MonadTrans (RSST r w s) instance MonadFix m => MonadFix (RSST r w s m) instance (Functor m, MonadPlus m) => Alternative (RSST r w s m) instance (Functor m, Monad m) => Applicative (RSST r w s m) instance MonadPlus m => MonadPlus (RSST r w s m) instance Monad m => Monad (RSST r w s m) instance Functor m => Functor (RSST r w s m) -- | Strict RSS monad. -- -- This is a variant of the classic "Control.Monad..RWS.Strict" -- transformer, where the Writer part rides with the State part. module Control.Monad.RSS.Strict -- | A monad containing an environment of type r, output of type -- w and an updatable state of type s. type RSS r w s = RSST r w s Identity -- | Construct an RSS computation from a function. (The inverse of -- runRSS.) rss :: Monoid w => (r -> s -> (a, s, w)) -> RSS r w s a -- | Unwrap an RSS computation as a function. (The inverse of rss.) runRSS :: Monoid w => RSS r w s a -> r -> s -> (a, s, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final value and output, discarding the final state. evalRSS :: Monoid w => RSS r w s a -> r -> s -> (a, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final state and output, discarding the final value. execRSS :: Monoid w => RSS r w s a -> r -> s -> (s, w) withRSS :: (r' -> s -> (r, s)) -> RSS r w s a -> RSS r' w s a -- | A monad transformer adding reading an environment of type r, -- collecting an output of type w and updating a state of type -- s to an inner monad m. data RSST r w s m a -- | Evaluate a computation with the given initial state and environment, -- returning the final value and output, discarding the final state. evalRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (a, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final state and output, discarding the final value. execRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (s, w) -- | withRSST f m executes action m with an -- initial environment and state modified by applying f. -- -- withRSST :: (r' -> s -> (r, s)) -> RSST r w s m a -> RSST r' w s m a module Control.Monad.RSS module Control.Monad.Trans.RSS.Lazy -- | A monad containing an environment of type r, output of type -- w and an updatable state of type s. type RSS r w s = RSST r w s Identity -- | Construct an RSS computation from a function. (The inverse of -- runRSS.) rss :: Monoid w => (r -> s -> (a, s, w)) -> RSS r w s a -- | Unwrap an RSS computation as a function. (The inverse of rws.) runRSS :: Monoid w => RSS r w s a -> r -> s -> (a, s, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final value and output, discarding the final state. evalRSS :: Monoid w => RSS r w s a -> r -> s -> (a, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final state and output, discarding the final value. execRSS :: Monoid w => RSS r w s a -> r -> s -> (s, w) withRSS :: (r' -> s -> (r, s)) -> RSS r w s a -> RSS r' w s a -- | A monad transformer adding reading an environment of type r, -- collecting an output of type w and updating a state of type -- s to an inner monad m. data RSST r w s m a runRSST :: (Monoid w, Monad m) => RSST r w s m a -> r -> s -> m (a, s, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final value and output, discarding the final state. evalRSST :: (Monad m, Monoid w) => RSST r w s m a -> r -> s -> m (a, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final state and output, discarding the final value. execRSST :: (Monad m, Monoid w) => RSST r w s m a -> r -> s -> m (s, w) -- | withRSST f m executes action m with an -- initial environment and state modified by applying f. -- -- withRSST :: (r' -> s -> (r, s)) -> RSST r w s m a -> RSST r' w s m a instance (Monoid w, Monad m) => MonadRWS r w s (RSST r w s m) instance (Monoid w, Monad m) => MonadWriter w (RSST r w s m) instance Monad m => MonadReader r (RSST r w s m) instance Monad m => MonadState s (RSST r w s m) instance MonadIO m => MonadIO (RSST r w s m) instance MonadTrans (RSST r w s) instance MonadFix m => MonadFix (RSST r w s m) instance (Functor m, MonadPlus m) => Alternative (RSST r w s m) instance (Functor m, Monad m) => Applicative (RSST r w s m) instance MonadPlus m => MonadPlus (RSST r w s m) instance Monad m => Monad (RSST r w s m) instance Functor m => Functor (RSST r w s m) -- | Lazy RSS monad. -- -- This is a variant of the classic "Control.Monad..RWS.Lazy" -- transformer, where the Writer part rides with the State part. module Control.Monad.RSS.Lazy -- | A monad containing an environment of type r, output of type -- w and an updatable state of type s. type RSS r w s = RSST r w s Identity -- | Construct an RSS computation from a function. (The inverse of -- runRSS.) rss :: Monoid w => (r -> s -> (a, s, w)) -> RSS r w s a -- | Unwrap an RSS computation as a function. (The inverse of rws.) runRSS :: Monoid w => RSS r w s a -> r -> s -> (a, s, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final value and output, discarding the final state. evalRSS :: Monoid w => RSS r w s a -> r -> s -> (a, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final state and output, discarding the final value. execRSS :: Monoid w => RSS r w s a -> r -> s -> (s, w) withRSS :: (r' -> s -> (r, s)) -> RSS r w s a -> RSS r' w s a -- | A monad transformer adding reading an environment of type r, -- collecting an output of type w and updating a state of type -- s to an inner monad m. data RSST r w s m a -- | Evaluate a computation with the given initial state and environment, -- returning the final value and output, discarding the final state. evalRSST :: (Monad m, Monoid w) => RSST r w s m a -> r -> s -> m (a, w) -- | Evaluate a computation with the given initial state and environment, -- returning the final state and output, discarding the final value. execRSST :: (Monad m, Monoid w) => RSST r w s m a -> r -> s -> m (s, w) -- | withRSST f m executes action m with an -- initial environment and state modified by applying f. -- -- withRSST :: (r' -> s -> (r, s)) -> RSST r w s m a -> RSST r' w s m a module Control.Monad.Trans.RSS