Producing and using typed ASTs for all source files in a project

You should be able to derive a visitor for Typedtree.structure for collecting Texp_apply nodes (either produced by visitors or ppxlib_traverse). The library override that I announced today aims at allowing you to derive types that are defined in other modules. Deriving a collector for Texp_apply is still quite laborious since there are some name clashes to solve and I don’t know a way to make some types opaque with ppxlib_traverse. Still, here is a solution: the module Typedtree_collect_texp_apply provides two functions by using ppxlib_traverse:

val collect_texp_apply_from_structure
  : Typedtree.structure -> texp_apply list

val collect_texp_apply_from_binary_annots
  : Cmt_format.binary_annots -> texp_apply list
2 Likes