SlideShare a Scribd company logo
1 of 29
Download to read offline
ReasonML & Bucklescript, or how to do a functional NodeJS app
NodeJS The edge of Reason
What I do
Thomas Haessle
@Oteku
cutii.io
is amazing
Tooling
Fast (web point of view)
is a mess
fit functional
Object literals
Spread operators
Arrays map / reduce / filter
Functions as first class citizen
Currying
Closures
Arrow functions
…
JSX (composition)
React stateless components (composants fonctionnels)
React PropTypes (Typage sur propriétés des composants)
…
Redux pattern
…
RxJS
is unfunctional
Code Easy to Reason About :
- does not affect or mutate external state
- does not rely on external state
- always return the same corresponding output for a given input
- have up to date documentation
Give me a Reason(ML)
Reason lets you write simple, fast and quality type safe
code while leveraging both the JavaScript & OCaml ecosystems.
How a 21 years old language may Reasonably
help me ?
How a 21 years old language may Reasonably
help me ?
How a 21 years old language may Reasonably
help me ?
… and some love Reasons
(be patient)
« Déjà vu »
is designed for JS dev
const greeting = "Bonjour";
const greetList = [];
greetList.push(greeting); /*references are
immutables, not values !*/
const gList = ['Hello', 'Hallo'];
const greetings = [greeting, ...gList];
let who = "FP Lille#7";
who = "LilleFP#6";
function internationalGreet(gWords, name) {
return gWords.map(current => current + " " + name);
}
console.log(...internationalGreet(greetings, who));
dummy.js
let greeting = "Bonjour"; /* inference */
/* List type is immutable */
let greetList = [];
let prepended = [greeting, ...greetList];
let appended = greetList @ [greeting];
let greetArray = [||]; /* Array type is mutable */
greetArray.(0) = greeting;
let gList: list string = ["Hello", "Hallo"]; /* type may be
explicit */
let greetings = [greeting, ...gList]; /* (ノ^ヮ^)ノ*:・゚✧ spread
operator */
let who = ref "FP Lille#7"; /* explicit mutability */
who := "LilleFP#6";
let internationalGreet gWords name => gWords |> List.map (fun
current => current ^ " " ^ name);
internationalGreet greetings !who |> List.iter (fun current =>
Js.log current);
dummy.re
is designed for JS dev
let greeting = "Bonjour"; /* inference */
/* List type is immutable */
let greetList = [];
let prepended = [greeting, ...greetList];
let appended = greetList @ [greeting];
let greetArray = [||]; /* Array type is mutable */
greetArray.(0) = greeting;
let gList: list string = ["Hello", "Hallo"]; /* type may be
explicit */
let greetings = [greeting, ...gList]; /* (ノ^ヮ^)ノ*:・゚✧ spread
operator */
let who = ref "FP Lille#7"; /* explicit mutability */
who := "LilleFP#6";
let internationalGreet gWords name => gWords |> List.map (fun
current => current ^ " " ^ name);
internationalGreet greetings !who |> List.iter (fun current =>
Js.log current);
dummy.re
let greeting = "Bonjour"
let greetList = []
let prepended = greeting :: greetList
let appended = greetList @ [greeting]
let greetArray = [||]
let _ = greetArray.(0) <- greeting
let gList: string list = ["Hello"; "Hallo"]
let greetings = greeting :: gList
let who = ref "FP Lille#7"
let _ = who := "LilleFP#6"
let internationalGreet gWords name =
gWords |> (List.map (fun current -> current ^ (" " ^ name)))
let _ =
(internationalGreet greetings (!who)) |>
(List.iter (fun current -> Js.log current))
dummy.ml
https://youtu.be/_0T5OSSzxms
Cheng Lou - Taming the Meta 
add1.re
add1.rei
demo.re
human readable output
dead code elimination 

(similaire prepack.io)
code optimizations
amazingly fast
safer JS runtime execution
( param = 2 + undefined 

… mais param = 2 + « 3 » )
demo.js
add1.js
bsb --make-world
||
• Compile high-level rawlambda  to js
• Focuses more on npm
• Readable js output
• Compile low-level bytecode to js
• Focuses more on opam
• Uglify js output
• Amazingly fast
• Improving quickly
• Stimulate each other
• License LGPL
Types System
Types System Inference
Types System Inference
https://github.com/reasonml/reason-tools
page.re
root.re
root.js
page.js
type action =
| Click
| Toggle;
type state = {count: int, show: bool};
let component = ReasonReact.reducerComponent "MyDialog";
let make _children => {
...component,
initialState: fun () => {count: 0, show: false},
reducer: fun action state =>
switch action {
| Click => ReasonReact.Update {...state, count: state.count + 1}
| Toggle => ReasonReact.Update {...state, show: not state.show}
},
render: fun self => {
let message = "Clicked " ^ string_of_int self.state.count ^ " times(s)";
<div>
<MyDialog
onClick=(self.reduce (fun _event => Click))
onSubmit=(self.reduce (fun _event => Toggle)) />
(ReasonReact.stringToElement message)
</div>
}
};
Reducer component
will (would) be amazing
Tooling
ality
CONS :
Still young
Little community (but growing)

