Rattus-0.2: A modal FRP language
Safe HaskellNone
LanguageHaskell2010

Rattus.Events

Description

Programming with many-shot events, i.e. events that may occur zero or more times.

Synopsis

Documentation

map :: Box (a -> b) -> Events a -> Events b Source #

Apply a function to the values of the event (every time it occurs).

never :: Events a Source #

An event that will never occur.

switch :: Str a -> Events (Str a) -> Str a Source #

switch s e will behave like s but switches to s'$ every time the event e occurs with some value s'@.

switchTrans :: (Str a -> Str b) -> Events (Str a -> Str b) -> Str a -> Str b Source #

Like switch but works on stream functions instead of streams. That is, switchTrans s e will behave like s but switches to s'$ every time the event e occurs with some value s'@.

type Events a = Str (Maybe' a) Source #

Events are simply streams of Maybe's.

trigger :: Box (a -> Bool) -> Str a -> Events a Source #

Trigger an event as every time the given predicate turns true on the given stream. The value of the event is the same as that of the stream at that time.

triggerMap :: Box (a -> Maybe' b) -> Str a -> Events b Source #

Trigger an event every time the given function produces a Just' value.