A future value is a value that will become knowable only later. This
module gives a way to manipulate them functionally. For instance,
a+b becomes knowable when the later of
b becomes knowable.
Primitive futures can be things like /the value of the next key you press, or the value of LambdaPix stock at noon next Monday/.
memptyis a future that never becomes knowable.
ais whichever of
bis knowable first.
Functor: apply a function to a future. The result is knowable when the given future is knowable.
puregives value knowable since the beginning of time. '(<*>)' applies a future function to a future argument. Result available when both are available, i.e., it becomes knowable when the later of the two futures becomes knowable.
returnis the same as
joinresolves a future future into a future.
The current implementation is nondeterministic in
mappend for futures
that become knowable at the same time or nearly the same time. I
want to make a deterministic implementation.
See Data.SFuture for a simple denotational semantics of futures. The
current implementation does not quite implement this target semantics
mappend when futures are available simultaneously or nearly
simultaneously. I'm still noodling how to implement that semantics.
Value available in the future.
|Future (IO a)|
Future that may arrive. The
Future that never arrives.
Future and a way to fill it. The filler should be invoked