Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a patch for an upcoming release of ppxlib where the internal AST is bumped from 4.14 to 5.2. Until that is merged and released, there is no reason to merge this PR.
To test these changes, you can use the following opam-based workflow. I've made releases of most of these patches to an opam-repository overlay.
The following describes the most notable changes to the AST.
Note: no update has been made of the
opam
file, butppxlib
will likely need a lower-bound before merging/releasing.Functions
Currently
In the parsetree currently, functions like:
Are represented roughly as
Functions like:
Are represented roughly as
Since 5.2
All of these functions now map to a single AST node
Pexp_function
(note, this is the same name as the old cases function). The first argument is a list of parameters meaning:Now looks like:
Pexp_function([x; y; z], _constraint, body)
And the
body
is where we can either have more expressions (Pfunction_body _
) or cases (Pfunction_cases _
). That means:Has an empty list of parameters:
Local Module Opens for Types
Another feature added in 5.2 was the ability to locally open modules in type definitions.
This has a
Ptyp_open (module_identifier, core_type)
AST node. Just like normal module opens this does create some syntactic ambiguity about where things come from inside the parentheses.