Example:
type t = < foo : int >
[@@deriving eq]
Expected behavior: An equality function for t is generated, i.e. something like:
let equal : t -> t -> bool = fun a b -> Int.equal a#foo b#foo
Actual behavior: The ppx gives the following error:
eq cannot be derived for < foo : int >
I use anonymous objects like these to simulate similar behavior with anonymous records in standard variants, i.e.
type variant =
| Foo of {
bar : int
}
type poly = [ `Foo of < bar : int > ]
Is there a reason I can't think of that deriving equality functions for objects is non-trivial compared to records?