Skip to content

Use `ppx_woo` with `ppx_import 1.9.0`

E. Rivas requested to merge er433/ppx/woo2 into dev

This MR introduces the usage of ppx_woo in combinators for the different ASTs we have.

ppx_woo is a deriving ppx by GA (used in GAML) which generate get/is/constructors/etc. for types we write.

Generally, we adapt it to our types as follows:

type expression_content = [%import: Types.expression_content]
[@@deriving ez {
      prefixes = [
        ("make_e" , fun ?(location = Location.generated) expression_content type_expression ->
                  ({ expression_content ; location ; type_expression } : expression)) ;
        ("get" , fun x -> x.expression_content) ;
        ("get_type" , fun x -> x.type_expression) ;
      ] ;
      wrap_constructor = ("expression_content" , make_e) ;
      wrap_get = ("expression_content" , get) ;
    } ]

This will provide us of things such as get_e_application_opt, get_e_application_exn, is_e_application, e_application, etc. to manipulate terms of type expression.

After applying this, a "major" combinator change is done:

(get_)t_function is removed. Instead, we use the derived (get_)t_arrow.

  • has a changelog entry
Edited by E. Rivas

Merge request reports