module Control.Effect.State
( State(..)
, get
, put
, modify
) where
import Control.Effect.Base
import Control.Effect.Internal (State(..))
get :: State s :< effs => Eff effs s
get :: Eff effs s
get = State s (Eff effs) s -> Eff effs s
forall (eff :: Effect) a (effs :: [Effect]).
(eff :< effs) =>
eff (Eff effs) a -> Eff effs a
send State s (Eff effs) s
forall s (m :: * -> *). State s m s
Get
put :: State s :< effs => s -> Eff effs ()
put :: s -> Eff effs ()
put = State s (Eff effs) () -> Eff effs ()
forall (eff :: Effect) a (effs :: [Effect]).
(eff :< effs) =>
eff (Eff effs) a -> Eff effs a
send (State s (Eff effs) () -> Eff effs ())
-> (s -> State s (Eff effs) ()) -> s -> Eff effs ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. s -> State s (Eff effs) ()
forall s (m :: * -> *). s -> State s m ()
Put
modify :: State s :< effs => (s -> s) -> Eff effs ()
modify :: (s -> s) -> Eff effs ()
modify s -> s
f = Eff effs s
forall s (effs :: [Effect]). (State s :< effs) => Eff effs s
get Eff effs s -> (s -> Eff effs ()) -> Eff effs ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= s -> Eff effs ()
forall s (effs :: [Effect]). (State s :< effs) => s -> Eff effs ()
put (s -> Eff effs ()) -> (s -> s) -> s -> Eff effs ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. s -> s
f