If you’re looking to try multicore with Reason, try this esy project template I created.
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?
esy- you can install it with
npm i -g esyor
yarn global add esy
Clone the repo:
git clone https://github.com/ManasJayanth/reason-on-multicore
make depsto install the dependencies
App.reand 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
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 https://github.com/ManasJayanth/multicore-opam \ --opam-override-repository-remote https://github.com/ManasJayanth/multicore-esy-opam-overrides
Unfortunately, there is not merlin/lsp support as of now.