package core_kernel

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

Module Force_onceSource

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

Sourcetype 'a t
Sourceval create : (unit -> 'a) -> 'a t

create f creates a new force_once.

Sourceval force : 'a t -> 'a

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

Sourceval ignore : unit -> unit t

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

Sourceval sexp_of_t : ('a -> Core.Sexp.t) -> 'a t -> Core.Sexp.t