Safe Haskell | None |
---|

- data Event t a
- type Behavior t = Behavior t
- collect :: Event t a -> Event t [a]
- fromCalm :: Event t a -> Event t a
- interpret :: (forall t. Event t a -> Event t b) -> [a] -> IO [Maybe b]
- module Control.Applicative
- never :: Event t a
- unionWith :: (a -> a -> a) -> Event t a -> Event t a -> Event t a
- filterE :: (a -> Bool) -> Event t a -> Event t a
- accumE :: a -> Event t (a -> a) -> Event t a
- apply :: Behavior t (a -> b) -> Event t a -> Event t b
- stepper :: a -> Event t a -> Behavior t a
- filterJust :: Event t (Maybe a) -> Event t a
- accumB :: a -> Event t (a -> a) -> Behavior t a
- mapAccum :: acc -> Event t (acc -> (x, acc)) -> (Event t x, Behavior t acc)
- class (Functor f, Functor g) => Apply f g where

# Synopsis

Experimental module: API change very likely.

`Event`

type that disallows simultaneous event occurrences.

The combinators behave essentially as their counterparts in Reactive.Banana.Combinators.

# Main types

collect :: Event t a -> Event t [a]Source

Convert event with possible simultaneous occurrences
into an `Event`

with a single occurrence.

fromCalm :: Event t a -> Event t aSource

Convert event with single occurrences into event with possible simultaneous occurrences

interpret :: (forall t. Event t a -> Event t b) -> [a] -> IO [Maybe b]Source

Interpretation function. Useful for testing.

# Core Combinators

module Control.Applicative

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

Merge two event streams of the same type. Combine simultaneous values if necessary.

filterE :: (a -> Bool) -> Event t a -> Event t aSource

Allow all events that fulfill the predicate, discard the rest.

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

The `accumE`

function accumulates a stream of events.

apply :: Behavior t (a -> b) -> Event t a -> Event t bSource

Apply a time-varying function to a stream of events.

stepper :: a -> Event t a -> Behavior t aSource

Construct a time-varying function from an initial value and a stream of new values.

# Derived Combinators

## Filtering

## Accumulation

Note: all accumulation functions are strict in the accumulated value!
acc -> (x,acc) is the order used by `unfoldr`

and `State`

.

accumB :: a -> Event t (a -> a) -> Behavior t aSource

The `accumB`

function is similar to a *strict* left fold, `foldl'`

.
It starts with an initial value and combines it with incoming events.