I am wondering why < operator supports int, string, bool, or float, whereas + only support int.
Could OCaml recognize the underlying arithmetic to use ? What mak
There is not, at the moment, a notion of "a bit polymorphic" in OCaml (the technical name is "ad-hoc polymorphism"). You can't say "I accept integers and floats but not the rest".
You can say, however "I accept everything", just like the comparison operator (the technical name is "parametric polymorphism"). Do note however than they are lying a bit about that: you can't compare functions, even if the type system can't catch it.
See this answer for details.