Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data State s m a where
- get :: forall s. forall r. Member (State s) r => Semantic r s
- gets :: Member (State s) r => (s -> a) -> Semantic r a
- put :: forall s. forall r. Member (State s) r => s -> Semantic r ()
- modify :: Member (State s) r => (s -> s) -> Semantic r ()
- runState :: Typeable s => s -> Semantic (State s ': r) a -> Semantic r (s, a)
- runLazyState :: Typeable s => s -> Semantic (State s ': r) a -> Semantic r (s, a)
Effect
data State s m a where Source #
An effect for providing statefulness. Note that unlike mtl's
StateT
, there is no restriction that the State
effect corresponds necessarily to local state. It could could just as well
be interrpeted in terms of HTTP requests or database access.
Interpreters which require statefulness can reinterpret
themselves in terms of State
, and subsequently call runState
.
Instances
type DefiningModule (State :: Type -> k -> Type -> Type) Source # | |
Defined in Polysemy.State |