package ocamlmerlin-mlx

All checked builds pass
  1. Overview
  2. Docs
Merlin support for MLX OCaml dialect

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mlx-0.12.tbz
sha256=b14b2b0b3414b574fe7e444517e94d8579a1240b707ce3b11f580a95026dacc5
sha512=7414b6955e4487e640ab9a2bf47ff75df5e8fd60c9f0d9968f4aa53c89a2afbd91eb72db6281baaa5707e372a3503b61f72fa7a92c20e1d4c7725d82b9b9c1cb

Description

Added to opam-repository:

README

mlx

An OCaml syntax dialect which adds JSX expressions to the language.

let header ~title () =
  <header>
    <h1>title</h1>
  </header>

let page =
  <html>
    <body>
      <header title="Hello, world!" />
      <div>
        "Some content goes here"
      </div>
    </body>
  </html>

This code is transformed into the following OCaml code:

let header ~title () =
  header () ~children:[ h1 () ~children:[ title ] [@JSX]; ] [@JSX]

let page =
  html () ~children:[
    body () ~children:[
      header () ~title:"Hello, world!" [@JSX];
      div () ~children:[ "Some content goes here" ] [@JSX];
    ] [@JSX];
  ] [@JSX]

It is expected to use mlx-pp preprocessor with either a runtime lib which provides the implementation of such functions or a ppx which which further transforms [@JSX] attributes into the desired output.

Installation & Usage

Use the following commands to install the necessary packages:

opam install mlx ocamlmerlin-mlx

To make dune consider .mlx files as OCaml files you need to configure an mlx dialect, put this in your dune-project file:

(dialect
 (name mlx)
 (implementation
  (extension mlx)
  (merlin_reader mlx)
  (preprocess
   (run mlx-pp %{input-file}))))

Editor Support

VS Code

For VSCode and its forks (Cursor, Windsurf, etc.), install the Official OCaml Platform extension (version 2.0.0 or higher). It supports mlx syntax highlighting and all LSP features on par with .ml files.

Neovim

For Neovim users, install plugin: https://github.com/ocaml-mlx/ocaml_mlx.nvim

Emacs

For Emacs users, install mlx-mode: https://github.com/ocaml-mlx/emacs-mlx

  • Example with Dream web framework: https://github.com/aantron/dream/pull/330
  • Template ReasonReact project: https://github.com/andreypopp/melange-mlx-template
  • mlx announcement on OCaml Discourse: https://discuss.ocaml.org/t/ann-mlx-syntax-dialect/15035

Dependencies (5)

  1. cppo
  2. merlin-lib
  3. dune >= "3.16"
  4. ppxlib >= "0.38.0"
  5. ocaml >= "4.14.0"

Dev Dependencies (5)

  1. odoc with-doc
  2. ocaml-lsp-server with-dev-setup
  3. ocamlformat with-dev-setup
  4. menhir = "20230608" & with-dev-setup
  5. csexp with-dev-setup

Optional Dependencies

None

Conflicts

None

Build status

Results of building ocamlmerlin-mlx with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.12 (this version) n/a good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure