Safe Haskell  SafeInferred 

Language  Haskell2010 
Synopsis
 newtype Circuit m a b = Circuit {
 runCircuit :: a > m (b, Circuit m a b)
 accumulateFunction :: Monad m => acc > (a > acc > m (b, acc)) > Circuit m a b
 accumulateCircuit :: Monad m => acc > Circuit m (a, acc) (b, acc) > Circuit m a b
 streamCircuit :: Monad m => Circuit m a b > [a] > m [b]
 iterateCircuit :: Monad m => Circuit m a b > [a] > m b
 loopCircuit :: Monad m => acc > Circuit m (a, acc) (b, acc) > Circuit m a (b, acc)
 loopAccumulator :: Monad m => acc > Circuit m (a, acc) acc > Circuit m a acc
 arrM :: Monad m => (a > m b) > Circuit m a b
 type Chain m x = Circuit m () x
 chain :: Monad m => x > (x > m x) > Chain m x
 chainCircuit :: Monad m => x > Circuit m x x > Chain m x
 streamChain :: Monad m => Int > Chain m x > m [x]
 iterateChain :: Monad m => Int > Chain m x > m x
 skipChain :: Monad m => Int > Chain m x > Chain m x
 skipChain0 :: Monad m => Int > Chain m x > Chain m x
 iterateM :: Monad m => Int > (x > m x) > x > m [x]
 iterateM' :: Monad m => Int > (x > m x) > x > m x
Circuits
newtype Circuit m a b Source #
An arrow which takes an input, monadically produces an output, and updates an (inaccessable) internal state.
Circuit  

accumulateFunction :: Monad m => acc > (a > acc > m (b, acc)) > Circuit m a b Source #
Takes a function from a value and an accumulator (e.g. just a sum value or an evolving set of parameters for some model) to a value and an accumulator. The accumulator is then looped back into the function, returning a Circuit from a to b, which updates the accumulator every step.
accumulateCircuit :: Monad m => acc > Circuit m (a, acc) (b, acc) > Circuit m a b Source #
accumulateCircuit takes a Circuit
and an inital value and loops it.
streamCircuit :: Monad m => Circuit m a b > [a] > m [b] Source #
Feeds a list of inputs into a Circuit
and returns the (monadic) list of outputs.
iterateCircuit :: Monad m => Circuit m a b > [a] > m b Source #
Feeds a list of inputs into a Circuit automata and returns the final monadic output. Throws an error on the empty list.
loopCircuit :: Monad m => acc > Circuit m (a, acc) (b, acc) > Circuit m a (b, acc) Source #
Takes a Circuit and an inital value and loops it, but continues to return both the output and the accumulated value.
loopAccumulator :: Monad m => acc > Circuit m (a, acc) acc > Circuit m a acc Source #
Takes a Circuit which only produces an accumulating value, and loops it.
Chains
Creates a Chain
from an initial state and a transition function. The
first step of the chain returns the initial state, and then continues with
generated states.
:: Monad m  
=> x  The initial state 
> Circuit m x x  The transition circuit 
> Chain m x  The resulting 
Creates a Chain
from an initial state and a transition circuit. The
first step of the chain returns the initial state, and then continues with
generated states.
streamChain :: Monad m => Int > Chain m x > m [x] Source #
Returns the specified number of the given Chain
s output.
iterateChain :: Monad m => Int > Chain m x > m x Source #
Returns the given Chain
s output at the given index.
skipChain :: Monad m => Int > Chain m x > Chain m x Source #
Modify the given Chain
so that it returns the initial value, and then
skips the specified number of outputs before producing each subsequent output.
skipChain0 :: Monad m => Int > Chain m x > Chain m x Source #
Modify the given Chain
so that it skips the specified number of outputs
before producing each subsequent output (this skips the initial output too).