From fecbd7683a63421a132c181332799c3a57d2bd4d Mon Sep 17 00:00:00 2001 From: jkloos Date: Wed, 9 Mar 2016 11:28:55 +0100 Subject: [PATCH 1/2] Make CCPersistentHashtbl.S.merge more general. This patch brings the merge function of CCPersistentHashtbl in line with the merge functions of other maps (Map, BatMap from batteries). In particular, its signature changes from the restrictive merge: (key -> 'a option -> 'a option -> 'a option) -> 'a t -> 'a t -> 'a t to a more general merge: (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t --- src/data/CCPersistentHashtbl.ml | 6 +++--- src/data/CCPersistentHashtbl.mli | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/data/CCPersistentHashtbl.ml b/src/data/CCPersistentHashtbl.ml index 798b04f1..1fd06f67 100644 --- a/src/data/CCPersistentHashtbl.ml +++ b/src/data/CCPersistentHashtbl.ml @@ -89,8 +89,8 @@ module type S = sig (** Fresh copy of the table; the underlying structure is not shared anymore, so using both tables alternatively will be efficient *) - val merge : (key -> 'a option -> 'a option -> 'a option) -> - 'a t -> 'a t -> 'a t + val merge : (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> 'b t -> 'c t (** Merge two tables together into a new table. The function's argument correspond to values associated with the key (if present); if the function returns [None] the key will not appear in the result. *) @@ -576,7 +576,7 @@ module Make(H : HashedType) : S with type key = H.t = struct if mem t1 k then tbl else match f k None (Some v2) with | None -> tbl - | Some _ -> replace tbl k v2 + | Some v' -> replace tbl k v' ) tbl t2 (*$R diff --git a/src/data/CCPersistentHashtbl.mli b/src/data/CCPersistentHashtbl.mli index 908b9252..6fed4d96 100644 --- a/src/data/CCPersistentHashtbl.mli +++ b/src/data/CCPersistentHashtbl.mli @@ -96,8 +96,8 @@ module type S = sig (** Fresh copy of the table; the underlying structure is not shared anymore, so using both tables alternatively will be efficient *) - val merge : (key -> 'a option -> 'a option -> 'a option) -> - 'a t -> 'a t -> 'a t + val merge : (key -> 'a option -> 'b option -> 'c option) -> + 'a t -> 'b t -> 'c t (** Merge two tables together into a new table. The function's argument correspond to values associated with the key (if present); if the function returns [None] the key will not appear in the result. *) From 852d9c41866f8e74f1527cac7f724418143bcd75 Mon Sep 17 00:00:00 2001 From: jkloos Date: Thu, 10 Mar 2016 13:25:48 +0100 Subject: [PATCH 2/2] Added myself to the AUTHORS file. As per maintainer request. --- AUTHORS.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.adoc b/AUTHORS.adoc index b1ee4699..be70282a 100644 --- a/AUTHORS.adoc +++ b/AUTHORS.adoc @@ -13,3 +13,4 @@ - Guillaume Bury (guigui) - JP Rodi - octachron (Florian Angeletti) +- Johannes Kloos