package core_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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

type 'a t
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 -> Core_kernel.Sexp.t) -> 'a t -> Core_kernel.Sexp.t
OCaml

Innovation. Community. Security.