When did Core remove polymorphic comparison operators in recent OCaml?

The change was announced in [ANN] v0.13 release of Jane Street packages, although unfortunately it doesn’t look like the CHANGES.md file was updated in the repo. I would consider the thread to be the canonical announcement.

Here’s a few suggestions:

  1. Define equality/compare functions using ppx_compare
type ternary = True | False | Unkn [@@deriving equal]

let f x = if (equal_ternary x True) then ...
  1. Define equality/compare functions manually
let equal_ternary t1 t2 =
  match t1, t2 with
  | True, True | False, False | Unkn, Unkn -> true
  | _ -> false
  1. Explicitly request polymorphic comparison operators using the Poly module:
let f x = if (Poly.(=) x True) then ...
3 Likes