Copyright | (c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 Kowainik |
---|---|
License | MIT |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | Safe |
Language | Haskell2010 |
Monad transformers utilities.
Synopsis
- usingReader :: r -> Reader r a -> a
- usingReaderT :: r -> ReaderT r m a -> m a
- evaluatingState :: s -> State s a -> a
- evaluatingStateT :: Functor f => s -> StateT s f a -> f a
- executingState :: s -> State s a -> s
- executingStateT :: Functor f => s -> StateT s f a -> f s
- usingState :: s -> State s a -> (a, s)
- usingStateT :: s -> StateT s m a -> m (a, s)
- hoistMaybe :: Applicative m => Maybe a -> MaybeT m a
- hoistEither :: Applicative m => Either e a -> ExceptT e m a
Convenient functions to work with Reader
monad
usingReader :: r -> Reader r a -> a Source #
Shorter and more readable alias for flip runReader
.
usingReaderT :: r -> ReaderT r m a -> m a Source #
Shorter and more readable alias for flip runReaderT
.
Convenient functions to work with State
monad
evaluatingState :: s -> State s a -> a Source #
Alias for flip evalState
. It's not shorter but sometimes
more readable. Done by analogy with using*
functions family.
evaluatingStateT :: Functor f => s -> StateT s f a -> f a Source #
Alias for flip evalStateT
. It's not shorter but sometimes
more readable. Done by analogy with using*
functions family.
executingState :: s -> State s a -> s Source #
Alias for flip execState
. It's not shorter but sometimes
more readable. Done by analogy with using*
functions family.
executingStateT :: Functor f => s -> StateT s f a -> f s Source #
Alias for flip execStateT
. It's not shorter but sometimes
more readable. Done by analogy with using*
functions family.
usingState :: s -> State s a -> (a, s) Source #
Shorter and more readable alias for flip runState
.
usingStateT :: s -> StateT s m a -> m (a, s) Source #
Shorter and more readable alias for flip runStateT
.
Lifted to Transformers
hoistMaybe :: Applicative m => Maybe a -> MaybeT m a Source #
hoistEither :: Applicative m => Either e a -> ExceptT e m a Source #