package b0

  1. Overview
  2. Docs

Future values.

Future value setters

type 'a set

The type for setting a future value of type 'a.

val set : 'a set -> 'a -> unit

set s v sets the future value linked to s to the value v.

Future values

type memo = t

See Memo.t

type 'a t

The type for future values of type 'a.

val create : memo -> 'a t * 'a set

create memo is (f, s) a future value f and a setter s for it. Fibers waiting on the future are scheduled by stiring memo.

val value : 'a t -> 'a option

value f is f's value if set.

val wait : 'a t -> 'a fiber

wait f k waits for f to be set and continues with k v with v the value of the future.