package b0
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=dba2fc571f39f3b8e87ee55c77bdec7ec6a5ddc7d99b8b20aeda848af546be04
md5=51ee1d66acc4d7f87bdceac1341b7711
doc/b0.b00/B00/Memo/Fut/index.html
Module Memo.Fut
Future values.
A future is an undetermined value that becomes determined at an an arbitrary point in the future. The future acts as a placeholder for the value while it is undetermined.
Future values
The type for undetermined future information. Forget about this, it cannot be acted upon.
type 'a state =
| Det of 'a
(*The future is determined with the given value.
*)| Undet of 'a undet
(*The future is undetermined.
*)| Never
(*The future will never determine.
*)
The type for future state. When the state is Det _
or Never
we say the future is set.
create m
is (f, set)
with f
the future value and set
the function to set
it. The latter can be called only once, Invalid_argument
is raised otherwise. If called with None
the future value becomes Never
.
val value : 'a t -> 'a option
value f
is f
's value, if any.
await f k
waits for f
to be determined and continues with k v
with v
the value of the future. If the future never determines k
is not invoked. Use await_set
to witness never determining futures.
await_set f k
waits for f
to be set and continues with k None
if state f
is Never
and k (Some v)
if state f
is Det v
.