This example, converted to ReasonML from https://github.com/BuckleScript/bucklescript/blob/master/jscomp/others/belt_Map.mli, does not appear to work when I put it into a .re file
module PairComparator =
Belt.Id.MakeComparable(
{
type t = (int, int);
let cmp = ((a0, a1), (b0, b1)) =>
switch (Pervasives.compare(a0, b0)) {
| 0 => Pervasives.compare(a1, b1)
| c => c
};
}
);
let myMap = Belt.Map.make(~id=(module PairComparator));
Giving this error:
We've found a bug for you!
/home/david/reasonlab/testor/src/demo.re 131:13-54
129 │ );
130 │
131 │ let myMap = Belt.Map.make(~id=(module PairComparator));
132 │
This expression's type contains type variables that can't be generalized:
Belt.Map.t(PairComparator.t, '_a, PairComparator.identity)
Any clues as to what I am doing wrong, or what has changed since that example was written?