I have a ppx which generates some code based on the type structure, to the end user, I want to mark it as a private type, however, I want to still ask the type checker to check the type definition is okay. Here is the rewrite I tried in the first round:
type t = A | B [@@deriving ..]
after my ppx:
include (module type of struct type t = A | B end : sig end) .. my generated code below
So far so good, however,
module type of is a bit limited, it does not play well with recursive modules (https://github.com/ocaml/ocaml/issues/9574), is there a better trick to achieve this?