Hi,
Say I have a type
t = A | B of t list
Where I want to implement an equal
function with the order of t
in B
not matter. Since the real type has a lot of constructors, I would like to use ppx_deriving.eq
. Overriding the default equality on a specific constructor is easy, fortunately:
t = | A | B of t list [@equal fun a b -> ...] [@@deriving eq]
The issue here is that to implement it correctly I would need to call the generated equal
function recursively on each t
in B
. But how do I get a reference to the function that will be called equal : t -> t -> bool
once ppx_deriving is done?
In other words, I am looking for the let rec
name of the function my @equal
will be part of.