The main use case is to make it easier to describe user interfaces with OCaml, which can range from generating HTML (example with Dream) to describing interactive UIs with ReasonReact (example).
Now files with .mlx extension will be treated as OCaml modules.
The merlin/ocamllsp users will get roughly the same level of support for .mlx syntax as they get for .ml but some additional text editor/IDE configuration is needed to associate .mlx files with merlin/ocamllsp.
For neovim users thereâs a plugin ocaml-mlx/ocaml_mlx.nvim, which does that bit of a configuration and provides highlighting for .mlx files based on a tree-sitter parser.
Looks great, thatâs exactly what I was looking for. Iâd love to use OCaml with Melange to write react apps but really donât want to resort to Reason for this. Hopefully not too off topic: Any idea if the reason-react-ppx is going to work with the original OCaml-syntax so I can build the whole app in OCaml?
Unfortunately thereâs no good answer to that, the alternatives weâve considered for JSX children syntax were:
Implement it as it is now â as a list of simple expressions
Use {..} brackets like youâve suggested
Use ; delimiter for a list of expressions
The 3. was ruled out as being to noisy. The 2. is also a good proposal but choice was made in favour of 1. partly because of simplicity.
I agree, it can seen confusing at first but the rule is simple â if thatâa a non simple expressions (like application), then you wrap it with (..), as in normal .ml syntax.