Skip to content

Commit

Permalink
Merge pull request #60 from johanneskloos/master
Browse files Browse the repository at this point in the history
Make `CCPersistentHashtbl.S.merge` more general.
  • Loading branch information
c-cube committed Mar 14, 2016
2 parents c7766d1 + 852d9c4 commit 69e8f7a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions AUTHORS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
- Guillaume Bury (guigui)
- JP Rodi
- octachron (Florian Angeletti)
- Johannes Kloos
6 changes: 3 additions & 3 deletions src/data/CCPersistentHashtbl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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. *)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/data/CCPersistentHashtbl.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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. *)
Expand Down

0 comments on commit 69e8f7a

Please sign in to comment.