Reason
Quick StartTryGuideAPICommunityBlogGitHub
type schoolPerson = Teacher | Director | Student string;

let greeting =
  switch stranger {
  | 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 onlineLearn more

Types without hassle

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

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.

JavaScript Quick Start

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

And then run it as usual:

cd my-first-app
npm run start

You can also build in watch mode:

npm run watch

That's all! This compiles Reason to Javascript in the lib/js/ folder.

  • Read more about how we compile to JavaScript through our partner project, BuckleScript.

  • Alternatively, to start a ReasonReact app, try bsb -init my-react-app -theme react.

  • Head over to Editor Setup to get the Reason plugin for your favorite editor!

Examples

Reason MazeMareo: Mario + ReasonReasonReact Hacker NewsReason snake