Support OCaml 5.2+ functor parameter syntax
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 148
- Forks
- 7
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 6
Description
Versions
mlx: 0.11- OCaml: 5.5.0
ocamlformat-mlx: 0.28.1.2
Problem
mlx-pp rejects the newer functor type syntax accepted by OCaml 5.2+ and emitted by ocamlformat-mlx when formatting for current OCaml versions.
Reproduction
mlx-pp -print-ml <<'MLX'
module type T = sig
type t
end
module Fresh : (X : T) -> sig
type t
end =
functor (X : T) -> struct
type t = X.t
end
MLX
Actual result:
File "*stdin*", line 5, characters 18-19:
Error: Syntax error: ')' expected
File "*stdin*", line 5, characters 15-16:
This '(' might be unmatched
The same declaration is accepted by the OCaml 5.5 toplevel.
Context
This appeared while converting a Reason functor to MLX. ocamlformat-mlx produced the syntax above, but the Dune MLX preprocessor could not parse the formatted file.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided reproduction through the mlx-pp preprocessor and tracing its parser handling of module and functor type declarations. Inspect the parser entry points involved in the reported syntax error; done means the OCaml 5.2+ declaration is accepted and the Dune MLX preprocessing path has a regression test for it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100