Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Handle a global StateT
layer in an Automaton
.
A global state can be hidden by an automaton by making it an internal state.
This module is based on the strict state monad Strict
,
so when combining it with other modules such as mtl
's,
the strict version has to be included, i.e. Strict
instead of State
or Lazy
.
Synopsis
- module Control.Monad.Trans.State.Strict
- stateS :: (Functor m, Monad m) => Automaton m (s, a) (s, b) -> Automaton (StateT s m) a b
- runStateS :: (Functor m, Monad m) => Automaton (StateT s m) a b -> Automaton m (s, a) (s, b)
- runStateS_ :: (Functor m, Monad m) => Automaton (StateT s m) a b -> s -> Automaton m a (s, b)
- runStateS__ :: (Functor m, Monad m) => Automaton (StateT s m) a b -> s -> Automaton m a b
Documentation
runStateS :: (Functor m, Monad m) => Automaton (StateT s m) a b -> Automaton m (s, a) (s, b) Source #
:: (Functor m, Monad m) | |
=> Automaton (StateT s m) a b | An automaton with a global state effect |
-> s | The initial global state |
-> Automaton m a (s, b) |
Convert global state to internal state of an Automaton
.
The current state is output on every step.
runStateS__ :: (Functor m, Monad m) => Automaton (StateT s m) a b -> s -> Automaton m a b Source #
Like runStateS_
, but don't output the current state.