Module Core.Portable_lazySource
val from_val :
('a : value_or_null). 'a @ portable contended ->
'a Core.Portable_lazy.t @@ portablefrom_val v returns an already-forced suspension of v.
val from_fun :
('a : value_or_null). (unit -> 'a @ portable contended) @ once portable ->
'a Core.Portable_lazy.t @@ portablefrom_fun f returns a suspension of the function f. Note that f must be portable, as it may be run by any domain.
val from_fun_fixed :
('a : value_or_null). ('a Core.Portable_lazy.t ->
'a @ portable contended) @ once portable ->
'a Core.Portable_lazy.t @@ portablefrom_fun_fixed f returns a suspension of the {ifix-point} function f, which takes the lazy value itself as an argument. This can be used in places where one might normally use let rec to make a lazy_t that refers to itself.
val force :
('a : value_or_null). 'a Core.Portable_lazy.t @ once ->
'a @ portable contended @@ portableforce t forces the suspension t and returns its result. If t has already been forced, force t returns the same value again without recomputing it. If multiple threads force the same lazy simultaneously, only one will execute the computation, and the rest will block until the computation has finished executing.
If the suspension raises an exception, that exception will be converted to a string (to guarantee that it's safe to share between threads) and force will raise an exception. The raised exception is intentionally opaque and cannot be matched on in order to preserve forward compatibility; if you want the suspension to possibly return an exception, use Result.t or another similar type.
Note that unlike the lazy in the standard library, Portable_lazy does not raise an error if a lazy calls force from within its own suspension - instead, this will cause a deadlock.
val map :
('a : value_or_null) ('b : value_or_null). 'a Core.Portable_lazy.t ->
f:('a @ portable contended -> 'b @ portable contended) @ once portable ->
'b Core.Portable_lazy.t @@ portablemap t ~f returns a new suspension that, when forced, will first force t, then call f on the result. Note that f must be portable, as it may be run by any thread.
val bind :
('a : value_or_null) ('b : value_or_null). 'a Core.Portable_lazy.t ->
f:('a @ portable contended -> 'b Core.Portable_lazy.t) @ once portable ->
'b Core.Portable_lazy.t @@ portablebind t ~f returns a new suspension that when forced will first force t, then call f on the result, then force the suspension returned by f. Note that f must be portable, as it may be run by any thread.
val compare :
'a. ('a -> 'a -> int) ->
'a Core.Portable_lazy.t ->
'a Core.Portable_lazy.t ->
intcompare compare_a t1 t2 forces both suspensions t1 and t2, and then returns the result of compare_a called on the two results.
val equal :
'a. ('a -> 'a -> bool) ->
'a Core.Portable_lazy.t ->
'a Core.Portable_lazy.t ->
boolequal equal_a t1 t2 forces both suspensions t1 and t2, and then returns the result of equal_a called on the two results.
val sexp_of_t :
'a. ('a -> Sexplib0.Sexp.t) ->
'a Core.Portable_lazy.t ->
Sexplib0.Sexp.t @@ portableval t_of_sexp :
'a. (Sexplib0.Sexp.t -> 'a) ->
Sexplib0.Sexp.t ->
'a Core.Portable_lazy.t @@ portablet_of_sexp a_of_sexp sexp eagerly evaluates a_of_sexp sexp.
val t_sexp_grammar :
('a : value_or_null). 'a Sexplib0.Sexp_grammar.t ->
'a Core.Portable_lazy.t Sexplib0.Sexp_grammar.t @@ portableval hash_fold_t :
'a. (Ppx_hash_lib.Std.Hash.state -> 'a -> Ppx_hash_lib.Std.Hash.state) ->
Ppx_hash_lib.Std.Hash.state ->
'a Core.Portable_lazy.t ->
Ppx_hash_lib.Std.Hash.state @@ portableval globalize :
('a : value_or_null) ('b : value_or_null). 'b ->
'a Core.Portable_lazy.t @ once ->
'a Core.Portable_lazy.t @@ portableglobalize _ t is a noop since all 'a t values are created on the heap.
val is_val : ('a : value_or_null). 'a Core.Portable_lazy.t -> bool @@ portableis_val x returns true if x has already been forced and did not raise an exception. Returns false if x has not been forced, or is currently being forced.
val peek :
'a. 'a Core.Portable_lazy.t ->
'a Basement.Or_null_shim.t @ portable contended @@ portablepeek x returns Null if x has never been forced, raised an exception, or is currently being forced by any thread, or This v if x was forced to value v.
val peek_opt :
('a : value_or_null). 'a Core.Portable_lazy.t ->
'a option @ portable contended @@ portablepeek x returns None if x has never been forced, raised an exception, or is currently being forced by any thread, or Some v if x was forced to value v.
include sig ... end
val bin_write_t :
'a. 'a Bin_prot.Write.writer ->
'a Core.Portable_lazy.t Bin_prot.Write.writerval bin_writer_t :
'a. 'a Bin_prot.Type_class.writer ->
'a Core.Portable_lazy.t Bin_prot.Type_class.writerval __bin_read_t__ :
'a. 'a Bin_prot.Read.reader ->
'a Core.Portable_lazy.t Bin_prot.Read.vtag_readerval bin_reader_t :
'a. 'a Bin_prot.Type_class.reader ->
'a Core.Portable_lazy.t Bin_prot.Type_class.readerval quickcheck_generator :
'a. 'a Ppx_quickcheck_runtime.Base_quickcheck.Generator.t ->
'a Core.Portable_lazy.t Ppx_quickcheck_runtime.Base_quickcheck.Generator.tval quickcheck_observer :
'a. 'a Ppx_quickcheck_runtime.Base_quickcheck.Observer.t ->
'a Core.Portable_lazy.t Ppx_quickcheck_runtime.Base_quickcheck.Observer.tval quickcheck_shrinker :
'a. 'a Ppx_quickcheck_runtime.Base_quickcheck.Shrinker.t ->
'a Core.Portable_lazy.t Ppx_quickcheck_runtime.Base_quickcheck.Shrinker.t