Reason
  • Docs
  • Try
  • API
  • Community
  • Blog
  • English
    • 日本語
    • Deutsch
    • Español
    • Français
    • 한국어
    • Português (Brasil)
    • Русский
    • Українська
    • 中文
    • 繁體中文
    • Help Translate
  • GitHub
Hello! This particular page hash has moved to . Please update the URLs to reflect it. Thanks!
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 ++ "."
  };
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 ++ "."
  };
Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript & OCaml ecosystems.
Try Online
Quick Start

Types without hassle

Powerful, safe type inference means you rarely have to annotate types, but everything gets checked for you.

Easy JavaScript interop

Use packages from NPM/Yarn with minimum hassle, or even drop in a snippet of raw JavaScript while you're learning!

Flexible & Fun

Make websites, animations, games, servers, cli tools, and more! Take a look at these examples to get inspired.

QuickStart

npm install -g bs-platform
bsb -init my-first-app -theme basic-reason
cd my-first-app
npm run start

It runs in watch mode, so any changes to files will be picked up and compiled. Read more here!

Examples

Hacker News

Maze

TodoMVC

Mareo

Users of Reason

See Full List