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

Safe HaskellSafe-Infered





Model implementation of the abstract syntax tree.


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.


Data types

type Event a = [Maybe a]Source


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


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