Why isn't an order type used for comparisons in OCaml?

Viewed 121

I have yet to find a suitable answer for an OCaml design decision, and hope one of those here with in-depth knowledge of OCaml's implementation can shed some light.

In SML, if we evaluate Int.compare(6, 9) we get LESS which is a constructor for the order type (the others being GREATER and EQUAL). In OCaml, if we evaluate compare 6 9 we get -1.

Was there a specific reason to favor having comparison functions return zero, a negative number, or a positive number in OCaml's standard library, rather than an algebraic data type as in SML?

0 Answers
Related