Skip to content

Instantly share code, notes, and snippets.

@cician
Created February 19, 2024 20:05
Show Gist options
  • Save cician/e4eda9871ba6bf10a7c09a56bc8ca036 to your computer and use it in GitHub Desktop.
Save cician/e4eda9871ba6bf10a7c09a56bc8ca036 to your computer and use it in GitHub Desktop.

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.

Esy

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...

Dune vs opam

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.

Opam switches

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?

Restart the IDE, like it's 1998.

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.

Unified ocaml-platform

Wen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment