module Monad.Trans
(
module Control.Monad.Except
, module Control.Monad.Reader
, module Control.Monad.State.Strict
, module Control.Monad.Trans
, module Control.Monad.Trans.Identity
, module Control.Monad.Trans.Maybe
, usingReader
, usingReaderT
, evaluatingState
, evaluatingStateT
, executingState
, executingStateT
, usingState
, usingStateT
) where
import Control.Monad.Except (ExceptT (..), runExceptT)
import Control.Monad.Reader (MonadReader, Reader, ReaderT (..), ask,
asks, local, reader, runReader)
import Control.Monad.State.Strict (MonadState, State, StateT (..), evalState,
evalStateT, execState, execStateT, get,
gets, modify, put, runState, state,
withState)
import Control.Monad.Trans (MonadIO, MonadTrans, lift, liftIO)
import Control.Monad.Trans.Identity (IdentityT (runIdentityT))
import Control.Monad.Trans.Maybe (MaybeT (..), exceptToMaybeT,
maybeToExceptT)
import Prelude (Functor, flip, fst, snd, (<$>))
usingReaderT :: r -> ReaderT r m a -> m a
usingReaderT = flip runReaderT
usingReader :: r -> Reader r a -> a
usingReader = flip runReader
usingStateT :: s -> StateT s m a -> m (a, s)
usingStateT = flip runStateT
usingState :: s -> State s a -> (a, s)
usingState = flip runState
evaluatingStateT :: Functor f => s -> StateT s f a -> f a
evaluatingStateT s st = fst <$> usingStateT s st
evaluatingState :: s -> State s a -> a
evaluatingState s st = fst (usingState s st)
executingStateT :: Functor f => s -> StateT s f a -> f s
executingStateT s st = snd <$> usingStateT s st
executingState :: s -> State s a -> s
executingState s st = snd (usingState s st)