Ppxlib: expand a structure item with others structure item

Hi @vch9,

Two possible approaches occur to me:

  • Write your transformer at the structure level of Ast_traverse.map (lists of structure items), and do a concat_map over the children in which items with the [@@ppx] attribute expand to multiple new structure items (otherwise fun x -> [ x ]).

  • Transform the [@@ppx] attribute to the single structure item include 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!