I'm very new to Reason. I have a tuple containing two strings and want to make a Map
where the keys are of that tuple type.
How should I go about doing it?
Map.Make
is a functor, which means it expects a module as its argument, not a type. The module argument must conform to the OrderedType
signature:
module type OrderedType = {
type t
let compare : (t, t) => int
}
In your case that would be something like:
module TuplesMap = Map.Make({
type t = (string, string)
let compare = (a, b) => ...
});
Then all you need to do is to implement the compare
function.