Hi @vch9,
Two possible approaches occur to me:
-
Write your transformer at the
structurelevel ofAst_traverse.map(lists of structure items), and do aconcat_mapover the children in which items with the[@@ppx]attribute expand to multiple new structure items (otherwisefun x -> [ x ]). -
Transform the
[@@ppx]attribute to the single structure iteminclude struct ... end, which can then contain multiple structure items inside of it.
I believe I’ve seen both of those be used in other PPXes with success.
Hope this helps!