Reason
  • Docs
  • Try
  • API
  • Community
  • Blog
  • Languages iconEnglish
    • 日本語
    • 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.

Use the power of the OCaml ecosystem

Get access to the powerful systems programming language OCaml with an easier to learn syntax. Use js_of_ocaml to compile to JavaScript!

Users of Reason

FacebookMessengerOneGraphViskaBeOpSocial TablesBroadsheetToughbyteg2i.coTinyRungAstrocodersAhrefsDernier CriBacktraceMobilunityAppierInVisionCoursebaseImandra IncTail RecursiveGangverkLaTeX Baseohne-MaklerSotheby's上线了 SXL.CNJoinUpLenus eHealthPupilfirstnittygrittyLeon SoftwarexorlabcodeheroesControl Center AppsruangguruDraftbitQwickReveryOnivim 2O(1) LabsminimaIteamAstrolabe DiagnosticsAuditlessCutiiBand ProtocolRaditycodecentricTradie TrainingPorterOxidizing SystemsTenzir
See Full List