automaton-1.4: Effectful streams and automata in initial encoding
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Automaton.Trans.Accum

Description

Handle a global AccumT layer in an Automaton.

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

Synopsis

Documentation

accumS :: (Functor m, Monad m) => Automaton m (w, a) (w, b) -> Automaton (AccumT w m) a b Source #

Convert from explicit states to the AccumT 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 runAccumS.

runAccumS :: (Functor m, Monad m) => Automaton (AccumT w m) a b -> Automaton m (w, a) (w, b) Source #

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

This is the opposite of accumS.

runAccumS_ Source #

Arguments

:: (Functor m, Monoid w, Monad m) 
=> Automaton (AccumT w m) a b

An automaton with a global accumulation state effect

-> Automaton m a (w, b) 

Convert global accumulation state to internal state of an Automaton.

The current state is output on every step.

runAccumS__ :: (Functor m, Monoid w, Monad m) => Automaton (AccumT w m) a b -> Automaton m a b Source #

Like runAccumS_, but don't output the current accum.