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 optionvalue 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.