Up

Module Force_once = Core_kernel.Force_once

Signature

type 'a t

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

val create : (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 : unit -> unit t

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

val sexp_of_t : ('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t