Note that compare works differently than a normal function. It’s polymorphic, so it can accept any type. However, if you use it with a string, int, or float then the compiler will use a specialized version of it for each of those types. (In fact, String.compare is just that.)
If the compiler isn’t able to use a specialized function for a type (e.g., for a record or abstract type) then it will fall back on the polymorphic version, which is considered unsafe. ReScript can also be configured to warn you if you use it this way.
If the compiler isn’t able to use a specialized function for a type (e.g., for a record or abstract type) then it will fall back on the polymorphic version, which is considered unsafe. ReScript can also be configured to warn you if you use it this way.
Yes, turn the warning as error in your config and use compare is safe. We specialised more than just string/int