Reason on multicore



If you’re looking to try multicore with Reason, try this esy project template I created.

It’s an esy project with the multicore compiler, no-effect-syntax branch, with Dune 1.9.1 and Sudha Parimala’s fork of Lwt. Sudha’s lwt fork lets one use Lwt_preemptive.detach over real system cores (more correctly called domains). There’s a great blog post about it here.

How to get started?

You’ll need

  1. esy - you can install it with npm i -g esy or yarn global add esy

  2. Clone the repo:

    git clone
  3. Run make deps to install the dependencies

  4. Run make to compile and run it.

Writing multicore programs

Domains is the recommended way to write multicore programs. But, since we’re familiar with promises, Sudha’s Lwt, is really convenient. If you have a computation heavy problem to try Reason with, they’re looking for sandmark benchmarks.

What about Effects?

This branch of the multicore compiler does not have effects. Effects and multicore has being decoupled. Multicore will be available via Domains.

How does this template work? What do we need for Multicore to work on Reason?

Multicore compiler doesn’t work with the central opam repository. The multicore team maintains it’s own fork of the opam repository with only packages that work with multicore. I had to fork it and add packages needed to build Reason. Great news - we dont need any patches or overrides, but we need Reason from master branch.

Because we need more packages from multicore opam, my fork has to be specified to esy and some packages (even on upstream opam) need overrides - unrelated to multicore afaik. Hence, the command looks like this,

esy --opam-repository-remote \

Editor support

Unfortunately, there is not merlin/lsp support as of now.

Happy hacking!