Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- module Control.Effect.State.Internal
- runState :: s -> StateC s m a -> m (s, a)
- evalState :: forall s m a. Functor m => s -> StateC s m a -> m a
- execState :: forall s m a. Functor m => s -> StateC s m a -> m s
- newtype StateC s m a = StateC {
- runStateC :: s -> m (s, a)
- class (HFunctor sig, Monad m) => Carrier sig m | m -> sig
- run :: PureC a -> a
State effect
Strict state carrier
runState :: s -> StateC s m a -> m (s, a) Source #
Run a State
effect starting from the passed value.
run (runState a (pure b)) === (a, b)
evalState :: forall s m a. Functor m => s -> StateC s m a -> m a Source #
Run a State
effect, yielding the result value and discarding the final state.
run (evalState a (pure b)) === b
execState :: forall s m a. Functor m => s -> StateC s m a -> m s Source #
Run a State
effect, yielding the final state and discarding the return value.
run (execState a (pure b)) === a
Instances
MonadTrans (StateC s) Source # | |
Defined in Control.Effect.State.Strict | |
Monad m => Monad (StateC s m) Source # | |
Functor m => Functor (StateC s m) Source # | |
MonadFix m => MonadFix (StateC s m) Source # | |
Defined in Control.Effect.State.Strict | |
MonadFail m => MonadFail (StateC s m) Source # | |
Defined in Control.Effect.State.Strict | |
Monad m => Applicative (StateC s m) Source # | |
Defined in Control.Effect.State.Strict | |
MonadIO m => MonadIO (StateC s m) Source # | |
Defined in Control.Effect.State.Strict | |
(Alternative m, Monad m) => Alternative (StateC s m) Source # | |
(Alternative m, Monad m) => MonadPlus (StateC s m) Source # | |
(Carrier sig m, Effect sig) => Carrier (State s :+: sig) (StateC s m) Source # | |
Re-exports
class (HFunctor sig, Monad m) => Carrier sig m | m -> sig Source #
The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the eff
method.