PPX Deriving and polymorphic variants

Oh, hm. I had forgotten about module type of. And heck, about interrogating .cmi files. So … now that you’ve opened that can of worms, one could imagine something like

type t = [%import: (type of Fsm.T.linear)]

and maybe (going a little further)

type st = [%import 'st with type 'st Fsm.T.t = (type of Fsm.T.linear)]

(implying structural unification of the type-expressions). Of course the “type of” operator is not part of Ocaml, but in the context of %import, it could be grin.