Giter Club home page Giter Club logo

melange's Introduction

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

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.

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 to pkgs.ocamlPackages.melange
  • the melc binary 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 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.

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.

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

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. 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:

Name Purpose Dependencies Notes
Esy Package manager Installed with NPM Obtaining dependencies such as dune or reason
OPAM Package manager None Obtaining dependencies such as dune or reason
Dune Build tool Installed with e.g. esy or opam Composable build tool for OCaml; supports composing custom rules to build any project
Reason Syntax Installed with e.g. esy or opam 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
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.

melange's People

Contributors

bobzhang avatar evmar avatar nico avatar anmonteiro avatar chenglou avatar jchavarri avatar glennsl avatar sgraham avatar nicolasdespres avatar rickyvetter avatar joshaber avatar cristianoc avatar tfarina avatar ryyppy avatar riannucci avatar bsansouci avatar coobaha avatar pcc avatar ulrikstrid avatar mransan avatar jdeisenberg avatar eduardorfs avatar syntheticpp avatar arnarthor avatar zploskey avatar fanael avatar nikgraf avatar qhuo avatar bloodyowl avatar dependabot[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.