Safe Haskell | None |
---|
Contains all data structures and functions for composing, calculating and creating automatons.
- data Automaton a b = Step (a -> (Automaton a b, b))
- pure :: (a -> b) -> Automaton a b
- stateful :: b -> (a -> b -> b) -> Automaton a b
- combine :: [Automaton a b] -> Automaton a [b]
- step :: a -> Automaton a b -> (Automaton a b, b)
- run :: Automaton a b -> b -> SignalGen (Signal a) -> SignalGen (Signal b)
- counter :: Automaton a Int
Types
A data structure describing an automaton. An automaton is essentially a high-level way to package piped behavior between an input signal and an output signal. Automatons can also be composed, allowing you to connect one automaton to another and pipe data between them. Automatons are an easy and powerful way to create composable dynamic behavior, like animation systems.
Composing
pure :: (a -> b) -> Automaton a bSource
Creates a pure automaton that has no accumulated state. It applies input to a function at each step.
stateful :: b -> (a -> b -> b) -> Automaton a bSource
Creates an automaton that has an initial and accumulated state. It applies input and the last state to a function at each step.
combine :: [Automaton a b] -> Automaton a [b]Source
Combines a list of automatons that take some input and turns it into an automaton that takes the same input and outputs a list of all outputs from each separate automaton.
Computing
step :: a -> Automaton a b -> (Automaton a b, b)Source
Steps an automaton forward, returning the next automaton to step and output of the step in a tuple.