ocaml-ppx / ppx_import

Less redundancy in type declarations and signatures
MIT License
89 stars 28 forks source link

suggestion: import for entire typedecl groups #48

Open chetmurthy opened 4 years ago

chetmurthy commented 4 years ago

I'm writing a version of ppx_import for camlp5, and I noticed that there is only import for individual type-declarations. But just as we don't like to write down the RHS of a type-decl, we might not want to write down all the type-names, either. So it might be nice to have (e.g.)


[%%import: MLast.expr [@with
    loc := MLast.loc ;
    type_var := MLast.type_var
]] [@@deriving show]
``
which imports all types in the typedecl group that contains "expr" in the module MLast.  And then does the specified substitution.  I just implemented this, and it was .... not much work at all, so I thought I'd suggest it.