Skip to content

Add user interface to construct and destruct encoded effect patterns#624

Merged
NathanReb merged 2 commits intoocaml-ppx:mainfrom
NathanReb:503-effect-decode
Feb 10, 2026
Merged

Add user interface to construct and destruct encoded effect patterns#624
NathanReb merged 2 commits intoocaml-ppx:mainfrom
NathanReb:503-effect-decode

Conversation

@NathanReb
Copy link
Copy Markdown
Collaborator

This adds an API to build and destruct effect patterns even though they are encoded during the migration.

Signed-off-by: Nathan Rebours <nathan.rebours@ocamlpro.com>
Copy link
Copy Markdown
Collaborator

@patricoferris patricoferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Nathan, looks great :)

Comment thread src/ast_builder_intf.ml Outdated
Comment thread astlib/encoding_503.ml Outdated
@NathanReb
Copy link
Copy Markdown
Collaborator Author

I addressed both your comments and this looks much better.

It also allowed me to detect and fix a bug in the 5.4 <-> 5.3 migrations!

Copy link
Copy Markdown
Collaborator

@patricoferris patricoferris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @NathanReb. Good catch on the extra encoding/decoding going in on the migrations.

Signed-off-by: Nathan Rebours <nathan.rebours@ocamlpro.com>
@NathanReb NathanReb merged commit 8d9dcca into ocaml-ppx:main Feb 10, 2026
6 of 8 checks passed
NathanReb pushed a commit to NathanReb/opam-repository that referenced this pull request Mar 20, 2026
CHANGES:

- Add support for OCaml 5.5 (ocaml-ppx/ppxlib#622, @patricoferris, @NathanReb)

- Add support for OCaml 5.4 bivariant type parameters, they can now be used
  alongside ppx-es. (ocaml-ppx/ppxlib#629, @NathanReb)

- Add `Attribute.Floating.declare_with_attr_loc` and `.declare_with_name_loc`,
  by analogy to the same functions at top level of `Attribute`. (ocaml-ppx/ppxlib#631, @ceastlund)

- Migrate `Ptyp_open` nodes using an extension point (ocaml-ppx/ppxlib#625, @patricoferris)

- Add Ast_builder and Ast_pattern utilities to manipulate encoded
  effect patterns (ocaml-ppx/ppxlib#624, @NathanReb)

- Fix a bug where ppat_effects would be encoded/decoded instead of copied by
  the 5.4 <-> 5.3 migrations (ocaml-ppx/ppxlib#624, @NathanReb)

- Fix infinite loop when duplicate attributes are present, raising
  an error instead (ocaml-ppx/ppxlib#613, @ceastlund, @patricoferris)
- Ignore extensions inside attributes for the unused extension check
  (ocaml-ppx/ppxlib#616, @Skepfyr)
- Fix a bug that inserted `Location.none` into `Longident`s when using OCaml
  5.4 and above (ocaml-ppx/ppxlib#619, @patricoferris)

- Add support for OCaml 5.4 labeled tuples, they can now be used alongside
  ppx-es. Also adds Ast_builder and Ast_pattern utilities to manipulate them.
  (ocaml-ppx/ppxlib#607, @NathanReb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants