automaton-1.6: Effectful streams and automata in coalgebraic encoding
Safe HaskellNone
LanguageHaskell2010

Data.Automaton.Trans.Changeset

Description

Handle a global ChangesetT layer in an Automaton.

A global accumulation state can be hidden by an automaton by making it an internal state.

Synopsis

Documentation

changesetS :: forall (m :: Type -> Type) s a w b. Functor m => Automaton m (s, a) (w, b) -> Automaton (ChangesetT s w m) a b Source #

Convert from explicit states to the ChangesetT monad transformer.

The original automaton is interpreted to take the current accumulated state as input and return the log to be appended as output.

This is the opposite of runChangesetS.

getChangesetS :: forall (m :: Type -> Type) s w a b. Functor m => Automaton (ChangesetT s w m) a b -> Automaton m (s, a) (w, b) Source #

Make the accumulation transition in ChangesetT explicit as Automaton inputs and outputs.

This is the opposite of changesetS.

runChangesetS Source #

Arguments

:: forall (m :: Type -> Type) w s a b. (Monad m, Monoid w, RightAction w s) 
=> s

Initial state

-> Automaton (ChangesetT s w m) a b

An automaton with a global accumulation state effect

-> Automaton m a (s, b) 

Convert global accumulation state to internal state of an Automaton.

The current state is output on every step.

runChangesetS_ :: forall w (m :: Type -> Type) s a b. (Monoid w, Monad m, RightAction w s) => s -> Automaton (ChangesetT s w m) a b -> Automaton m a b Source #

Like runChangesetS, but don't output the current state.