Safe Haskell | None |
---|

- newtype StateT s m a = StateT {}
- type State s = StateT s Identity
- mState :: (s -> (a, Maybe s)) -> State s a
- runState :: State s a -> s -> (a, Maybe s)
- focus :: Monad m => Lens t s -> StateT s m a -> StateT t m a
- viewState :: Monad m => (s -> t, t -> s) -> StateT t m a -> StateT s m a
- partialState :: Monad m => m a -> (s -> Maybe t, t -> s) -> StateT t m a -> StateT s m a
- partialStateE :: Monad m => m a -> (s -> Maybe t, t -> s) -> StateT t m b -> StateT s m (Either a b)
- eitherState :: Monad m => StateT s m a -> StateT t m a -> StateT (Either s t) m a
- maybeState :: Monad m => m a -> StateT s m a -> StateT (Maybe s) m a
- toStandardState :: Monad m => StateT s m a -> StateT s m a
- mapStateT :: (m (a, Maybe s) -> n (b, Maybe s)) -> StateT s m a -> StateT s n b
- pairStateT :: Functor m => StateT s (StateT t m) a -> StateT (s, t) m a
- module Control.Monad.State.Class
- module Control.Monad.Trans.Class
- module Control.Monad.IO.Class

# Documentation

runStateT and runState do not have the usual types: for now we do not make it too easy to discard the precious `Nothing`

viewState :: Monad m => (s -> t, t -> s) -> StateT t m a -> StateT s m aSource

functions st and ts should form a bijection since a StateT t with no changes will become a StateT s with no changes, no matter what st and ts are

partialStateE :: Monad m => m a -> (s -> Maybe t, t -> s) -> StateT t m b -> StateT s m (Either a b)Source

toStandardState :: Monad m => StateT s m a -> StateT s m aSource

module Control.Monad.State.Class

module Control.Monad.Trans.Class

module Control.Monad.IO.Class