package MlFront_Thunk
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=561d9b7dfc392fcd7413737ac1f6071a
sha512=ec9b2fe9ac45b8429dda4f155f56f73410d1eb12b879e8f826756f2fc3d8fa00d439a75fbd48be9f6dca6cbf3ca691e2b367cd55d227d9a81f77e95cff6d9346
doc/MlFront_Thunk.ThunkIoDisk/MlFront_Thunk_IoDisk/ThunkIoDisk/Make/argument-1-M/index.html
Parameter Make.M
The type resolved_promise_state is the set of states a Resolved promise can be in. The set will be either type 'a in t or a reversed monadic transformation of type 'a which you need to unwrap. In other words, the resolution has no knowledge of the transformations of the monad (nor should it!).
include MlFront_Thunk.BuildConstraints.MONAD with type 'a t := 'a t
include MlFront_Thunk.BuildConstraints.FUNCTOR with type 'a t := 'a t
make_promise () is a new promise and resolver. The promise is pending.
val return : 'a -> 'a treturn x is a new promise that is already resolved with value x.
val promise_state :
'a t ->
resolved_promise_state MlFront_Thunk.BuildConstraints.universal_promise_statepromise_state p is the state of the promise
val resolve : 'a resolver -> 'a -> unitresolve r x resolves the promise p associated with r with value x, meaning that state p will become Resolved x. Requires: p is pending.
val reject : 'a resolver -> exn -> unitreject r x rejects the promise p associated with r with exception x, meaning that state p will become Rejected x. Requires: p is pending.
parallel ps is a promise that resolves when all the promises in ps resolve, or rejects when any promise in ps rejects. The order of the resolved values is the same as the order of the promises in ps.
val yield : unit -> MlFront_Thunk.BuildConstraints.yield_timing tyield () is a promise that resolves after the current batch of promises resolve, or after external I/O is detected, or in a short iota.
The returned advised_throttle_sec value is how many seconds the caller should sleep before yielding again. If the promise implementation has a scheduler that wakes up the yield when external I/O is detected, the return value should be 0.0; no sleep is required. But for the minimal promise implementation or a CPU-only scheduler, the return value will be a small positive number so that the caller does not have high CPU busy-waiting for external I/O.
The returned elapsed_sec value is an estimate of how many seconds have elapsed during the yield.