A functional language learning curve for JS devs
No native packages management (hot topic)

Poor documentation
Bucklescript targets ES5 while node.js is ES8 VS babel-preset-env
Breaking change version is coming next month
PROS :
Battle tested type system with inference : OCaml under the hood

Kind community
Really good samples
Production ready (used for messenger.com)

Reason-react with reducer components

First Reason React Native app published in stores last month (https://github.com/FormidableLabs/seattlejsconf-app)

Facebook baked
May be adopt baby-step (one node module, one react component, …)
ason to be confident
Why ? Reason’s design fit our problems
Do we have a great community ? Almost … we have a discord
Yes and great toolingDo we have a great language ?
ad More
ReTwit
@reasonml
@jordwalke (react & reason creator)
@_chenglou (react team / reason evangelist)
@sgrove (reason evangelist)
@bobzhang1988 (bucklescript creator)
@ken_wheeler (Director of Open Source @FormidableLabs)
ReSpond

https://discordapp.com/invite/reasonml
https://www.reddit.com/r/reasonml/
ReSources
https://reasonml.github.io/
https://github.com/vramana/awesome-reasonml
https://github.com/bucklescript
gards on Youtube
Sean Grove - Everything appends with a Reason : https://youtu.be/tB705w4w6H0
Jake Trent - TDD a ReasonML Function : https://youtu.be/nivVNJPj2z8
Cheng Lou - Imperfection : https://youtu.be/tCVXp6gFD8o

More Related Content

What's hot

Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
Designers Guide To jQuery
Designers Guide To jQueryDesigners Guide To jQuery
Designers Guide To jQuerySteve Krueger
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQueryAlan Hecht
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuerymanugoel2003
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery FundamentalsGil Fink
 
[PyConTW 2013] Write Sublime Text 2 Packages with Python
[PyConTW 2013] Write Sublime Text 2 Packages with Python[PyConTW 2013] Write Sublime Text 2 Packages with Python
[PyConTW 2013] Write Sublime Text 2 Packages with PythonJenny Liang
 
Jquery plugin development
Jquery plugin developmentJquery plugin development
Jquery plugin developmentFaruk Hossen
 
How to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrainHow to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrainCodemotion Tel Aviv
 
Javascript session june 2013 (iii) jquery json
Javascript session june 2013 (iii) jquery   jsonJavascript session june 2013 (iii) jquery   json
Javascript session june 2013 (iii) jquery jsonabksharma
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyBalázs Tatár
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPVineet Kumar Saini
 
Let's write secure drupal code!
Let's write secure drupal code!Let's write secure drupal code!
Let's write secure drupal code!Balázs Tatár
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQueryRemy Sharp
 
Country State City Dropdown in PHP
Country State City Dropdown in PHPCountry State City Dropdown in PHP
Country State City Dropdown in PHPVineet Kumar Saini
 

What's hot (20)

Jquery
JqueryJquery
Jquery
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
Php
PhpPhp
Php
 
Designers Guide To jQuery
Designers Guide To jQueryDesigners Guide To jQuery
Designers Guide To jQuery
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 
[PyConTW 2013] Write Sublime Text 2 Packages with Python
[PyConTW 2013] Write Sublime Text 2 Packages with Python[PyConTW 2013] Write Sublime Text 2 Packages with Python
[PyConTW 2013] Write Sublime Text 2 Packages with Python
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Jquery plugin development
Jquery plugin developmentJquery plugin development
Jquery plugin development
 
How to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrainHow to actually use promises - Jakob Mattsson, FishBrain
How to actually use promises - Jakob Mattsson, FishBrain
 
Javascript session june 2013 (iii) jquery json
Javascript session june 2013 (iii) jquery   jsonJavascript session june 2013 (iii) jquery   json
Javascript session june 2013 (iii) jquery json
 
jQuery
jQueryjQuery
jQuery
 
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, GermanyLet's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
Let's write secure Drupal code! - 13.09.2018 @ Drupal Europe, Darmstadt, Germany
 
Intro to jquery
Intro to jqueryIntro to jquery
Intro to jquery
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
 
Let's write secure drupal code!
Let's write secure drupal code!Let's write secure drupal code!
Let's write secure drupal code!
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
Country State City Dropdown in PHP
Country State City Dropdown in PHPCountry State City Dropdown in PHP
Country State City Dropdown in PHP
 

Similar to NodeJS The edge of Reason - Lille fp#6

Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonMLRiza Fahmi
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonMLRiza Fahmi
 
MYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptx
MYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptxMYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptx
MYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptxArjayBalberan1
 
An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascripttonyh1
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005Tugdual Grall
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Jonathan Felch
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
Web Development Study Jam #2 _ Basic JavaScript.pptx
Web Development Study Jam #2 _ Basic JavaScript.pptxWeb Development Study Jam #2 _ Basic JavaScript.pptx
Web Development Study Jam #2 _ Basic JavaScript.pptxSekarMaduKusumawarda1
 
Intro to php
Intro to phpIntro to php
Intro to phpSp Singh
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of JavascriptTarek Yehia
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformationLars Marius Garshol
 
An Introduction to JavaScript
An Introduction to JavaScriptAn Introduction to JavaScript
An Introduction to JavaScripttonyh1
 
루비가 얼랭에 빠진 날
루비가 얼랭에 빠진 날루비가 얼랭에 빠진 날
루비가 얼랭에 빠진 날Sukjoon Kim
 

Similar to NodeJS The edge of Reason - Lille fp#6 (20)

Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonML
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
 
Wt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technologyWt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technology
 
Wt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technology
 
MYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptx
MYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptxMYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptx
MYSQL DATABASE INTRODUCTION TO JAVASCRIPT.pptx
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascript
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
How to React Native
How to React NativeHow to React Native
How to React Native
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
Web Development Study Jam #2 _ Basic JavaScript.pptx
Web Development Study Jam #2 _ Basic JavaScript.pptxWeb Development Study Jam #2 _ Basic JavaScript.pptx
Web Development Study Jam #2 _ Basic JavaScript.pptx
 
Intro to php
Intro to phpIntro to php
Intro to php
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of Javascript
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformation
 
An Introduction to JavaScript
An Introduction to JavaScriptAn Introduction to JavaScript
An Introduction to JavaScript
 
루비가 얼랭에 빠진 날
루비가 얼랭에 빠진 날루비가 얼랭에 빠진 날
루비가 얼랭에 빠진 날
 
Fantom and Tales
Fantom and TalesFantom and Tales
Fantom and Tales
 

Recently uploaded

%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 

Recently uploaded (20)

%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 

NodeJS The edge of Reason - Lille fp#6

  • 1. ReasonML & Bucklescript, or how to do a functional NodeJS app NodeJS The edge of Reason
  • 2. What I do Thomas Haessle @Oteku cutii.io
  • 5. fit functional Object literals Spread operators Arrays map / reduce / filter Functions as first class citizen Currying Closures Arrow functions … JSX (composition) React stateless components (composants fonctionnels) React PropTypes (Typage sur propriétés des composants) … Redux pattern … RxJS
  • 6. is unfunctional Code Easy to Reason About : - does not affect or mutate external state - does not rely on external state - always return the same corresponding output for a given input - have up to date documentation
  • 7. Give me a Reason(ML) Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript & OCaml ecosystems.
  • 8. How a 21 years old language may Reasonably help me ?
  • 9. How a 21 years old language may Reasonably help me ?
  • 10. How a 21 years old language may Reasonably help me ? … and some love Reasons (be patient)
  • 12. is designed for JS dev const greeting = "Bonjour"; const greetList = []; greetList.push(greeting); /*references are immutables, not values !*/ const gList = ['Hello', 'Hallo']; const greetings = [greeting, ...gList]; let who = "FP Lille#7"; who = "LilleFP#6"; function internationalGreet(gWords, name) { return gWords.map(current => current + " " + name); } console.log(...internationalGreet(greetings, who)); dummy.js let greeting = "Bonjour"; /* inference */ /* List type is immutable */ let greetList = []; let prepended = [greeting, ...greetList]; let appended = greetList @ [greeting]; let greetArray = [||]; /* Array type is mutable */ greetArray.(0) = greeting; let gList: list string = ["Hello", "Hallo"]; /* type may be explicit */ let greetings = [greeting, ...gList]; /* (ノ^ヮ^)ノ*:・゚✧ spread operator */ let who = ref "FP Lille#7"; /* explicit mutability */ who := "LilleFP#6"; let internationalGreet gWords name => gWords |> List.map (fun current => current ^ " " ^ name); internationalGreet greetings !who |> List.iter (fun current => Js.log current); dummy.re
  • 13. is designed for JS dev let greeting = "Bonjour"; /* inference */ /* List type is immutable */ let greetList = []; let prepended = [greeting, ...greetList]; let appended = greetList @ [greeting]; let greetArray = [||]; /* Array type is mutable */ greetArray.(0) = greeting; let gList: list string = ["Hello", "Hallo"]; /* type may be explicit */ let greetings = [greeting, ...gList]; /* (ノ^ヮ^)ノ*:・゚✧ spread operator */ let who = ref "FP Lille#7"; /* explicit mutability */ who := "LilleFP#6"; let internationalGreet gWords name => gWords |> List.map (fun current => current ^ " " ^ name); internationalGreet greetings !who |> List.iter (fun current => Js.log current); dummy.re let greeting = "Bonjour" let greetList = [] let prepended = greeting :: greetList let appended = greetList @ [greeting] let greetArray = [||] let _ = greetArray.(0) <- greeting let gList: string list = ["Hello"; "Hallo"] let greetings = greeting :: gList let who = ref "FP Lille#7" let _ = who := "LilleFP#6" let internationalGreet gWords name = gWords |> (List.map (fun current -> current ^ (" " ^ name))) let _ = (internationalGreet greetings (!who)) |> (List.iter (fun current -> Js.log current)) dummy.ml
  • 14.
  • 16. add1.re add1.rei demo.re human readable output dead code elimination 
 (similaire prepack.io) code optimizations amazingly fast safer JS runtime execution ( param = 2 + undefined 
 … mais param = 2 + « 3 » ) demo.js add1.js bsb --make-world
  • 17. || • Compile high-level rawlambda  to js • Focuses more on npm • Readable js output • Compile low-level bytecode to js • Focuses more on opam • Uglify js output • Amazingly fast • Improving quickly • Stimulate each other • License LGPL
  • 23. type action = | Click | Toggle; type state = {count: int, show: bool}; let component = ReasonReact.reducerComponent "MyDialog"; let make _children => { ...component, initialState: fun () => {count: 0, show: false}, reducer: fun action state => switch action { | Click => ReasonReact.Update {...state, count: state.count + 1} | Toggle => ReasonReact.Update {...state, show: not state.show} }, render: fun self => { let message = "Clicked " ^ string_of_int self.state.count ^ " times(s)"; <div> <MyDialog onClick=(self.reduce (fun _event => Click)) onSubmit=(self.reduce (fun _event => Toggle)) /> (ReasonReact.stringToElement message) </div> } }; Reducer component
  • 24. will (would) be amazing Tooling
  • 25. ality CONS : Still young Little community (but growing) A functional language learning curve for JS devs No native packages management (hot topic) Poor documentation Bucklescript targets ES5 while node.js is ES8 VS babel-preset-env Breaking change version is coming next month PROS : Battle tested type system with inference : OCaml under the hood
 Kind community Really good samples Production ready (used for messenger.com)
 Reason-react with reducer components First Reason React Native app published in stores last month (https://github.com/FormidableLabs/seattlejsconf-app) Facebook baked May be adopt baby-step (one node module, one react component, …)
  • 26. ason to be confident Why ? Reason’s design fit our problems Do we have a great community ? Almost … we have a discord Yes and great toolingDo we have a great language ?
  • 27.
  • 28. ad More ReTwit @reasonml @jordwalke (react & reason creator) @_chenglou (react team / reason evangelist) @sgrove (reason evangelist) @bobzhang1988 (bucklescript creator) @ken_wheeler (Director of Open Source @FormidableLabs) ReSpond
 https://discordapp.com/invite/reasonml https://www.reddit.com/r/reasonml/ ReSources https://reasonml.github.io/ https://github.com/vramana/awesome-reasonml https://github.com/bucklescript
  • 29. gards on Youtube Sean Grove - Everything appends with a Reason : https://youtu.be/tB705w4w6H0 Jake Trent - TDD a ReasonML Function : https://youtu.be/nivVNJPj2z8 Cheng Lou - Imperfection : https://youtu.be/tCVXp6gFD8o