Published: 16 Sep 2023
Melange is released to OPAM. Install it with:
$ opam install melange
Melange has good support for Nix:
github:melange-re/melangecan be added as a flake input
the melange flake provides a
melange.overlays.defaultoverlay that adds melange to
melcbinary can be run with
nix run github:melange-re/melange, e.g.
nix run github:melange-re/melange/1.0.0 -- --help
Get Esy on NPM:
npm install -g esyinstalls Esy globally
npx esycan be used to run Esy locally
An Esy project starter also exists.
After cloning the template, run
esy in the project root.
OCaml version compatibility
Melange >= v1.0 can build projects on OCaml >= 4.13 (including OCaml 5.x). Editor integration only works on OCaml 4.14, because Melange emits
.cmt artifacts targeting the OCaml 4.14 binary format.
How does this project relate to other tools?
This project is forked from the ReScript compiler, focused on a deeper integration with the OCaml ecosystem. This allows sharing code between backend and frontend using Dune's virtual libraries.
Melange also introduces a ReScript compatibility layer to maintain compatibility with ReScript syntax - preserving access to ReScript's package ecosystem. It's only recommended to use it with Melange v1, as both ReScript and Melange have diverged significantly since then.
A small write-up with more details on the motivation behind this project can be found in the announcement blog post.
Below is a quick comparison between Melange and other tools:
|Esy||Package manager||Installed with NPM||Obtaining dependencies such as
|OPAM||Package manager||None||Obtaining dependencies such as
|Dune||Build tool||Installed with e.g.
||Composable build tool for OCaml; supports composing custom rules to build any project|
|Reason||Syntax||Installed with e.g.
||Alternative syntax to OCaml|
|Melange||Compiler that emits Script||Esy / OPAM (to install), Dune (to build)||Supports OCaml, Reason and ReScript syntax; derived from ReScript, focused on deeper integration with OCaml|
Thanks to the OCaml team, obviously, without such a beautiful yet practical language, this project would not exist.
Thanks to Bloomberg and Facebook. The ReScript project began at Bloomberg and was published in 2016; without the support of Bloomberg, it would not have happened. ReScript was funded by Facebook since July 2017.
See also Credits.md concerning some individual components of Melange.
See Credits for more details.