I'm interested in using ppx_import for a group of recursive types at once and applying the same substitutions to all of them. Essentially, I would need a form of import for this where you provide a list of types and the same with clause applies to all of them. From looking at the code I guess this is currently unsupported and would be quite hacky to implement for the existing %import extension ... mostly because the current one is expected in place of a single type definition.
Instead of having to write
type foo = [%import: M.foo [@with very-long-with-clause ]]
and moo = [%import: M.moo [@with very-long-with-clause ]]
and bar = [%import: M.bar [@with very-long-with-clause ]]
in a structure, equivalent to the above.
Using a comma separated-list is a bit of a hack because the payload would then parse as an expression rather than a type, but at least it looks nice.
If people think that this is a good idea I would volunteer to try implementing it. I'm open to suggestions about the syntax if there's something nicer!
Hi,
I'm interested in using
ppx_import
for a group of recursive types at once and applying the same substitutions to all of them. Essentially, I would need a form ofimport
for this where you provide a list of types and the samewith
clause applies to all of them. From looking at the code I guess this is currently unsupported and would be quite hacky to implement for the existing%import
extension ... mostly because the current one is expected in place of a single type definition.Instead of having to write
it would be nice to have a form
in a structure, equivalent to the above. Using a comma separated-list is a bit of a hack because the payload would then parse as an expression rather than a type, but at least it looks nice.
If people think that this is a good idea I would volunteer to try implementing it. I'm open to suggestions about the syntax if there's something nicer!