OCaml offers an industrial-strength, state-of-the-art type system and provides type inference with very few type annotations, proving invaluable in managing large projects.
Melange helps developers and companies bring the advantages of the OCaml platform to users of the Web platform in a way that makes it easy for developers to integrate with both ecosystems.
A bit of history
To better understand where Melange comes from, it might help to go through some of the related projects that have appeared over the last decade or so.
BuckleScript gets some inspiration from Js_of_ocaml, for example in the way
Js.t. But it differs from
Js_of_ocaml in many ways: it can generate more readable and lighter code. It
also generates one
.js file per module, which makes it easier to integrate
Over time, and with help of other Facebook employees and the community providing
reason-react, the combination of
Reason and BuckleScript gains adoption.
BuckleScript gets rebranded
However, at some point the goals of both BuckleScript and Reason projects become harder to reconcile. In August 2020, the BuckleScript team decides to rename to ReScript, stops adding support for the latest versions of the Reason parser, and replaces it with a new parser that changes the syntax. The reasons for the rebranding are explained in the official ReScript blog post.
Melange: back to OCaml
This is where Melange comes in. A few weeks after the rebranding of BuckleScript to ReScript, António Monteiro starts working on a fork of BuckleScript with a simple (not easy) goal: replace the Ninja build system, which BuckleScript had been using from its creation, with Dune, which is the most used build system for OCaml projects.
This fork of BuckleScript is later named Melange. After finishing the switch from Ninja to Dune, several additional features are added to bring it closer to OCaml. Some examples are the upgrade of the OCaml compiler version used by Melange, or modeling the changes to the OCaml compiler that Melange uses as just a plain library, instead of a full fork of the upstream compiler.
In September 2022, Ahrefs decides to invest on Melange by funding a project to deepen the integration between Dune and Melange. This project achieves its completion in Spring 2023, with the migration of Ahrefs frontend codebase to Melange and the new public releases that support it: version 3.8 of Dune and 1.0 of Melange.