Rattus-0.4: A modal FRP language
Safe HaskellNone
LanguageHaskell2010

Rattus.Future

Description

Programming with futures, i.e. data that will arrive at some time in the future

Synopsis

Documentation

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

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

never :: Future a Source #

A future that will never happen.

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

switch s e will behave like s until the future e is available with value s', in which case it will behave as s'.

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

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

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

data Future a Source #

A future may either be available now or later.

Constructors

Now !a 
Wait !(O (Future a)) 

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

Synchronise two futures. The resulting future occurs after both futures have occurred (coinciding with whichever future occurred last.

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

Trigger a future as soon as the given predicate turns true on the given stream. The value of the future is the same as that of the stream at that time.

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

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