Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reasonableconsulting/compare
ReasonML helpers for generating cmp functions.
https://github.com/reasonableconsulting/compare
comparator compare ocaml reason reasonml sort sorting
Last synced: 29 days ago
JSON representation
ReasonML helpers for generating cmp functions.
- Host: GitHub
- URL: https://github.com/reasonableconsulting/compare
- Owner: reasonableconsulting
- License: mpl-2.0
- Created: 2018-07-30T21:16:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-30T21:37:18.000Z (over 6 years ago)
- Last Synced: 2024-09-10T19:14:52.819Z (2 months ago)
- Topics: comparator, compare, ocaml, reason, reasonml, sort, sorting
- Language: OCaml
- Size: 8.79 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - compare
README
# compare
ReasonML helpers for generating cmp functions.
## Usage
```reason
module Comparator =
Belt.Id.MakeComparable({
type t = string;let cmp =
Compare.concat([
Compare.by(key => key),
Compare.by(key => String.length(key)),
]);
});type t = Belt.Map.t(Comparator.t, int, Comparator.identity);
let ourMap = Belt.Map.fromArray(~id=(module Comparator), [|
("a", 1), ("b", 2), ("ab", 3)
|]);Belt.Map.forEach(ourMap, Js.log2);
```## License
MPL-2.0