Powered by the versatile OCaml type system, with best-in-class type inference, Melange produces robust JavaScript code.
Sponsored by:
Check melange.re to get started.
Melange is released to OPAM. Install it with:
$ opam install melange
melange-re/melange-opam-template provides a GitHub template repository that can be used as a project starter.
Melange has good support for Nix:
github:melange-re/melange
can be added as a
flake inputmelange.overlays.default
overlay that adds
melange to pkgs.ocamlPackages.melange
melc
binary can be run with nix run github:melange-re/melange
, e.g.
nix run github:melange-re/melange/2.0.0 -- --help
.cmt
artifacts
targeting the OCaml 4.14 binary format.Melange has first class support in Dune.
ocaml-lsp
or
Merlin works as usual. In VSCode, the
VSCode OCaml Platform
extension is recommended.
#melange
channel in the
ReasonML DiscordThis project is forked from an earlier version of the ReScript compiler, focused on a deeper integration with the OCaml ecosystem. Such integration makes it easy to share code between backend and frontend using e.g. Dune's virtual libraries.
Melange 1.0 includes a ReScript compatibility layer to maintain compatibility with ReScript syntax - preserving access to ReScript's package ecosystem. Both ReScript and Melange have diverged significantly since then, and this compatibility layer was removed in Melange 2.0.
A small write-up with more details on the motivation behind this project can be found in the announcement blog post. Additional write-ups exist at anmonteiro.substack.com
Below is a quick comparison between Melange and other tools:
Name | Purpose | Dependencies | Notes |
---|---|---|---|
OPAM | Package manager | None | Obtaining dependencies such as dune or reason |
Dune | Build tool | Installed with e.g. opam |
Composable build tool for OCaml; supports composing custom rules to build any project |
Reason | Syntax | Installed with e.g. opam |
Alternative syntax to OCaml |
Melange | Compiler that emits Script | OPAM (to install), Dune (to build) | Supports OCaml and Reason; derived from ReScript, focused on deeper integration with OCaml |
ReScript | The brand around a syntax and a compiler that emits JavaScript | None | Distributed via NPM as prebuilt binaries; previously called BuckleScript |
See CONTRIBUTING.md.
See also Credits.md concerning some individual components of Melange.
See COPYING and COPYING.LESSER
See Credits for more details.