Module Core_kernel.Force_once

A "force_once" is a thunk that can only be forced once. Subsequent forces will raise an exception.

type 'a t
val create : (Core_kernel__.Import.unit ‑> 'a) ‑> 'a t

create f creates a new force_once.

val force : 'a t ‑> 'a

force t runs the thunk if it hadn't already been forced, else it raises an exception.

val ignore : Core_kernel__.Import.unit ‑> Core_kernel__.Import.unit t

ignore () = create (fun () -> ())

val sexp_of_t : ('a ‑> Sexp.t) ‑> 'a t ‑> Sexp.t