ELM, THE RUNTIME
ERROR KILLER
50 000 LINES OF ELM CODE
0 RUNTIME EXCEPTIONS
100 000 LINES OF ELM CODE
0 RUNTIME EXCEPTIONS
ELM, THE RUNTIME
ERROR KILLER
What is Elm
The syntax
Type system
Architecture
Tools provided by Elm
repl
reactor
make
package
HELLO ELM!
Syntax
Elm-repl
Types
Currying
BUTTONS
Interactive
Architecture
Elm-Reactor
WEBSOCKETS
More Architecture
Pure Functional
Commands
Subscriptions
WHAT IS ELM?
“Elm is a domain-speci c programming
language for declaratively creating web
browser-based graphical user interfaces.
Elm is purely functional, and is developed
with emphasis on usability, performance,
and robustness.
It advertises "no runtime exceptions in
practice," made possible by the Elm
compiler's static type checking.”
ELM CHARACTERISTICS
Pure Functional language
All functions are curried
Elm is strongly typed
All values are immutable
Elm is fast
HELLO ELM EXAMPLE
function add(x) {
return function (y) {
return x + y;
}
}
add(5)(10) // Returns 15
let addFive = add(5)
addFive(10) // Returns 15
addFive(3) // Returns 8
QUICK RECAP
Elm application starts at the function main
Function application by spaces
Elm does not need "return"
The last part of the function type is the return type
All functions in Elm are curried
Use the repl to play with functions and types
The compiler is your friend
BUTTONS EXAMPLE
program updateview
program updateview
Model
program updateview
program updateview
"User clicks +"
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
program updateview
"User clicks +"
Produces "Increment" message
QUICK RECAP
Elm logic is broken into: Model, view and update
Messages are data
Changes in the model are caused by messages
The elm reactor allows for easy development
WEBSOCKETS EXAMPLE
QUICK RECAP
Elm is pure functional
Cmd: Tell elm "engine" to do something
Sub: Listen to events in the Elm "engine"
WHEN TO USE ELM?
Whenever you can use React / Angular / Ember / Etc
Fullscreen / Just this element
Elm can communicate with javascript
QUICK RECAP ON THE TOOLS
elm-make is the compiler (and your friend)
elm-repl lets you play with elm functions
elm-reactor is a tool for easy development
elm-package to install (and push) elm modules
WHERE TO GO FROM HERE
elm-lang.org
elm-lang.org/try
package.elm-lang.org
play with the elm-repl
(Re)write something in elm!
ADDITIONAL READS
elm-tutorial.org
elm-news.com
Elm slack chat
PLEASE RATE ME ON JOIND.IN
https://joind.in/talk/57ccb
THANK YOU
Elm, the runtime error killer

Elm, the runtime error killer