Hello, suppose I have a type defined as
type value =
None
| Int of int
| Float of float
| Complex of Complex.t
| String of string
| Char of char
| Bool of bool
and I want to be able to work with Sets
of these values. From what I understood I have to use the functor to concretize the Set
module with a concrete type and its associated ordering.
How should I do it in this example? Since value
cannot be used directly inside the Set.Make
functor?
Then of course I need to be able to give a full ordering of these values so I should invent something like giving a predefined order to different types, and then ordering them by their effective value.. am I right?
So for example I can decide to have Int of int < Float of int
and Int x < Int y
if x < y
. Is it a practical approach to what I'm trying to achieve?