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
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
140
メールのエイリアス機能を履き違えない
isshinfunada
0
230
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
460
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
260
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
670
5分で問診!Composer セキュリティ健康診断
codmoninc
0
910
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
180
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
160
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
210
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
210
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.4k
プロポーザルを書いてもらう
pvcresin
0
290
Featured
See All Featured
Design in an AI World
tapps
1
280
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Navigating Team Friction
lara
192
16k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
260
A better future with KSS
kneath
240
18k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
390
4 Signs Your Business is Dying
shpigford
187
22k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Prompt Engineering for Job Search
mfonobong
0
400
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
440
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