Introduction to Reason Compilation

[CG]Nick
689 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

6 - Add a Third-Party Dependency

Thanks to our previous step, adding a new dependency is easy.

The OCaml compiler is package manager-agnostic. OPAM is the common one used by the community. Though if you're reading this tutorial, you likely know how to use npm. Good news: we support that as well. This tutorial will focus on the latter.

Usually we'd write a package.json here and let you do npm install to install all the dependencies into ./node_modules; for the sake of simplicity, we're gonna hardcode a dependency (check it out, it's only two files). You get the idea.

We'll also make the corresponding additions to .merlin.

"Run"
1
2
3
4
5
print_endline MyDep.secret;
print_endline MyDep2.secret;
print_endline Muffin.secretFlavor;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content