Derivers and ocaml's typedtree

I took a look (and tried it with my own implementation of ppx_import) and ha! it uses GADTs! I guess, maybe, I have to start learning how GADTs work.

If you have any more details on what you tried, I’d be happy to learn those details, so that I can try to reproduce what you found … after I get GADTs working more generally.

Also, by some chance did you try using ppx_import to copy over the types? When I implemented my version of that, I quickly found that ppx_import is wildly insufficient for large families of types: what you need is a way to import an entire set of typedecls, so instead of:

type t1 = [%import: M.t1]
and type t2 = [%import: M.t2]
...

you want something like

[%%import: M.t1]

with the semantics that it imports the entire group of typedecls (the struct/sig-item) where t1 is declared.