package reactjs-jsx-ppx
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=01ff3a2711b3812889313288f9e0c8bfe2e17464b6b85282c5113cfc3b740968
sha512=db9ac4554d0c9a8deabbdcd2ae05653964184916982c746ca794df6e2061444adaa6a0367bc1840825a007be3941643abd824aaff737a431b0e5347f7c558378
Description
Published: 02 Jun 2023
README
Melange
Melange compiles OCaml / Reason to JavaScript
Powered by the versatile OCaml type system, with best-in-class type inference, Melange produces robust JavaScript code.
Sponsored by:

Installation
OPAM
Melange is released to OPAM. Install it with:
$ opam install melange
Template
melange-re/melange-opam-template provides a GitHub template repository that can be used as a project starter.
Esy
Get Esy on NPM:
npm install -g esy
installs Esy globally- if
npm
is installed,npx esy
can be used to run Esy locally
An Esy project starter also exists.
After cloning the template, run esy
in the project root.
Nix
Melange has good support for Nix:
github:melange-re/melange
can be added as a flake input- the melange flake provides a
melange.overlays.default
overlay that adds melange topkgs.ocamlPackages.melange
- the
melc
binary can be run withnix run github:melange-re/melange
, e.g.nix run github:melange-re/melange -- --help
OCaml version compatibility
The current Melange distribution targets OCaml 4.14. There's an old version of Melange based on OCaml 4.12 that requires version 4.12.0+mel
of melange-compiler-libs
.
Editor integration
Melange has first class support in Dune. ocaml-lsp
or Merlin works as usual. In VSCode, the VSCode OCaml Platform extension is recommended.
Community
- There's a
#melange
channel in the ReasonML Discord
FAQ
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.
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:
Name | Purpose | Dependencies | Notes |
---|---|---|---|
Package manager | Installed with NPM | Obtaining dependencies such as | |
Package manager | None | Obtaining dependencies such as | |
Build tool | Installed with e.g. | Composable build tool for OCaml; supports composing custom rules to build any project | |
Syntax | Installed with e.g. | Alternative syntax to OCaml | |
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 | |
The brand around a syntax and a compiler that emits JavaScript | None | Distributed via NPM as prebuilt binaries; previously called BuckleScript |
Can I use ReScript syntax?
Yes! ReScript syntax is supported, but ReScript won't have as many features as the OCaml or Reason syntaxes due to ReScript being built on top of an old OCaml version (4.06 - released in 2018). (e.g. letop
binding operators, generalized module open expressions, or local substitutions in signatures).
Contributing
See CONTRIBUTING.md.
Acknowledgments
- Thanks to the ReScript project, its author and maintainer @bobzhang, and its many contributors. Melange is a fork of ReScript, and continues to incorporate patches to ReScript on a regular basis.
- 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.
Licensing
See COPYING and COPYING.LESSER
See Credits for more details.