Safe Haskell | None |
---|---|
Language | Haskell2010 |
A carrier for the State
effect. It uses an IORef
internally to handle its state, and thus admits a MonadUnliftIO
instance. Because the state operations are performed impurely, this carrier will not lose state effects even with nefarious uses of liftWith
.
Unlike the other carriers for State
, this carrier's effects will not backtrack when run in conjuction with NonDet
effects.
Since: 1.1.2.0
Synopsis
- runState :: MonadIO m => s -> StateC s m a -> m (s, a)
- runStateRef :: MonadIO m => IORef s -> StateC s m a -> m (s, a)
- evalState :: forall s m a. MonadIO m => s -> StateC s m a -> m a
- execState :: forall s m a. MonadIO m => s -> StateC s m a -> m s
- newtype StateC s (m :: Type -> Type) a = StateC {}
- module Control.Effect.State
Impure state carrier
newtype StateC s (m :: Type -> Type) a Source #
Since: 1.1.2.0
Instances
MonadTrans (StateC s) Source # | |
Defined in Control.Carrier.State.IORef | |
MonadIO m => MonadIO (StateC s m) Source # | |
Defined in Control.Carrier.State.IORef | |
Alternative m => Alternative (StateC s m) Source # | |
Applicative m => Applicative (StateC s m) Source # | |
Defined in Control.Carrier.State.IORef | |
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.IORef | |
MonadFix m => MonadFix (StateC s m) Source # | |
Defined in Control.Carrier.State.IORef | |
MonadUnliftIO m => MonadUnliftIO (StateC s m) Source # | |
Defined in Control.Carrier.State.IORef | |
(MonadIO m, Algebra sig m) => Algebra (State s :+: sig) (StateC s m) Source # | |
State effect
module Control.Effect.State