Merge pull request #60 from johanneskloos/master

Make `CCPersistentHashtbl.S.merge` more general.
This commit is contained in:
Simon Cruanes 2016-03-14 13:56:26 +01:00
commit 69e8f7abf8
3 changed files with 6 additions and 5 deletions

View file

@ -13,3 +13,4 @@
- Guillaume Bury (guigui)
- JP Rodi
- octachron (Florian Angeletti)
- Johannes Kloos

View file

@ -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

View file

@ -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. *)