aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/hMap.ml19
-rw-r--r--lib/hMap.mli3
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/hMap.ml b/lib/hMap.ml
index cf5d0dfbcd..73cfbd0c71 100644
--- a/lib/hMap.ml
+++ b/lib/hMap.ml
@@ -258,6 +258,10 @@ struct
let max_binding _ = assert false (** Cannot be implemented efficiently *)
+ let fold_left _ _ _ = assert false (** Cannot be implemented efficiently *)
+
+ let fold_right _ _ _ = assert false (** Cannot be implemented efficiently *)
+
let choose s =
let (_, m) = Int.Map.choose s in
Map.choose m
@@ -295,4 +299,19 @@ struct
let m = Map.update k x m in
Int.Map.update h m s
+ let smartmap f s =
+ let fs m = Map.smartmap f m in
+ Int.Map.smartmap fs s
+
+ let smartmapi f s =
+ let fs m = Map.smartmapi f m in
+ Int.Map.smartmap fs s
+
+ module Unsafe =
+ struct
+ let map f s =
+ let fs m = Map.Unsafe.map f m in
+ Int.Map.map fs s
+ end
+
end
diff --git a/lib/hMap.mli b/lib/hMap.mli
index 4519ba316a..45b722fda0 100644
--- a/lib/hMap.mli
+++ b/lib/hMap.mli
@@ -10,7 +10,10 @@ module type HashedType =
sig
type t
val compare : t -> t -> int
+ (** Total ordering *)
val hash : t -> int
+ (** Hashing function compatible with [compare], i.e. [compare x y = 0] implies
+ [hash x = hash y]. *)
end
(** Hash maps are maps that take advantage of having a hash on keys. This is