Introduction to Reason Compilation
[CG]Nick
13.8K views
Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
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
6
print_endline MyDep.secret;
print_endline MyDep2.secret;
print_endline Muffin.secretFlavor;
Enter to Rename, Shift+Enter to Preview
1
let secret = "hello";
Enter to Rename, Shift+Enter to Preview
1
let secret = MyDep.secret ^ " world";
Enter to Rename, Shift+Enter to Preview
1
cd step6
Enter to Rename, Shift+Enter to Preview
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content