| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Carrier.State.Lazy
Contents
Description
A carrier for the State effect that refrains from evaluating its state until necessary. This is less efficient than Control.Carrier.State.Strict but allows some cyclic computations to terminate that would loop infinitely in a strict state carrier.
Note that the parameter order in runState, evalState, and execState is reversed compared the equivalent functions provided by transformers. This is an intentional decision made to enable the composition of effect handlers with . without invoking flip.
Since: 1.0.0.0
Lazy state carrier
runState :: s -> StateC s m a -> m (s, a) Source #
Run a lazy State effect, yielding the result value and the final state. More programs terminate with lazy state than strict state, but injudicious use of lazy state may lead to thunk buildup.
runStates (purea) =pure(s, a)
runStatesget=pure(s, s)
runStates (putt) =pure(t, ())
Since: 1.0.0.0
newtype StateC s (m :: Type -> Type) a Source #
Since: 1.0.0.0
Constructors
| StateC (s -> m (s, a)) |
Instances
| MonadTrans (StateC s) Source # | |
Defined in Control.Carrier.State.Lazy | |
| (Alternative m, Monad m) => Alternative (StateC s m) Source # | |
| Monad m => Applicative (StateC s m) Source # | |
Defined in Control.Carrier.State.Lazy | |
| Functor m => Functor (StateC s m) Source # | |
| Monad m => Monad (StateC s m) Source # | |
| (Alternative m, Monad m) => MonadPlus (StateC s m) Source # | |
| MonadFail m => MonadFail (StateC s m) Source # | |
Defined in Control.Carrier.State.Lazy | |
| MonadFix m => MonadFix (StateC s m) Source # | |
Defined in Control.Carrier.State.Lazy | |
| MonadIO m => MonadIO (StateC s m) Source # | |
Defined in Control.Carrier.State.Lazy | |
| Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # | |
State effect
module Control.Effect.State