state package:automaton
Construct a state monad computation from a state transformer function.
The internal state of the stream
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.
Convert from explicit states to the
StateT monad transformer.
The original automaton is interpreted to take a state as input and
return the updated state as output.
This is the opposite of
runStateS.
Embed a
StreamT. Take care only to use this constructor on
streams with nontrivial state.
A stateless stream is simply an action in a monad which is performed
repetitively.
Make the state transition in
StateT explicit as
Automaton inputs and outputs.
This is the opposite of
stateS.
Convert global state to internal state of an
Automaton.
The current state is output on every step.
Like
runStateS_, but don't output the current state.
A state transformer with
Result instead of a standard tuple as
its result.
Apply a function to the state of a
Result.