aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2014-11-18 11:02:17 +0100
committerGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2014-11-19 18:52:13 +0100
commitd846451c9a07b4e051173878a5446edea029bf5b (patch)
tree0e8920a1174b268b6268d5615ffa5941bae3daa7
parent36c2559cefb54dc503fea375d15d3224992f6221 (diff)
Making map_union a standard function of the ML library.
-rw-r--r--lib/util.ml4
-rw-r--r--lib/util.mli2
-rw-r--r--pretyping/miscops.ml4
3 files changed, 6 insertions, 4 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 16b5f4615..531e4fe7d 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -124,3 +124,7 @@ let delayed_force f = f ()
type ('a, 'b) union = ('a, 'b) CSig.union = Inl of 'a | Inr of 'b
type 'a until = 'a CSig.until = Stop of 'a | Cont of 'a
+
+let map_union f g = function
+ | Inl a -> Inl (f a)
+ | Inr b -> Inr (g b)
diff --git a/lib/util.mli b/lib/util.mli
index fd766a30f..86720fe47 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -100,6 +100,8 @@ val delayed_force : 'a delayed -> 'a
type ('a, 'b) union = ('a, 'b) CSig.union = Inl of 'a | Inr of 'b
(** Union type *)
+val map_union : ('a -> 'c) -> ('b -> 'd) -> ('a, 'b) union -> ('c, 'd) union
+
type 'a until = 'a CSig.until = Stop of 'a | Cont of 'a
(** Used for browsable-until structures. *)
diff --git a/pretyping/miscops.ml b/pretyping/miscops.ml
index 3e5f7577b..882ebafe1 100644
--- a/pretyping/miscops.ml
+++ b/pretyping/miscops.ml
@@ -46,10 +46,6 @@ let map_flags f flags =
let map_occs f (occ,e) = (occ,f e)
-let map_union f g = function
- | Inl a -> Inl (f a)
- | Inr b -> Inr (g b)
-
let map_red_expr_gen f g h = function
| Fold l -> Fold (List.map f l)
| Pattern occs_l -> Pattern (List.map (map_occs f) occs_l)