| 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 | type 'a content = |
| 12 | | Unset |
| 13 | | Set of 'a |
| 14 | |
| 15 | type 'a t = 'a content ref |
| 16 | |
| 17 | type 'a value = 'a t |
| 18 | |
| 19 | let get (hook : 'a value) = match !hook with |
| 20 | | Unset -> assert false |
| 21 | | Set data -> data |
| 22 | |
| 23 | let set (hook : 'a t) data = match !hook with |
| 24 | | Unset -> hook := Set data |
| 25 | | Set _ -> assert false |
| 26 | |
| 27 | let make () = |
| 28 | let ans = ref Unset in |
| 29 | (ans, ans) |