You can refer to the blog post Ashish mentioned.
However I usually prefer more "automatic" way to generate Maps and Sets for custom structures when using Core (thanks to Core syntax extensions).
Here is a small example:
module T = struct
type t = Row of int
with sexp, compare
end
include T
include Comparable.Make(T)
So this will generate all comparison functions (and other useful functions) and basic data structures that you usually need:
type t = T.t = Row of int
...
val (>) : T.t -> T.t -> bool = <fun> (* compare functions *)
val (<) : T.t -> T.t -> bool = <fun>
val equal : T.t -> T.t -> bool = <fun>
val compare : T.t -> T.t -> int = <fun>
val min : T.t -> T.t -> T.t = <fun>
val max : T.t -> T.t -> T.t = <fun>
...
module Map : (* non-polymorphic Map module *)
...
end
module Set : (* non-polymorphic Set module *)
...
end
and a lot more. So basically you can use a non-polymorphic map afterwards:
type column_t = Column of int
let map = Map.singleton (Row 1) (Column 2)