arrows-0.4.4.1: Arrow classes and transformers

Copyright | (c) Ross Paterson 2003
License | BSD-style (see the LICENSE file in the distribution)
Maintainer | ross@soi.city.ac.uk
Stability | experimental
Portability | non-portable (multi-parameter type classes)
Safe Haskell | Safe
Language | Haskell98

Control.Arrow.Transformer.Automaton

Description

Simple Mealy-style automata.

Synopsis

- newtype Automaton a b c = Automaton (a b (c, Automaton a b c))
- runAutomaton :: (ArrowLoop a, ArrowApply a) => Automaton a (e, b) c -> a (e, Stream b) (Stream c)

# Documentation

newtype Automaton a b c Source

An arrow type comprising Mealy-style automata, each step of which is is a computation in the original arrow type.

Constructors

Automaton (a b (c, Automaton a b c)) |

Instances

Arrow a => ArrowTransformer Automaton a Source |
Arrow a => Category * (Automaton a) Source |
ArrowError r a => ArrowError r (Automaton a) Source |
ArrowWriter w a => ArrowWriter w (Automaton a) Source |
ArrowState s a => ArrowState s (Automaton a) Source |
ArrowReader r a => ArrowReader r (Automaton a) Source |
ArrowAddWriter w a a' => ArrowAddWriter w (Automaton a) (Automaton a') Source |
ArrowAddReader r a a' => ArrowAddReader r (Automaton a) (Automaton a') Source |
ArrowAddState r a a' => ArrowAddState r (Automaton a) (Automaton a') Source |
Arrow a => Arrow (Automaton a) Source |
ArrowZero a => ArrowZero (Automaton a) Source |
ArrowPlus a => ArrowPlus (Automaton a) Source |
ArrowChoice a => ArrowChoice (Automaton a) Source |
ArrowLoop a => ArrowLoop (Automaton a) Source |
ArrowLoop a => ArrowCircuit (Automaton a) Source |
(ArrowLoop a, ArrowApply a) => ArrowAddStream (Automaton a) a Source |
Arrow a => Functor (Automaton a b) Source |
Arrow a => Applicative (Automaton a b) Source |
ArrowPlus a => Alternative (Automaton a b) Source |
ArrowPlus a => Monoid (Automaton a b c) Source |

runAutomaton :: (ArrowLoop a, ArrowApply a) => Automaton a (e, b) c -> a (e, Stream b) (Stream c) Source

Encapsulating an automaton by running it on a stream of inputs, obtaining a stream of outputs.

Typical usage in arrow notation:

    	proc p -> do
    		...
    		ys <- (|runAutomaton (\x -> ...)|) xs

Here `xs` refers to the input stream and `x` to individual elements of that stream. `ys` is bound to the output stream.