the min, max issues can be avoided without much trouble by using
specialized comparison, as provided in standard library extensions.
Note that min/max are already optimized from generic to specialized
when the type information is known at type-checking time. (It used to
be the case that only fully applied calls were optimized, this was
improved by Frédéric Bour to extend to non-applied primitives in 4.03
(eg. "let eq : int -> int -> _ = (=)"). That does not work when those
functions are used inside a functor body at an abstract type (which is
when we want inlining and specialization to interact better), but
there neither do Float.equal or Int.compare.