helm-0.3.0: A functionally reactive game engine.

Safe HaskellNone

FRP.Helm.Automaton

Contents

Description

Contains all data structures and functions for composing, calculating and creating automatons.

Synopsis

Types

data Automaton a b Source

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.

Constructors

Step (a -> (Automaton a b, b)) 

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.

(>>>) :: Automaton a b -> Automaton b c -> Automaton a cSource

Pipes two automatons together. It essentially returns an automaton that takes the input of the first automaton and outputs the output of the second automaton, with the directly connected values being discarded.

(<<<) :: Automaton b c -> Automaton a b -> Automaton a cSource

Pipes two automatons in the opposite order of >>>.

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.

run :: Automaton a b -> b -> SignalGen (Signal a) -> SignalGen (Signal b)Source

Runs an automaton with an initial output value and input signal generator and creates an output signal generator that contains a signal that can be sampled for the output value.

counter :: Automaton a IntSource

A useful automaton that outputs the amount of times it has been stepped, discarding its input value.