Debian Codegraph @

lib/cAst.ml

raw symbols SCIP
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 t = {
12 v : 'a;
13 loc : Loc.t option;
14 }
15
16 let make ?loc v = { v; loc }
17
18 let map f n = { n with v = f n.v }
19 let map_with_loc f n = { n with v = f ?loc:n.loc n.v }
20 let map_from_loc f l =
21 let loc, v = l in
22 { v = f ?loc v ; loc }
23
24 let with_val f n = f n.v
25 let with_loc_val f n = f ?loc:n.loc n.v
26
27 let eq f x y = f x.v y.v
28
29 module Smart = struct
30 let map f n =
31 let v' = f n.v in
32 if v' == n.v then n
33 else {n with v=v'}
34 end