@reasonableconsulting/compare
ReasonML helpers for generating cmp functions.
Last updated 2 years ago by phated .
MPL-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @reasonableconsulting/compare 
SYNC missed versions from official npm registry.

compare

ReasonML helpers for generating cmp functions.

Usage

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

Current Tags

  • 0.0.0                                ...           latest (2 years ago)

1 Versions

  • 0.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |