View on GitHub

OCamlverse

Documenting everything about OCaml

Edit

Code Tools

Editor Tools

For an OCaml beginner, the recommended editor of choice is Visual Studio Code with the OCaml Platform plugin.

See the editor setup page for more instructions on how to setup individual editors.

Visual Studio Code

  • VSCode-Reason: The Reason/OCaml plugin for Visual Studio Code. Allows for all the advantages provided by Merlin with the convenience of the VSCode IDE.
  • VSCode-OCaml-platform: OCaml extension for Visual Studio Code.

Emacs

  • tuareg: OCaml major mode for Emacs that can also run the toplevel and the debugger within Emacs.
  • caml-mode: Another (older) OCaml major mode for Emacs. While it has less features than Tuareg it covers the basics well and also features toplevel and debugger integration.
  • dune: Dune major mode and utility commands for Emacs.
  • merlin-mode: Code completion, linting, code navigation and type analysis mode for Emacs.
  • merlin-eldoc: Eldoc support for OCaml, using Merlin internally.
  • utop.el: utop integration for Emacs. Features code completion.
  • flycheck-ocaml: OCaml linter for Emacs, using Merlin internally.

Note that Emacs also has LSP support. See lsp-mode and eglot for more details.

Sublime Text

Note: As of 2022 both packages seem abandoned.

Vim

  • Vim only really needs merlin, and optionally, ocp-indent or ocamlformat.

Neovim

  • Neovim supports plugins written in any language, including OCaml using the vcaml package.

General

  • user-setup: automatically configures several editors to use merlin, ocp-indent, and ocp-index if they are installed. Run opam install user-setup to install it, and then follow the instructions, which tell you to run opam user-setup install.
  • merlin: the main tool used to provide information to editors about OCaml codebases. Note that to provide information, the code must first be compiled. Dune is able to automatically create /.merlin/ files, which are needed to help merlin find the compiled files.
  • ocp-index: Easy access to the interface information of installed OCaml libraries. Contains a few standalone tools:
    • ocp-browser: Excellent, easily accessible ncurses-based API and documentation browser. Available independently on OPAM.
    • ocp-index-top: toplevel directive for looking up documentation using ocp-index.
  • ocp-indent is a coding style formatting tool that relies on heuristics and partial parsing rather than a full end-to-end parsing and printing approach, like ocamlformat below. The advantage of ocp-indent’s approach is that even partially-compiling files can be indented, as can code fragments.
  • ocamlformat is a comprehensive coding style formatting tool that parses the code and prints it out again. This follows the example of the refmt tool for Reason. While new, ocamlformat may eventually overtake ocp-indent.

Development Tools

  • utop: Very powerful toplevel for OCaml, that is far better than the default one. A must-install for every OCaml programmer.
  • sketch.sh: Online tool for playing around with OCaml (most up-to-date version).
  • odoc: An automatic documentation generator for OCaml that creates beautiful html.
  • Try OCaml: Try OCaml in your web browser.
  • codingground: Compile and execute OCaml code online.
  • mdx: Tool for executing code or shell snippets inside markdown files.
  • iocaml: An OCaml kernel for the IPython notebook.
  • ghim: A command-line tool to manage Github Issues.
  • OCaml Yeoman Generator: Yeoman generator to scaffold OCaml modules.
  • Dead Code Analyzer: OCaml dead code analysis.

Code Coverage