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
- 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.
- Fast compilation - The Reason build tool (bsb) is quite fast. Compilation to JS happens very quickly
- Tiny Output - The Reason compilation to JavaScript is readable and is very small.
- 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.
- ReactJS inter-op - Reason was developed at Facebook and as a result, it integrates well with ReactJS via Reason React.
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-vscodeOther editors are supported as well, check this link below for more information.
https://reasonml.github.io/docs/en/editor-pluginsReason-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:
- Types in Reason-ml
- Functions
- Variants
- Lists
- Option type
- Records
- Tuples
- 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.