Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ReasonML - Front in Vale 2018
Search
Ana Luiza Portello
August 11, 2018
Programming
340
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ReasonML - Front in Vale 2018
Ana Luiza Portello
August 11, 2018
More Decks by Ana Luiza Portello
See All by Ana Luiza Portello
Clojure BR - Brazilian Utils: Simplificando o caos brasileiro com Clojure em uma biblioteca open source
anabastos
0
31
FRONTIN | Elas Programam - Programação Funcional no Front-end
anabastos
0
140
Workshop JSFP - SEMCOMP 2021
anabastos
0
320
Clojure é um Java melhor que Java - Codecon 2021
anabastos
0
180
Clojure 101 - Criciuma Dev
anabastos
0
370
TDC POA - GraphQL
anabastos
1
310
TDC Porto Alegre 2019 - JS Funcional com Ramda
anabastos
0
290
BackEndSP - GraphQL
anabastos
0
270
Git & Github - RLadies
anabastos
1
280
Other Decks in Programming
See All in Programming
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
190
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
210
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
220
テーブルをDELETEした
yuzneri
0
140
5分で問診!Composer セキュリティ健康診断
codmoninc
0
910
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
300
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
450
継続モナドとリアクティブプログラミング
yukikurage
3
700
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
160
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
220
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
4.1k
Featured
See All Featured
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
200
Ethics towards AI in product and experience design
skipperchong
2
340
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.5k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
440
Designing for Timeless Needs
cassininazir
1
430
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Building an army of robots
kneath
306
46k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
330
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
160
Designing Powerful Visuals for Engaging Learning
tmiket
1
480
Transcript
ANA LUIZA BASTOS github.com/anabastos @naluhh @anapbastos Software Developer na Quanto
e cientista da computação na PUC-SP anabastos.me
JSLADIES fb.com/jsladiesbr twitter.com/jsladiessp meetup.com/JsLadies-BR/ LAMBDA.IO t.me/lambdastudygroup github.com/lambda-study-group/ meetup.com/Lambda-I-O-Sampa- Meetup/
None
JAVASCRIPT
Javascript foi pensado em 10 dias pelo Brendan Eich em
1995 para fazer sites interativos
None
None
None
None
Linguagens que compilam JS são os novos frameworks JS.
• Mudar de um ecossistema para outro. • Necessidade de
reescrever o projeto do 0. • Problemas com Interop. • Maioria das tools e frameworks são para o JS.
O que é ReasonML?
Mantida e usada pelo Facebook Se tornou open source em
2016 Criado pelo Jordan Walke (criador do React) Sintaxe em cima do OCaml e inspirada em JavaScript
Mesmo ecossistema e workflow
“it's a new syntax and toolchain for Ocaml.”
O que é OCaml?
Linguagem da familia ML(SML, OCaml, Haskell) Conhecido pela sua mantenabilidade
Décadas de pesquisa em sistemas de tipos e engenharia de compiladores tops
O que é ser uma nova syntax pra OCaml?
WORKFLOW OCAML
Ocaml AST OCAMLOPT Syntax OCaml(.ml) OCAMLC NativeCode ByteCode BUCKLESCRIPT Javascript
None
Ocaml AST Syntax Reason(.re) BUCKLESCRIPT OCAMLOPT Syntax OCaml(.ml) OCAMLC Javascript
NativeCode ByteCode .ml == .re
JAVASCRIPT FRIENDLY
let msg = ”hello world!”; Js.log(msg); // hello world! Hello
World
let add = (a, b) => a + b; Função
math.re
import { add } from “math.re”; add(1, 2) // 3
index.js
ESTRUTURAS DE DADOS IMUTÁVEIS & OTIMIZADAS const
É uma LINGUAGEM ESTATICAMENTE tipada.
String Bool List Float Int Record Tuple Option Unit
Inferencia de Tipos
let add = (a, b) => a + b; Inferencia
de Tipos val add: Int => Int => Int
/* REASON */ let add = (a, b) => a
+ b; /* JS + FLOW / TYPESCRIPT */ const add = (a: number, b: number): number => a + b;
Declaração de Tipos
None
type item = { title: string, completed: boolean, }; type
state = { items: list(item) };
type statusType = ToDo | Doing | Done
Option
null NaN -Infinity “undefined is not a function”
type option('a) = None | Some('a);
Currying & Partial Application (Proposal)
let add = (x, y) => x + y; let
inc = add(1); inc(10); /* 11 */
let multiply = (x, y) => x * y; let
multiplyBy10 = multiply(10); multiplyBy10(10); /* 100 */
Pipeline Operator (Proposal)
let number = 50 number |> inc |> multiplyBy10 /*
510 */ multiplyBy10(inc(50))
Pattern Matching (Proposal)
type color_type = White | Black let colorHex = (color)
=> switch(color) { | White => “#FFFFFF” | Black => “#000000” _ => “#999999” };
Recursão (ES6)
None
ReasonML x ReasonReact
REACT BINDINGS
None
JSX
AMBIENTE
npm install -g bs-platform
create-react-app NOME X bsb -init NOME -theme react
yarn start
None
None
NOME/ README.md node_modules/ public/ favicon.ico index.html src/ index.re index.css app.re
app.css Logo.svg package.json bsconfig.json { "name": <app-name>, "sources": [ "src" ], "bs-dependencies": [ "reason-react", "bs-jest", ], "reason": { "react-jsx": 2 }, "bsc-flags": [ "-bs-super-errors" ], "refmt": 3 } bsconfig.json = package.json + .babelrc + .eslintrc
"scripts": { "build": "bsb -make-world -clean-world", "watch": "bsb -make-world -clean-world
-w" }
Eu vou ter que reescrever tudo?
Adicionar bsconfig.json Buildar com o bucklescript
Já tem as features da ES2030 sem migrar de ecossistema
para outro
Documentação Ocaml caml.inria.fr/pub/docs/manual-ocaml/ Documentação BuckleScript bucklescript.github.io/bucklescript/Manual.html Documentação Reason reasonml.github.io/docs/en/quickstart-javascript.html Documentação
ReasonReact reasonml.github.io/reason-react/docs/en/installation.html Reason Package Index redex.github.io/ Exploring Reason reasonmlhub.com/exploring-reasonml
Comunidade Discord discord.gg/reasonml Twitter twitter.com/reasonml “StackOverFlow” reasonml.chat
OBRIGADA :) speakerdeck.com/anabastos anabastos.me github.com/anabastos @naluhh @anapbastos