package ocamlmerlin-mlx

Build not checked
  1. Overview
  2. Docs
Merlin support for MLX OCaml dialect

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mlx-0.10.tbz
sha256=3762bbc75264b0d67972cc1b97eefe083aa0032500a45bab7f6e698ccf9b378c
sha512=bfefa488d68f84f3df9196e93b76eaf23452e04258cfaaaa0726bd1c9deed7a357145f19d19df6e84909ce40fe6a81b53e66f6dd7ec8931c57bde46b0e562dca

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

Syntax highlighting support for VS Code is still work in progress. As a temporary workaround, you can enable basic OCaml syntax highlighting by adding this to your settings:

{
  "files.associations": {
    "*.mlx": "ocaml"
  }
}
Neovim

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

  • 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.32.1"
  5. ocaml >= "4.14.0" & < "5.4"

Dev Dependencies (3)

  1. odoc with-doc
  2. menhir = "20201216" & with-dev-setup
  3. 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 8a77e58. 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.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.12 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