package melange
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=f78d18ce9d595e737a98a55663e9ea2a39f8aad054251e5e1c4e793938c6bdd5
sha512=d4b7c18bb1d1e7af529ea49fe1ce28b0debf64056ba65108768ed28dc920e4b92a61cdb279c52b7140206e816eb484fd87d21572021b4ef983c54ddbc4907034
Description
Published: 21 May 2024
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
Check melange.re to get started.
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.
Nix
Melange has good support for Nix:
github:melange-re/melange
can be added as a flake inputthe 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/2.0.0 -- --help
OCaml version compatibility
Melange v2.0 works on OCaml 5.1 only.
Melange v1.0 can build projects with 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.
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 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 |
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.
Dependencies (7)
Dev Dependencies (5)
-
odoc
with-doc
-
merlin
with-test
-
reason-react-ppx
with-test & post
-
reason
with-test & >= "3.9.0"
-
ounit
with-test
Used by (18)
-
melange-atdgen-codec-runtime
>= "3.0.0"
- melange-fest
- melange-fetch
-
melange-jest
>= "0.1.1"
-
melange-json
>= "1.1.0"
- melange-moment
- melange-numeral
-
melange-radix-icons
< "0.0.2"
-
melange-recharts
>= "4.0.1"
- melange-testing-library
-
melange-webapi
>= "0.21.0"
- pancake
-
reason-react
>= "0.14.0"
-
reason-react-ppx
= "0.13.0"
- red-black-tree
- server-reason-react
- styled-ppx
- universal-portal
Conflicts
None