my adventure with elm (polyconf 16)

46
My adventure with SCORE 42 by Yan Cui ELM

Upload: yan-cui

Post on 18-Jan-2017

2.998 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: My adventure with Elm (polyconf 16)

My adventure with

SCORE 42

by Yan Cui

ELM

Page 2: My adventure with Elm (polyconf 16)

@theburningmonk

Page 3: My adventure with Elm (polyconf 16)

start of my ELM journey

Page 4: My adventure with Elm (polyconf 16)

things have

moved

on…

Page 5: My adventure with Elm (polyconf 16)

The Elm Architecture

Page 6: My adventure with Elm (polyconf 16)

remember Day 1?

Page 7: My adventure with Elm (polyconf 16)
Page 8: My adventure with Elm (polyconf 16)
Page 9: My adventure with Elm (polyconf 16)
Page 10: My adventure with Elm (polyconf 16)
Page 11: My adventure with Elm (polyconf 16)
Page 12: My adventure with Elm (polyconf 16)
Page 13: My adventure with Elm (polyconf 16)

state

Msg

update

init

new state

Page 14: My adventure with Elm (polyconf 16)

- every Erlang programmer

Page 15: My adventure with Elm (polyconf 16)

side-effects!

Page 16: My adventure with Elm (polyconf 16)

state

Msg

update

init

new state

Msg

Page 17: My adventure with Elm (polyconf 16)
Page 18: My adventure with Elm (polyconf 16)

state

Msg

update

init

subscriptions

Msgnew state

Msg

Page 19: My adventure with Elm (polyconf 16)
Page 20: My adventure with Elm (polyconf 16)

state

Msg

update

init

subscriptions

Msgnew state

view

Msg

Page 21: My adventure with Elm (polyconf 16)
Page 22: My adventure with Elm (polyconf 16)

state

Msg

update

init

subscriptions

Msgnew state

view

Msg

Msg

Page 23: My adventure with Elm (polyconf 16)
Page 24: My adventure with Elm (polyconf 16)

state

Msg

update

init

subscriptions

Msgnew state

view

Msg

Msg

Page 25: My adventure with Elm (polyconf 16)
Page 26: My adventure with Elm (polyconf 16)

@theburningmonk

x = { age=42, name=“foo” }

Page 27: My adventure with Elm (polyconf 16)

@theburningmonk

-- clone and updatey = { x | name = "bar" }

Page 28: My adventure with Elm (polyconf 16)

@theburningmonk

type alias Character = { age : Int, name : String }

Page 29: My adventure with Elm (polyconf 16)

@theburningmonk

type Tree = | Leaf| Branch Tree

Page 30: My adventure with Elm (polyconf 16)

@theburningmonk

Demo

Page 31: My adventure with Elm (polyconf 16)
Page 32: My adventure with Elm (polyconf 16)

8 segments

Page 33: My adventure with Elm (polyconf 16)

direction

Page 34: My adventure with Elm (polyconf 16)

change

changeno changenot allowed

directionw

a s d

Page 35: My adventure with Elm (polyconf 16)

direction

Page 36: My adventure with Elm (polyconf 16)

direction

Page 37: My adventure with Elm (polyconf 16)

direction

Page 38: My adventure with Elm (polyconf 16)

direction

Page 39: My adventure with Elm (polyconf 16)

direction

cherry

Page 40: My adventure with Elm (polyconf 16)

direction

YUM YUM YUM!

Page 41: My adventure with Elm (polyconf 16)

direction

+1 segment

Page 42: My adventure with Elm (polyconf 16)

@theburningmonk

Demo

Page 43: My adventure with Elm (polyconf 16)

@theburningmonk

github.com/theburningmonk/elm-snake

Page 44: My adventure with Elm (polyconf 16)

@theburningmonk

elm-lang.org/try

Page 45: My adventure with Elm (polyconf 16)

@theburningmonk

guide.elm-lang.org

Page 46: My adventure with Elm (polyconf 16)

@theburningmonktheburningmonk.comgithub.com/theburningmonk