Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Programming with futures, i.e. data that will arrive at some time in the future
Synopsis
- map :: Box (a -> b) -> Future a -> Future b
- never :: Future a
- switch :: Str a -> Future (Str a) -> Str a
- switchTrans :: (Str a -> Str b) -> Future (Str a -> Str b) -> Str a -> Str b
- whenJust :: Str (Maybe' a) -> Str (Future a)
- data Future a
- await :: (Stable a, Stable b) => Future a -> Future b -> Future (a :* b)
- trigger :: Box (a -> Bool) -> Str a -> Future a
- triggerMap :: Box (a -> Maybe' b) -> Str a -> Future b
Documentation
map :: Box (a -> b) -> Future a -> Future b Source #
Apply a function to the value of the future (if it ever occurs).
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
.
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.