Skip to main content

ReasonML

ReasonML (often just called Reason) is a functional programming language developed at Facebook by Jordan Walke, who also created the ReactJS framework. It belongs to the ML family of statically-typed functional languages, which includes Standard ML, OCaml, and Microsoft's F#. ML was originally developed as the Meta Language for the LCF theorem prover at the University of Edinburgh, and has long been a valuable tool for programmers working with formal logic or developing other programming languages. It was a major influence in the design of the functional languages Haskell and Scala, and more recently it has seen adoption in financial services (for example, Bloomberg and Jane Street) and web development (particularly at Facebook).

Reason is a dialect of OCaml with a syntax that is more comfortable for programmers familiar with JavaScript or other languages in the C/C++/Java family. One advantage of building on OCaml is that its compiler is remarkably fast and sophisticated, and it can generate JavaScript output for running programs in a web browser. In fact, since the compiler itself is written in OCaml, it is possible to compile the entire system to JavaScript and run it in the browser.

Here is an editor where you can type in ReasonML code and execute it (click the button or type Ctrl-Enter):

If for some reason you want to reset the interpreter before executing the code (so that it will forget previous bindings), press the Shift key plus Ctrl-Enter.

There are several other places online where you can run ReasonML code, although they will not always match the setup here (particularly the available libraries):

You can also install Reason on your own computer and run it locally (or develop your own web site with React!). If you do this, I recommend using the free Visual Studio Code editor along with a plugin for Reason; this will give the complete IDE experience.