From the OCaml Labs wiki
Jump to: navigation, search


Reason is a new approachable interface to the OCaml language, with the long-term goal of improving the developer experience by providing a functional syntax and toolchain for writing, building and sharing code quickly and easily.

Reason builds on existing strengths of OCaml by supplying a syntax familiar to users of Javascript (and other web programming languages), a powerful editor toolchain and custom REPL. Reason aims to utilize valuable features in OCaml and the package manager OPAM, adding support for popular editors (Merlin support for Atom) with the larger aim of creating a seamless build environment with multi-architectural and operating system support.


Related Pages[edit]

Current Features[edit]



Reason comes with a REPL called rtop which lets you interactively evaluate Reason syntax, and see the results printed results in Reason syntax. It features intelligent, type-driven autocompletion.



Line-wrapping AST based formatting is an important feature of Reason that integrates with your editing experience. Reason includes a powerful, consistent syntax formatter/converter called refmt, that can parse, and print the Reason syntax at arbitrary width wrappings, while interleaving comments. It can also be used to convert between multiple syntaxes.



To ensure high interoperability between OCaml and Reason, documentation is key. Redoc is a tool to generate html documentation in Reason syntax from OCaml sources. It wraps ocamldoc by adding a custom html generator for printing in Reason syntax. Example: Reason documentation of OCaml standard library. Ongoing work with odoc from Jane street will further support this feature.


Merlin is a powerful, intelligent, interactive IDE toolchain that works with artifacts generated by the ocaml compiler. Because Reason uses the ocaml compiler, Merlin and Reason can play well together.

Reason Demo: Atom

As part of the Reason effort, the official Merlin project has been generalized enough to support the level of customization required by Reason while still allowing Reason to use all of Merlin‘s advanced features such as:

  • Type driven autocompletion.
  • Recovering type checking, and displaying of multiple parse errors in the editor.
  • Displaying type errors.
  • Refactoring and jumping to definitions.

Reason comes with editor plugins for Atom, Vim and Emacs, and all of them use Merlin to power their type driven interactive editing experience.

What's Next - Upcoming Projects[edit]

  • Sandboxes for locally developing large projects of interconnected smaller packages
  • Project scaffolding/build system (or build rules for existing systems)
  • Library curation (precompiled, fast installed libraries)
  • Improvements to syntax, based on feedback
  • Single command to install everything


1.0 - 17 May 2016