Home/Tutorials/ReasonML/Getting started with Reason
ReasonML2 min read

Getting started with Reason

Reason is a syntax on top of OCAML that was geared towards bringing JavaScript Developers closer to the OCAML tool chain and semantics.

Introduction to REASON ML

Reason is a syntax on top of OCAML that was geared towards bringing JavaScript Developers closer to the OCAML tool chain and semantics

Advantages of REASON ML

  1. Type System - Reason has a very powerful type system which it gets from the OCAML tool chain. When you write your code in Reason, every line has a type.
  2. Fast compilation - The Reason build tool (bsb) is quite fast. Compilation to JS happens very quickly
  3. Tiny Output - The Reason compilation to JavaScript is readable and is very small.
  4. Tooling and the ecosystem. - Reason-ml has a great tooling system and code formatting is included., furthermore you can integrate your Reason-ml code with NPM packages of your choice.
  5. ReactJS inter-op - Reason was developed at Facebook and as a result, it integrates well with ReactJS via Reason React.

    Click the link to get started

Installation.

In order to install reason you need nodeJS.


```bash
npm install -g bs-platform
```

Creating your project for this lesson

Go to the directory of choice and

type in

```bash
bsb -init reasonml-tut -theme basic-reason
```

Editor Support

I recommend VS-Code with this extension

https://marketplace.visualstudio.com/items?itemName=jaredly.reason-vscode

Other editors are supported as well, check this link below for more information.

https://reasonml.github.io/docs/en/editor-plugins

Reason-ml CLI

You can also install the reason-cli, though its not a requirement. Once installed you get rtop which is Reason-mlโ€™s repl.

Visit https://github.com/reasonml/reason-cli so as to get more information on installation as its different depending on the Operating system you use

About this course.

In this course, I shall show you how to use some of reasonml's features and tool chain with some examples of problems and how we can solve them in Reason Ml.

Table Of Content:

  1. Types in Reason-ml
  2. Functions
  3. Variants
  4. Lists
  5. Option type
  6. Records
  7. Tuples
  8. Modules.

At the end of this course, you will have a basic understanding of Reason-ml and also come to appreciate the declarative nature of Reason-ml as it will help you become a more productive developer who writes less buggy code that is type safe.


INTERACTIVE SIMULATION CHALLENGE+250 XP
Workbench Verification

Ready to test "Getting started with Reason" in production?

See how ReasonML algorithms and server loops perform under 100k req/s traffic spikes.

Simulator: SysDesign Ops Simulator