ReasonML & ReScript in 5 minutes

What is this language about?

It's a functional language that compiles to JavaScript (or to OCaml).

What is ML in ReasonML?

Nowadays ML usually stands for Machine Learning, but in the old days there was a programming language called "Meta Language" which is the ancestor of ReasonML, or Reason Meta Language.

Why rename?

ReasonML is compatible with both JS and OCaml, but lately it was mostly used in the JS ecosystem.

ReScript takes JS-related things from Reason and stops being limited by OCaml support.

What are the good things?


All references are actually constants. Shadowing is widely used. Standard library functions are non-mutative and produce new instances if any changes are made. There is a workaround to create a mutable reference if needed but deliberate enough to be discouraging.

Piping and currying

ReScript is a functional language with no methods on objects, but you can call and chain functions in a familiar way with piping and currying, like



myArray-> => item * 2)

Sound type system and type inference

This is probably the main reason to choose ReScript. It has strong type system and powerful type inference, so you are rarely required to explicitly define types, but the compiler always know what the types are

No folder requirements 

This is a case in many languages, but coming from Java I really appreciate this feature

Full support of algebraic data types

It's very easy to describe any domain with the custom types

You can create type aliases like `type eventId = string` or complex types like 

type event = {

id: eventId,

name: string,

uniqueName: option<string>,

description: string,

properties: list<property>,

types: list<eventType>


The main construction in the language is the exhaustive switch optimized for pattern matching

It's accompanied by an empowered kind of enum called variants. There are options of variants with and without duck typing. Better to see it in action

Simple syntax

It's possible to start writing code after just a few hours of learning if you already know another programming language

Relatively safe refactoring

The combination of a rigid type system and exhaustive switches make the compiler very efficient in finding bugs in the compile time

What are the not so good things?

Simple syntax means it's verbose

There is not much syntax sugar, for example to unwrap an optional constant you'd have to write `maybeSomething-> -> something->performOperation)` instead of `maybeSomething?.performOperation()` in some other languages

You have to define functions before using them

Yes, like in good old C

You can still have type-related bugs

Having a powerful compiler that catches 99% of the type bugs can be too relaxing and it becomes easier to miss that one occasional bug that slips through the compiler checks 😉

keep reading

Next up for you