rio-0.1.22.0: A standard library for Haskell

Safe Haskell | Safe-Inferred
Language | Haskell2010

RIO.State

Description

Provides reexports of `MonadState` and related helpers.

Since: 0.1.4.0

# Documentation

class Monad m => MonadState s (m :: Type -> Type) | m -> s where #

Minimal complete definition

state | get, put

Methods

get :: m s #

put :: s -> m () #

state :: (s -> (a, s)) -> m a #

#### Instances

Instances details

HasStateRef s env => MonadState s (RIO env) # |
Instance details Defined in RIO.Prelude.RIO Methods get :: RIO env s # put :: s -> RIO env () # state :: (s -> (a, s)) -> RIO env a #
MonadState s m => MonadState s (MaybeT m) |
Instance details Defined in Control.Monad.State.Class Methods get :: MaybeT m s # put :: s -> MaybeT m () # state :: (s -> (a, s)) -> MaybeT m a #
(Monoid w, MonadState s m) => MonadState s (AccumT w m) |
Instance details Defined in Control.Monad.State.Class Methods get :: AccumT w m s # put :: s -> AccumT w m () # state :: (s -> (a, s)) -> AccumT w m a #
MonadState s m => MonadState s (ExceptT e m) |
Instance details Defined in Control.Monad.State.Class Methods get :: ExceptT e m s # put :: s -> ExceptT e m () # state :: (s -> (a, s)) -> ExceptT e m a #
MonadState s m => MonadState s (IdentityT m) |
Instance details Defined in Control.Monad.State.Class Methods get :: IdentityT m s # put :: s -> IdentityT m () # state :: (s -> (a, s)) -> IdentityT m a #
MonadState s m => MonadState s (ReaderT r m) |
Instance details Defined in Control.Monad.State.Class Methods get :: ReaderT r m s # put :: s -> ReaderT r m () # state :: (s -> (a, s)) -> ReaderT r m a #
MonadState s m => MonadState s (SelectT r m) |
Instance details Defined in Control.Monad.State.Class Methods get :: SelectT r m s # put :: s -> SelectT r m () # state :: (s -> (a, s)) -> SelectT r m a #
Monad m => MonadState s (StateT s m) |
Instance details Defined in Control.Monad.State.Class Methods get :: StateT s m s # put :: s -> StateT s m () # state :: (s -> (a, s)) -> StateT s m a #
Monad m => MonadState s (StateT s m) |
Instance details Defined in Control.Monad.State.Class Methods get :: StateT s m s # put :: s -> StateT s m () # state :: (s -> (a, s)) -> StateT s m a #
(Monoid w, MonadState s m) => MonadState s (WriterT w m) |
Instance details Defined in Control.Monad.State.Class Methods get :: WriterT w m s # put :: s -> WriterT w m () # state :: (s -> (a, s)) -> WriterT w m a #
(Monoid w, MonadState s m) => MonadState s (WriterT w m) |
Instance details Defined in Control.Monad.State.Class Methods get :: WriterT w m s # put :: s -> WriterT w m () # state :: (s -> (a, s)) -> WriterT w m a #
(Monoid w, MonadState s m) => MonadState s (WriterT w m) |
Instance details Defined in Control.Monad.State.Class Methods get :: WriterT w m s # put :: s -> WriterT w m () # state :: (s -> (a, s)) -> WriterT w m a #
MonadState s m => MonadState s (ContT r m) |
Instance details Defined in Control.Monad.State.Class Methods get :: ContT r m s # put :: s -> ContT r m () # state :: (s -> (a, s)) -> ContT r m a #
(Monad m, Monoid w) => MonadState s (RWST r w s m) |
Instance details Defined in Control.Monad.State.Class Methods get :: RWST r w s m s # put :: s -> RWST r w s m () # state :: (s -> (a, s)) -> RWST r w s m a #
(Monad m, Monoid w) => MonadState s (RWST r w s m) |
Instance details Defined in Control.Monad.State.Class Methods get :: RWST r w s m s # put :: s -> RWST r w s m () # state :: (s -> (a, s)) -> RWST r w s m a #
(Monad m, Monoid w) => MonadState s (RWST r w s m) |
Instance details Defined in Control.Monad.State.Class Methods get :: RWST r w s m s # put :: s -> RWST r w s m () # state :: (s -> (a, s)) -> RWST r w s m a #

gets :: MonadState s m => (s -> a) -> m a #

modify :: MonadState s m => (s -> s) -> m () #

modify' :: MonadState s m => (s -> s) -> m () #

type State s = StateT s Identity #

runState :: State s a -> s -> (a, s) #

evalState :: State s a -> s -> a #

execState :: State s a -> s -> s #

mapState :: ((a, s) -> (b, s)) -> State s a -> State s b #

withState :: (s -> s) -> State s a -> State s a #

newtype StateT s (m :: Type -> Type) a #

Constructors

