'Equality operator to compare non int types

I recently updated from OCaml 4.03 to OCaml 4.13 for my project. One change is that I am getting a type error when checking for equality between non-int types. For example, for floats I get this:

Error: This expression has type float but an expression was expected of type int

I can solve this by explicitly using Float.(f0 = f1). But I get the same problem with custom types. E.g.:

utop # type e = X | Y
utop # let a = X;;
val a : e = X
utop # let b = Y;;
utop # X = Y;;
Error: This expression has type e but an expression was expected of type int

What is the correct way of handling this scenario? Stdlib.(a = b) works but feels cumbersome since a polymorphic equality operator is so commonly used.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source