-
Notifications
You must be signed in to change notification settings - Fork 343
Open
Labels
Description
If you search the web how to use Sets in OCaml you'll end up on the Set tutorial, which very clearly explain how to make a Set module for String-s like this:
module SS = Set.Make(String);;
Chances are the next thing the next thing you'll try is
module SI = Set.Make(int);;
Which won't work because int is not an OrderedType. It'd be nice to show how to make a set module for arbitrary non-ordered types.
For example, by defining the corresponding OrderedType:
module Int = struct
type t = int
let compare = Pervasives.compare
end;;