Important: If you are looking for ReScript (formerly BuckleScript) installation instructions, please refer to the ReScript website.
Reason comes with its own "npm like" package manager called esy:
npm install -g esy
To create your first Reason native CLI program, run the following commands:
git clone https://github.com/esy-ocaml/hello-reason.git cd hello-reason # Install all dependencies (might take a while in the first run) esy # Compile and run Hello.exe esy x Hello
Reason native development is essentially OCaml development. From here on, you want to read up following websites to get to understand the ecosystem:
- esy: The
esypackage manager is designed to manage your npm and opam dependencies and efficiently caches & sandboxes your project compiler and dependencies. Check out the esy website to find out how to install dependencies, setting up package resolutions, and executing compiled programs.
- opam: The opam package index lists all available packages available in the OCaml ecosystem
duneis the official build system in the OCaml ecosystem. Check out the manual for more details on how to set up your project.
All your packages are managed in your
package.json file. Usually you will find a
dune file in each source code directory (such as
lib/) for all the build system settings as well.
To add Reason / OCaml packages that happen to be hosted on npm, run
esy add npm-package-name.
esy add refmterr
esy treats the npm scope
esy will install any package name with the
@opam scope directly from opam. This is the only scope with special meaning. All other package names are assumed to be hosted on npm.
esy add @opam/bos
Advanced esy configuration:
See the configuration section from the complete
To get started with Reason + esy + JSOO, check out this
git clone https://github.com/jchavarri/hello-jsoo-esy.git cd hello-jsoo-esy esy npm install npm run webpack
After you have successfully compiled your first example, it's time to set up your editor to get access to all the nice features such as auto-completion. Later on you can check out the language basics to get a basic understanding of all the Reason language constructs.