Debian Codegraph @

clib/polyMap.mli

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 module type ValueS =
12 sig
13 type 'a t
14 end
15
16 (** Polymorphic maps over an extensible GADT tag type. *)
17
18 module type Tag = sig type _ tag = .. end
19
20 module Make (Tag:Tag) : sig
21 open Tag
22
23 module type OneTag = sig
24 type a
25 type _ tag += T : a tag
26 end
27 type 'a onetag = (module OneTag with type a = 'a)
28 (** There is no equality function between [_ tag] values (other than
29 [Stdlib.(=)]), and especially no equality function which shows
30 that when the values are equal the type arguments are also
31 equal.
32
33 Instead we can use ['a onetag] to recognize ['b tag] values. *)
34
35 val eq_onetag : 'a onetag -> 'b tag -> ('a,'b) CSig.eq option
36
37 val make : unit -> 'a onetag
38
39 val tag_of_onetag : 'a onetag -> 'a tag
40
41 module type MapS = sig
42 type t
43 type _ value
44
45 val empty : t
46
47 val find : 'a tag -> t -> 'a value
48
49 val add : 'a onetag -> 'a value -> t -> t
50
51 val mem : 'a tag -> t -> bool
52
53 val update : 'a onetag -> ('a value option -> 'a value option) -> t -> t
54
55 val modify : 'a tag -> ('a value -> 'a value) -> t -> t
56
57 type 'acc fold = { fold : 'a. 'a onetag -> 'a value -> 'acc -> 'acc }
58
59 val fold : 'acc fold -> t -> 'acc -> 'acc
60
61 end
62 module Map(V:ValueS) : MapS with type 'a value := 'a V.t
63
64 end