Reason
  • Docs
  • Try
  • API
  • Community
  • Blog
  • Languages iconEnglish
    • 日本語
    • Deutsch
    • Español
    • Français
    • 한국어
    • Português (Brasil)
    • Русский
    • Українська
    • 中文
    • 繁體中文
    • Help Translate
  • GitHub

›Intro

Intro

  • What & Why
  • Getting started

Setup

  • Installation
  • Editor Plugins
  • Format (refmt)

Language Basics

  • Overview
  • Let Bindings
  • Primitives
  • Basic Structures
  • Types
  • Records
  • Variants
  • Options and nullability
  • Functions
  • Recursion
  • Destructuring
  • Pattern Matching
  • Mutable Bindings
  • Loops
  • Modules

Advanced Features

  • JSX
  • External
  • Exception
  • Object

JavaScript

  • Melange
  • Interop
  • Syntax Cheatsheet
  • Pipe First
  • Promise
  • Libraries
  • Converting from JS

Extra

  • Frequently Asked Questions
  • Extra Goodies
  • REPL (rtop)
Edit

Getting started

This section of the docs is all about quickly setting up a Reason development environment up and running.

Get an overview of Reason

type schoolPerson =
  | Teacher
  | Director
  | Student(string);

let greeting = person =>
  switch (person) {
  | Teacher => "Hey Professor!"
  | Director => "Hello Director."
  | Student("Richard") => "Still here Ricky?"
  | Student(anyOtherName) => "Hey, " ++ anyOtherName ++ "."
  };

module Intro = {
  [@react.component]
  let make = (~person) => {
    <p> {React.string(greeting(person))} </p>
  }
};

This snippet includes [@react.component] which comes from reason-react

For an introduction to most language features check out the overview

Try Reason in your browser

To start immediately an online REPL is available at Sketch.sh or open the playground

Install Reason

Install Reason on your computer to start writing Reason applications. Check the installation for a more detailed guide.

← What & WhyInstallation →
  • Get an overview of Reason
  • Try Reason in your browser
  • Install Reason