| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Rattus.Event
Description
Programming with many-shot events, i.e. events that may occur zero or more times.
Synopsis
- map :: Box (a -> b) -> Event a -> Event b
- never :: Event a
- switch :: Str a -> Event (Str a) -> Str a
- switchTrans :: (Str a -> Str b) -> Event (Str a -> Str b) -> Str a -> Str b
- dswitchTrans :: (Str a -> Str b) -> O (Event (Str a -> Str b)) -> Str a -> Str b
- combine :: Box (a -> a -> a) -> Str a -> Event (Str a) -> Str a
- type Event a = Str (Maybe' a)
- trigger :: Box (a -> Bool) -> Str a -> Event a
- triggerMap :: Box (a -> Maybe' b) -> Str a -> Event b
Documentation
map :: Box (a -> b) -> Event a -> Event b Source #
Apply a function to the values of the event (every time it occurs).
switch :: Str a -> Event (Str a) -> Str a Source #
switch s e will behave like s but switches to s'$ every time
the event s'@.e occurs with some value
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 but
switches to s'$ every time the event s'@.e occurs with some value
dswitchTrans :: (Str a -> Str b) -> O (Event (Str a -> Str b)) -> Str a -> Str b Source #
Like switchTrans but takes a delayed event as input, which
allows the switch to incorporate feedback from itself.
combine :: Box (a -> a -> a) -> Str a -> Event (Str a) -> Str a Source #
combine f s e is similar to switch s e, but instead of
switching to new streams s' every time the event e occurs with
some value s', the new stream s' is combined with the current
stream s using zipWith f s' s.