StateT |
Fields runStateT :: s -> m (a, s)

#### Instances

Instances details

MonadReader r m => MonadReader r (StateT s m) |
Instance details Defined in Control.Monad.Reader.Class Methods ask :: StateT s m r # local :: (r -> r) -> StateT s m a -> StateT s m a # reader :: (r -> a) -> StateT s m a
Monad m => MonadState s (StateT s m) |
Instance details Defined in Control.Monad.State.Class Methods get :: StateT s m s # put :: s -> StateT s m () # state :: (s -> (a, s)) -> StateT s m a #
MonadWriter w m => MonadWriter w (StateT s m) |
Instance details Defined in Control.Monad.Writer.Class Methods writer :: (a, w) -> StateT s m a # tell :: w -> StateT s m () # listen :: StateT s m a -> StateT s m (a, w) # pass :: StateT s m (a, w -> w) -> StateT s m a #
MonadTrans (StateT s) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods lift :: Monad m => m a -> StateT s m a #
MonadFail m => MonadFail (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods fail :: String -> StateT s m a #
MonadFix m => MonadFix (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods mfix :: (a -> StateT s m a) -> StateT s m a
MonadIO m => MonadIO (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods liftIO :: IO a -> StateT s m a #
Contravariant m => Contravariant (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods contramap :: (a' -> a) -> StateT s m a -> StateT s m a' (>$) :: b -> StateT s m b -> StateT s m a
(Functor m, MonadPlus m) => Alternative (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods empty :: StateT s m a (<|>) :: StateT s m a -> StateT s m a -> StateT s m a # some :: StateT s m a -> StateT s m [a] # many :: StateT s m a -> StateT s m [a] #
(Functor m, Monad m) => Applicative (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods pure :: a -> StateT s m a # (<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b # liftA2 :: (a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c # (*>) :: StateT s m a -> StateT s m b -> StateT s m b # (<*) :: StateT s m a -> StateT s m b -> StateT s m a #
Functor m => Functor (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods fmap :: (a -> b) -> StateT s m a -> StateT s m b # (<$) :: a -> StateT s m b -> StateT s m a #
Monad m => Monad (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods (>>=) :: StateT s m a -> (a -> StateT s m b) -> StateT s m b # (>>) :: StateT s m a -> StateT s m b -> StateT s m b # return :: a -> StateT s m a #
MonadPlus m => MonadPlus (StateT s m) |
Instance details Defined in Control.Monad.Trans.State.Lazy Methods mzero :: StateT s m a # mplus :: StateT s m a -> StateT s m a -> StateT s m a #
MonadCatch m => MonadCatch (StateT s m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => StateT s m a -> (e -> StateT s m a) -> StateT s m a
MonadMask m => MonadMask (StateT s m) |
Instance details Defined in Control.Monad.Catch Methods mask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b # uninterruptibleMask :: HasCallStack => ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b # generalBracket :: HasCallStack => StateT s m a -> (a -> ExitCase b -> StateT s m c) -> (a -> StateT s m b) -> StateT s m (b, c) #
MonadThrow m => MonadThrow (StateT s m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> StateT s m a #
PrimMonad m => PrimMonad (StateT s m) |
Instance details Defined in Control.Monad.Primitive Associated Types type PrimState (StateT s m) # Methods primitive :: (State# (PrimState (StateT s m)) -> (# State# (PrimState (StateT s m)), a #)) -> StateT s m a #
Monad z => Zoom (StateT s z) (StateT t z) s t |
Instance details Defined in Lens.Micro.Mtl.Internal Methods zoom :: LensLike' (Zoomed (StateT s z) c) t s -> StateT s z c -> StateT t z c #
Generic (StateT s m a) |
Instance details Defined in Control.Monad.Trans.State.Lazy Associated Types type Rep (StateT s m a) :: Type -> Type Methods from :: StateT s m a -> Rep (StateT s m a) x to :: Rep (StateT s m a) x -> StateT s m a
type Zoomed (StateT s z) |
Instance details Defined in Lens.Micro.Mtl.Internal type Zoomed (StateT s z) = Focusing z
type PrimState (StateT s m) |
Instance details Defined in Control.Monad.Primitive type PrimState (StateT s m) = PrimState m
type Rep (StateT s m a) |
Instance details Defined in Control.Monad.Trans.State.Lazy type Rep (StateT s m a) = D1 ('MetaData "StateT" "Control.Monad.Trans.State.Lazy" "transformers-0.6.1.0" 'True) (C1 ('MetaCons "StateT" 'PrefixI 'True) (S1 ('MetaSel ('Just "runStateT") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (s -> m (a, s)))))

evalStateT :: Monad m => StateT s m a -> s -> m a #

execStateT :: Monad m => StateT s m a -> s -> m s #

mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b #

withStateT :: forall s (m :: Type -> Type) a. (s -> s) -> StateT s m a -> StateT s m a #