-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking the API, it's more safe now :)
previously, union and merge could invalidate the invariant: foreach k \in m . m[k] = (key, value) /\ k = key which could lead to assertion fail in find. Now, their signature uses semi-explicit polymorphism with a record type: * S.equal : { f : 'a key -> 'a -> 'a -> bool } -> t -> t -> bool * S.merge : { f : 'a key -> 'a option -> 'a option -> 'a option } -> t -> t -> t * S.union : { f : 'a key -> 'a -> 'a -> 'a option } -> t -> t -> t * new function S.map : { f : 'a key -> 'a -> 'a } -> t -> t In addition, some interface duplication for "bindings" and "value" were removed, namely: S.findb, S.getb, S.addb, S.addb_unless_bound. Use the counterparts S.find, S.get, S.add, S.add_unless_bound instead. The pretty-printer S.pp was removed, and K.pp is no longer required! S.pp was let pp ppf m = M.iter (fun (M.B (k, v)) -> Fmt.pf ppf (K.pp k) v) m This removes the Fmt dependency. Added some initial tests
- Loading branch information
Showing
7 changed files
with
316 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
(library | ||
(name gmap) | ||
(public_name gmap) | ||
(modules gmap) | ||
(libraries fmt)) | ||
(modules gmap)) | ||
|
||
(test | ||
(name tests) | ||
(modules tests) | ||
(libraries alcotest fmt gmap)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.