I use ppx_deriving
both for deriving printers (show
) and visitors (https://gitlab.inria.fr/fpottier/visitors). Both derivers recognize the [@opaque]
annotation to ignore some branches of the type.
I would like to declare some branches opaque for visitors without making them opaque for show (these branches have abstract types for which a printer is provided, but no visitors).
Currently, I use a [@printer]
annotation that I put before the [@opaque]
annotation to specify the printer explicitly, but I would hope for a solution that does not require to repeat the names of the types.
type t = A of (data [@printer pp_data] [@opaque])
[@@deriving show, visitors { variety = "iter" }]
Thank you, OCaml community!