Hello amazing people,
I am a relatively new user. I absolutely adore OCaml, but I am constantly running into missing or broken tools, especially when used in combination, which makes both learning and using the language very frustrating.
I am already at a point where I can resolve most of the issues myself, but I am still miles away from having a setup that’s enjoyable to use, especially as I move between other people’s projects.
I’d like to have an editor plugin that rebuilds the project automatically, provides great type information and error feedback, and lets me load any module into a REPL.
I’ve been using VS Code with Reason Language Server and while it’s fine, it only works for Esy and BuckleScript projects and doesn’t support REPL and there’s currently essentially no good way to use REPL with Reason (I spent a little bit of time of extending dune utop
to work with reason, but I still need to return to that and finish it).
So I tried Emacs with Tuareg, which gives me REPL but this is not usable with either Esy or Reason (or I wasn’t able to get it to work anyway).
Now, look, I don’t have any problem switching from Opam + Makefile + Ocaml syntax to Esy + Dune + Reason syntax. But every projects uses its own combination of these tools and there is no editor/plugin that works in every setting and I don’t want to keep setting up these projects, changing editors, relearning all the tricks and keybindings, etc.
So this finally brings me to my questions.
Question 1: How do people handle this? What are your setups and how do handle switching between the different projects?
Question 2: Wouldn’t it make sense to have one ultimate language server that detects your environment (opam switch, esy, bucklescript, whatever), lets you enable Reason syntax on a whim, uses the correct build system, lets you pick your backend (native, jsoo, bs), etc.? This might be naive, but I don’t see why it shouldn’t be possible. It’s all just software, we should use it to alleviate suffering, not multiply it.
Again, I can handle every particular scenario manually, but it’s still painful and not fully what I want, and I’m 100% certain it loses newcomers. I had been trying to start using OCaml for years and the state of the ecosystem always put me off, I was never able to even get started. It finally got better recently and I applaud the heroic efforts of the community, but it’s still very far away from ‘works out-of-box’. Compare this with e.g. Haskell tooling, where you already had the amazing stuff I mention (automatic rebuilds, great type feedback, repl) years ago (I haven’t used it much recently, but I’m fairly certain it’s even better today).
Finally: these are meant to be very constructive questions. I have some spare time and will gladly spend it to resolve some of the issues. I’m just not sure which project, editor, plugin to focus my energy on.