I just got back into Ocaml(not a ‘real’ programmer but an enthusiast ) and I’m wondering what the community uses for editors and tools.
Myself, I use Vim with merlin/ocp-indent/ocp-browser and utop and opam and OcamlBrowser but I’m curious what others use and if there are any problems with the tools or any compatibility issues between tools.
Also… Does everyone else have problems deciding when and where to make types abstract and concrete in functors?
Your setup sounds reasonable. I use vim for editing with merlin, ocp-indent (automatic indentation while typing), ocamlformat (formatting via neoformat). utop + ocp-browser for exploring APIs. dune to build. All via opam of course! The combination works very well for me. I haven’t run into any major compatibility issues between these tools.
The current default ocp-indent indentation and ocamlformat indentation don’t line up perfectly but both tools are configurable enough to work around those differences and ocamlformat has a lot of new formatting configuration options coming which should make the two line up even more when configured to do so.
I never understand this kind of claim, which I see made in both directions. I know both editors and there’s very little difference in learning curve. If you can learn emacs you can learn vi, and if you can learn vi you can learn emacs.
Yes, but once you’ve absorbed vi it’s difficult (for me at least) to absorb emacs (both keyboard memory and general philosophy). The main thing I miss from when I attempted my experiments using emacs is slime. There’s probably an equivalent in vi but I doubt it would be as seamlessly integrated.
I know I’m a little late to the party but I would like to put in a good word for vscode. I don’t use vscode as my primary editor (that’s spacemacs + tuareg), but I took it for a spin recently and I was able to get first-class OCaml/Reason support as well as vim keybindings in under a minute with vscode’s one-click extensions. I was very impressed by the polish and would definitely recommend for enthusiasts who don’t want to screw around with configuration too much.
I had to setup an OCaml editor for a person who is used to vscode-like tools.
I could quickly get basics features (autocomplete, error reporting and jump). But I was not able to get evaluation of OCaml expressions which is the minimum feature for a REPL.
Can you evaluate OCaml expressions in vscode?
In between, we chosed to have a try for him with ocaml-top which is fine to do the REPL job (but this tool intended for education has no editing features such as search-replace, files tree, debug-compile, etc. ). It’s great for beginners who wants to focus on the OCaml language without being exposed to emacs/vim learning.
What is your setup?
Concerning debugging and compilation, I know that these features are not available. But maybe there is an easy tweak for that?
Unfortunately I cannot say a lot on this subject since I use vscode very rarely (only when I break emacs really hard). I took a quick look around just now and it seems like it’s possible since vscode 0.8.0, which added debugging features which would allow utop to be integrated with vscode. There’s even this deprecated plugin which claims to have utop integration. Unfortunately the official ocaml/reason plugin does not appear to have support for this feature, and it looks like the currently recommended strategy is to invoke the repl via the embedded terminal. I imagine this setup is good enough for the majority of users.
There is typerex that claims to be an OCaml programming studio but this is a set of (used) tools and not an IDE as suggested by the word studio.
I had a try a few years ago with the now old OcaIDE plugin for Eclipse that was interesting. It has module and members completion, code outline, type pop-ups, information pop-ups, hyperlinks, help on expected parameters, files tree, errors markers in the editor and in the files tree/explorer, module browser and integrated toplevel.