The Magic of Merlin

by Christine Rose on Jul 5th, 2022

Tarides provides support and development services for OCaml tools, packages, and libraries for our commercial partners and for the benefit of the entire OCaml community. We focus on groundbreaking innovation, feature development, and crucial maintenance of OCaml-based projects. One of these projects is called Merlin, an advanced Integrated Development Environment (IDE).


When someone hears the word "Merlin," images of King Arthur, the Round Table, and the Holy Grail might come to mind. This fantasy world introduces us to Merlin, the mighty wizard who becomes Arthur's advisor and mentor. When speaking in the world of technology, our Merlin's magic comes in the form of a powerful editor service that offers completion, typing, navigation, refactoring, and code generation. This IDE was made specifically for OCaml, so it complements the safety and expressiveness of the OCaml language with powerful tools. In short, Merlin is a loyal companion that magically helps OCaml developers be more productive and write better programs!

Installing Merlin

Merlin integrates with most editors, including Visual Studio Code (VSCode), via the Language Server Protocol (LSP). It also implements custom features on top of LSP to enable powerful developer workflows that are only available in OCaml. As a result, Merlin helps developers write in OCaml more easily, as they’re provided with instant feedback on any possible errors that they could make. It helps train these programmers to make fewer errors in the future and eases project maintenance by automating complex (and otherwise error-prone) workflows.

The easiest way to install Merlin is by using VSCode's OCaml extension. See the manual for more information. You can also use Merlin through Vim or GNU Emacs. Read more on's Merlin page.

Once the installation process is complete, your editor will automatically start Merlin whenever an .ml or .mli file is opened.

Voilà! So easy!

Merlin in Use

Here's a glimpse of what Merlin looks like in VSCode:

Merlin in VSCode

Merlin is the default IDE tool for OCaml developers. It's utilised by many commercial OCaml users who are funding maintenance work and evolutions of the project. For instance, Jane Street developers, sysadmin, and traders confidently use Merlin to browse, maintain, and modify an OCaml codebase that runs into millions of lines of code. This codebase provides the foundation for Jane Street's financial market trading around the world. It critically depends on tools (such as Merlin’s) to ensure it can continue to evolve while functioning safely.

Beneficial Features in Merlin

One of Merlin's main developers, Frédéric Bour, says his favourite feature is "completion," which has the ability to complete a prefix typed by a programmer in a manner that is (somewhat) relevant in the context. He says, "I like it for two reasons: less things to remember (and in a programming language, usually you have to recall exactly because there is not much room for fuzzy interpretation) and also it makes things 'discoverable.' Sometimes you work in an area that is new to you, and looking at the Merlin view with its suggestions really helps engineers become acquainted with this program."

The Tarides CTO, Thomas Gazagnaire, loves that Merlin "is the perfect companion to any professional OCaml developer. It helps navigate completely new codebases by providing the necessary feedback to learn the project (and the OCaml language!) quicker. It is also super useful to refactor large pieces of existing code, with immediate feedback and hints. I remember very clearly when I started using Merlin on my projects. It provided me a great productivity boost that completely changed the way I programmed in OCaml and made me much more effective. Tarides is now committed to make sure this tool continues to be supported actively. We're always adding new features to improve developer productivity, like value and type renaming, semantic search over a whole project, etc.”

Learn More

If you'd like to read more about Merlin, or become a contributor, visit its GitHub repo, and feel free to open an Issue if you have any suggestions. Please contact us if you would like to subscribe to commercial support or discuss future development.