summaryrefslogtreecommitdiff
path: root/clib
diff options
context:
space:
mode:
authorMaxime Dénès <maxime.denes@inria.fr>2022-05-22 13:06:41 (GMT)
committerMaxime Dénès <maxime.denes@inria.fr>2022-05-23 08:47:48 (GMT)
commit5371c13863558585a05ea739e3418dc002fe7d90 (patch)
tree6c371bada89ad080f65ba0e62ac0c9a4ba3b47bd /clib
parent1aa46c630e748e51af7c202fe2266a1d3cf45886 (diff)
downloadcoq-5371c13863558585a05ea739e3418dc002fe7d90.zip
coq-5371c13863558585a05ea739e3418dc002fe7d90.tar.gz
coq-5371c13863558585a05ea739e3418dc002fe7d90.tar.bz2
Add a staging notion to summariesrefs/pull/16056/head
We distinguish two stages and separate the system state accordingly. `Synterp` is the syntactic interpretation phase, i.e. vernacular parsing and execution of commands having an effect on parsing. `Interp` is the interpretation phase, where standard commands are executed.
Diffstat (limited to 'clib')
-rw-r--r--clib/dyn.ml14
-rw-r--r--clib/dyn.mli6
2 files changed, 20 insertions, 0 deletions
diff --git a/clib/dyn.ml b/clib/dyn.ml
index 8ef90a3..0e3d639 100644
--- a/clib/dyn.ml
+++ b/clib/dyn.ml
@@ -30,6 +30,9 @@ sig
type any = Any : 'a key * 'a value -> any
val iter : (any -> unit) -> t -> unit
val fold : (any -> 'r -> 'r) -> t -> 'r -> 'r
+
+ type filter = { filter : 'a. 'a key -> 'a value -> bool }
+ val filter : filter -> t -> t
end
module type PreS =
@@ -54,6 +57,9 @@ sig
sig
type map = { map : 'a. 'a tag -> 'a V1.t -> 'a V2.t }
val map : map -> Map(V1).t -> Map(V2).t
+
+ type filter = { filter : 'a. 'a tag -> 'a V1.t -> bool }
+ val filter : filter -> Map(V1).t -> Map(V1).t
end
end
@@ -138,6 +144,9 @@ module Self : PreS = struct
type any = Any : 'a tag * 'a value -> any
let iter f m = Int.Map.iter (fun k v -> f (Any (k, v))) m
let fold f m accu = Int.Map.fold (fun k v accu -> f (Any (k, v)) accu) m accu
+
+ type filter = { filter : 'a. 'a tag -> 'a value -> bool }
+ let filter f m = Int.Map.filter f.filter m
end
module HMap (V1 : ValueS) (V2 : ValueS) =
@@ -147,6 +156,11 @@ module Self : PreS = struct
let map (f : map) (m : Map(V1).t) : Map(V2).t =
Int.Map.mapi f.map m
+ type filter = { filter : 'a. 'a tag -> 'a V1.t -> bool }
+
+ let filter (f : filter) (m : Map(V1).t) : Map(V1).t =
+ Int.Map.filter f.filter m
+
end
end
diff --git a/clib/dyn.mli b/clib/dyn.mli
index 4fd33b5..23059be 100644
--- a/clib/dyn.mli
+++ b/clib/dyn.mli
@@ -32,6 +32,9 @@ sig
type any = Any : 'a key * 'a value -> any
val iter : (any -> unit) -> t -> unit
val fold : (any -> 'r -> 'r) -> t -> 'r -> 'r
+
+ type filter = { filter : 'a. 'a key -> 'a value -> bool }
+ val filter : filter -> t -> t
end
module type S =
@@ -79,6 +82,9 @@ sig
sig
type map = { map : 'a. 'a tag -> 'a V1.t -> 'a V2.t }
val map : map -> Map(V1).t -> Map(V2).t
+
+ type filter = { filter : 'a. 'a tag -> 'a V1.t -> bool }
+ val filter : filter -> Map(V1).t -> Map(V1).t
end
module Easy : sig