reactive-banana-0.7.1.1: Practical library for functional reactive programming (FRP).

Safe HaskellSafe-Inferred

Reactive.Banana.Model

Contents

Synopsis

Synopsis

Model implementation of the abstract syntax tree.

Description

This module contains the model implementation for the primitive combinators defined Reactive.Banana.Internal.AST which in turn are the basis for the official combinators documented in Reactive.Banana.Combinators.

Look at the source code to make maximal use of this module. (If there is no link to the source code at every type signature, then you have to run cabal with --hyperlink-source flag.)

This model is authoritative: when observed with the interpretModel function, both the actual implementation and its model must agree on the result. Note that this must also hold for recursive and partial definitions (at least in spirit, I'm not going to split hairs over _|_ vs \_ -> _|_).

Concerning time and space complexity, the model is not authoritative, however. Implementations are free to be much more efficient.

Combinators

Data types

type Event a = [Maybe a]Source

Basic

unionWith :: (a -> a -> a) -> Event a -> Event a -> Event aSource

mapE :: (a -> b) -> Event a -> Event bSource

accumE :: a -> Event (a -> a) -> Event aSource

applyE :: Behavior (a -> b) -> Event a -> Event bSource

applyB :: Behavior (a -> b) -> Behavior a -> Behavior bSource

mapB :: (a -> b) -> Behavior a -> Behavior bSource

Dynamic event switching

type Moment a = Time -> aSource

Interpretation

interpret :: (Event a -> Moment (Event b)) -> [Maybe a] -> [Maybe b]Source