Following is my mental journey and interaction with ocaml tooling as a newb. It's not meant as a negative criticism, but a form of constructive feedback. Part of the confusion may be caused by my own skill issues. Hopefully this serves as a case study of areas that could be streamlined or better documented.
So it appears I can make an ocaml/reason project with npm. Great! It's kind confusing. Dependencies are not really npm dependencies, but are in the package.json? Npm install doesn't work with them inside? Ah. It kinda just executes esy via npm, which runs opam under the hood? Maybe I'll try the "native" way with opam/dune directly...
Which one manages dependencies?
Am I supposted to add dependencies to x.opam
or dune-project
or dune
? All three?
What? My changes to x.opam
are gone! Ah, it's generated by dune, it's even written in the comment 🤦🏻♂️.
So, opam installs dune, but dune generates x.opam
.
So I have to run dune build
first, then opam install
and THEN i can dune exec
.
And don't forget eval $(opam env)
. After each step? Dunno.
Am I supposed to only work on one project at a time and clean up my PC before starting a new one? Ah! I can use a "local switch". What is a switch? How do I make it work? Which flags do I needed? So I made the local switch. Why doesn't it find my dependencies in the IDE?
When switching switches I need to restart VS Code, otherwise I get errors because it's stuck with the wrong switch. Changed dependencies? Restart again.
Wen?