diff options
| author | Maxime Dénès | 2016-01-06 00:58:42 +0100 |
|---|---|---|
| committer | Maxime Dénès | 2016-01-06 00:58:42 +0100 |
| commit | 23cbf43f353c50fa72b72d694611c5c14367cea2 (patch) | |
| tree | a04f140b3f383a798b3aeca9b92f663ff0d98dba /lib | |
| parent | ffc135337b479349a9e94c0da0a87531cf0684fa (diff) | |
Protect code against changes in Map interface.
The Map interface of upcoming OCaml 4.03 includes a new union operator. In
order to make our homemade implementation of Maps compatible with OCaml
versions from 3.12 to 4.03, we define our own signatures for Maps.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/cMap.ml | 2 | ||||
| -rw-r--r-- | lib/cMap.mli | 2 | ||||
| -rw-r--r-- | lib/cSig.mli | 31 |
3 files changed, 33 insertions, 2 deletions
diff --git a/lib/cMap.ml b/lib/cMap.ml index cf590d96c3..048a690812 100644 --- a/lib/cMap.ml +++ b/lib/cMap.ml @@ -16,7 +16,7 @@ module type S = Map.S module type ExtS = sig - include Map.S + include CSig.MapS module Set : CSig.SetS with type elt = key val update : key -> 'a -> 'a t -> 'a t val modify : key -> (key -> 'a -> 'a) -> 'a t -> 'a t diff --git a/lib/cMap.mli b/lib/cMap.mli index 23d3801e08..9d0fbbad24 100644 --- a/lib/cMap.mli +++ b/lib/cMap.mli @@ -18,7 +18,7 @@ module type S = Map.S module type ExtS = sig - include Map.S + include CSig.MapS (** The underlying Map library *) module Set : CSig.SetS with type elt = key diff --git a/lib/cSig.mli b/lib/cSig.mli index 2a8bda2936..e095c82cb0 100644 --- a/lib/cSig.mli +++ b/lib/cSig.mli @@ -45,3 +45,34 @@ sig end (** Redeclaration of OCaml set signature, to preserve compatibility. See OCaml documentation for more information. *) + +module type MapS = +sig + type key + type (+'a) t + val empty: 'a t + val is_empty: 'a t -> bool + val mem: key -> 'a t -> bool + val add: key -> 'a -> 'a t -> 'a t + val singleton: key -> 'a -> 'a t + val remove: key -> 'a t -> 'a t + val merge: + (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t + val compare: ('a -> 'a -> int) -> 'a t -> 'a t -> int + val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val iter: (key -> 'a -> unit) -> 'a t -> unit + val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + val for_all: (key -> 'a -> bool) -> 'a t -> bool + val exists: (key -> 'a -> bool) -> 'a t -> bool + val filter: (key -> 'a -> bool) -> 'a t -> 'a t + val partition: (key -> 'a -> bool) -> 'a t -> 'a t * 'a t + val cardinal: 'a t -> int + val bindings: 'a t -> (key * 'a) list + val min_binding: 'a t -> (key * 'a) + val max_binding: 'a t -> (key * 'a) + val choose: 'a t -> (key * 'a) + val split: key -> 'a t -> 'a t * 'a option * 'a t + val find: key -> 'a t -> 'a + val map: ('a -> 'b) -> 'a t -> 'b t + val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t +end |
