Reason for the Reasonable π€
Typed FP, bad puns, and emojis π
What It Is π
- Strongly typed functional programming language (JS of FP languages)
- Dialect of Ocaml that looks like JS
- Compiles to JS (BuckleScript), Node (BuckleScript), orΒ Native (Ocaml)
- Uses not 1, not 2, but 3 APIs: Reason/Ocaml/BuckleScript
What It's Not π
- Pure
- HKT or Ad Hoc Polymorphism
- Super duper functional algabraic expialidocious
BenefitsΒ π
- Looks like JS with the just right amount of FP
- Types are inferred
- ADT
- Fast compile times
- Bindings (node, express, react, jest, etc.)
- FFI
- Write once, run everywhere
- Macros
- Plain ole' JS escape hatch - desperate times call for desperate measures
Downsides π
- Small community
- Good but not great error messages
- No create-reason-react-app
- bs-platform build dependency
- API hell
- Data first? Data last? Make up your mind
- Did I mention BS?
Similarities π©
- Objects
- Functions
- Arrays
- Strings
- let bindings
- Mutable values
- Boolean
- for/while loops
- if/else
- Promise
- Destructuring
- Exceptions
Differences π¨βπ€
- Int/Floats
- Lists
- Records
- ADT/Variants
- Pipe/pipe first (|> / ->)
- Options (Maybes)
- Tuples
- Chars
- Global Modules
- Labeled/optional/as function arguments w/partial application
- Unused variable indicators
Code Time β°
ReasonReact π€―
- Everything you like about Reason in React
- Reminder: Go to ReasonReact in Browser
The End is Nigh π
ReasonML
By Adam Recvlohe
ReasonML
- 708