Opinionated ReasonML starter template. With esy and dune.
Dune by default assumes that all the source code lays on the same directory as the dune
file. If you want to have subdirs inside lib
then you have to have a separated dune
file for each of them. But this template comes with (include_subdirs unqualified)
as a dune option. Which allows having others subdirs inside lib
without having to setup them as separated libraries. If you do not want this behaviour just remove this line.
A package manager for the OCaml ecosystem. It can install packages from opam
and from npm
.
It also automatically resolves transitive dependencies, and generates a lock file containing their versions to make it easier to replicate your setup on multiple machines without storing the downloaded dependencies.
npm i -g esy
Or, if you're using yarn
yarn global add esy
Install the dependencies with esy:
esy
Build the project:
esy build
Run the example binary:
esy x ReasonStarter <dividend> <divisor>
Using the utop
REPL is a little bit different when using Reason syntax. We have a especial library for that: rtop
. In this boilerplate you have two ways of accessing the REPL:
esy x rtop
Or:
esy utop
Which will bring up the OCaml utop
, then, inside of it you should be able to use the #require
directive to get into rtop
itself:
utop # #require "rtop";;
Reason #