| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | (** This module centralizes the notions of hooks. Hooks are pointers that are to |
| 12 | be set at runtime exactly once. *) |
| 13 | |
| 14 | type 'a t |
| 15 | (** The type of hooks containing ['a]. Hooks can only be set. *) |
| 16 | |
| 17 | type 'a value |
| 18 | (** The content part of a hook. *) |
| 19 | |
| 20 | val make : unit -> ('a value * 'a t) |
| 21 | (** Create a new hook together with a way to retrieve its runtime value. *) |
| 22 | |
| 23 | val get : 'a value -> 'a |
| 24 | (** Access the content of a hook. If it was not set yet, try to recover the |
| 25 | default value if there is one. |
| 26 | @raise Assert_failure if undefined. *) |
| 27 | |
| 28 | val set : 'a t -> 'a -> unit |
| 29 | (** Register a hook. Assertion failure if already registered. *) |