Rattus-0.1.1.0: A modal FRP language

Safe HaskellNone
LanguageHaskell2010

Rattus.Event

Description

Programming with single shot events, i.e. events that may occur at most once.

Synopsis

Documentation

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

Apply a function to the value of the event (if it ever occurs).

never :: Event a Source #

An event that will never occur.

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

switch s e will behave like s until the event e occurs with value s', in which case it will behave as s'.

switchTrans :: (Str a -> Str b) -> Event (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 until the event e occurs with value s', in which case it will behave as s'.

whenJust :: Str (Maybe' a) -> Str (Event a) Source #

Turn a stream of Maybe's into a stream of events. Each such event behaves as if created by firstJust.

data Event a Source #

An event may either occur now or later.

Constructors

Now !a 
Wait (O (Event a)) 

await :: (Stable a, Stable b) => Event a -> Event b -> Event (a :* b) Source #

Synchronise two events. The resulting event occurs after both events have occurred (coinciding with whichever event occurred last.

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

Trigger an event as soon as 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 -> Event b Source #

Trigger an event as soon as the given function produces a Just' value.