Functional and statically typed
programming language for frontend
development
elm
Slide 4
Slide 4 text
Web and UI Focused
Slide 5
Slide 5 text
Compiles to JavaScript
Slide 6
Slide 6 text
No runtime exceptions in
practice.
Slide 7
Slide 7 text
The 2nd argument to function `add` is causing a mismatch.
7| add 2 "3"
^^^
Function `add` is expecting the 2nd argument to be:
Int
But it is:
String
Compile time static type checks
Slide 8
Slide 8 text
Functional
Slide 9
Slide 9 text
Pure Data in
Data out
Slide 10
Slide 10 text
Pure No side
effects
Slide 11
Slide 11 text
Pure Predictable
and Testable!
Slide 12
Slide 12 text
Immutable Data
• Safety and consistency
• Explicit flow of data
• No subtle mutation bugs
Slide 13
Slide 13 text
No undefined is not a
function
Slide 14
Slide 14 text
Fast
Slide 15
Slide 15 text
One framework.
No fatigue.
Update
View
Model
Messages
Slide 16
Slide 16 text
✓ Easier to write code
✓ Easier to write tests
✓ Easier to refactor
Slide 17
Slide 17 text
Content
• Functions and expressions
• Lists, records, and immutability
• Static types and type aliases
• Union types and pattern matching
• Building Apps with the Elm Architecture
Slide 18
Slide 18 text
Format
• Demos via ellie-app.com
• Exercises via ellie-app.com
• Q&A
Slide 19
Slide 19 text
README for demo and exercise URLs:
github.com/jfairbank/elm-workshop
Slide 20
Slide 20 text
Update
View
Model
Messages
The Elm
Architecture
Slide 21
Slide 21 text
Application
State
Model
Slide 22
Slide 22 text
Model
Virtual
DOM
View
UI as a Function
Slide 23
Slide 23 text
elm
Virtual
DOM
Todo List
Learn Elm
Build awesome Elm apps
Learn functional programming
Model:
Todo List
Slide 24
Slide 24 text
×
Todo List
Learn Elm
Build awesome Elm apps
Learn functional programming
User deletes
first todo item
Model:
New Todo
List
Slide 25
Slide 25 text
Todo List
Learn Elm
Build awesome Elm apps
Learn functional programming
View
Model:
New Todo
List
Elm notices missing todo item in virtual DOM list, so it just
removes the corresponding
instead of fully rendering.
elm
Virtual
DOM
×
Slide 26
Slide 26 text
Messages
Standardized
application events
Slide 27
Slide 27 text
elm
app
model
Slide 28
Slide 28 text
elm
app
model
Events
Text Input
Mouse Click
Associate message
with event
Slide 29
Slide 29 text
elm
app
model
Events
Text Input
Mouse Click
When event triggers (i.e.
user clicks), deliver
message
Slide 30
Slide 30 text
Update
Model
New
Model
Respond to messages and
create new state