SlideShare a Scribd company logo
INTRODUCTION TO ELM
WHAT IS ELM?
2
•4 years old language
•Compile to JS
•Front-end focus
•Simplicity focus
•FRP focus
CHARACTERISTICS
3
•Functional
•ML syntax
•Immutability
•Pure functions
•Strong type system, but:
•No typeclasses
•No higher kinded types
•Functional reactive programming
4
DO I REALLY NEED TO LEARN

A NEW LANGUAGE?



LET’S JUST USE JAVASCRIPT!
5
Elm
JS ES6 + Babel + Webpack + React + Redux + Immutable
or
Typescript
or
Brunch
or
Gulp
or
Grunt
or
Cycle.js + RxJS
or
seamless-

immutableNot even close
6
ELM MAKE
The compiler that talks to you
7
8
9
NO RUNTIME EXCEPTIONS
10
NO RUNTIME EXCEPTIONS
11
12
A LITTLE MORE OBVIOUS SYNTAX
-- isNotEven = not . isEven
isNotEven = not << isEven
isNotEven' = isEven >> not
-- let lastChar = head $ toList $ reverse "foobar"
let lastChar = head <| toList <| reverse "foobar"
dot =
scale 2 (move (20,20) (filled blue (circle 10)))
dot' =
circle 10
|> filled blue
|> move (20,20)
|> scale 2
13
RECORDS
carolina =
{ name = "Carolina de Jesus"
, age = 62
}
abdias =
{ name = "Abdias Nascimento"
, age = 97
}
people =
[ carolina
, abdias
]
carolina.name
.name carolina
List.map .name people
-- ["Carolina de Jesus", "Abdias Nascimento"]
14
ELM REPL
Just a regular REPL
15
16
17
ELM PACKAGE
The best package manager ever
18
ENFORCED SEMVER
19
ENFORCED SEMVER
20
AUTOMATIC CHANGELOG
21
ENFORCED DOCS
22
ELM REACTOR
Awesome development flow
ELM REACTOR
23
•Auto compile Elm
•Hot-swapping
•Time travel debugging
24
EXAMPLE
http://debug.elm-lang.org/edit/Mario.elm
25
THE ELM
ARCHITECTURE
26
SIGNALS
import Graphics.Element exposing (..)
import Mouse
main : Signal Element
main =
Signal.map show Mouse.position
27
Update
Model
Viewaction
signal mailbox
28
talk is cheap, show me the code
29
module	Counter	where	
import	Html	exposing	(..)	
import	Html.Attributes	exposing	(style)	
import	Html.Events	exposing	(onClick)	
--	MODEL	
type	alias	Model	=	Int	
--	UPDATE	
type	Action	=	Increment	|	Decrement	
update	:	Action	->	Model	->	Model	
update	action	model	=	
COUNTER.ELM
--	UPDATE	
type	Action	=	Increment	|	Decrement	
update	:	Action	->	Model	->	Model	
update	action	model	=	
		case	action	of	
				Increment	->	
						model	+	1	
				Decrement	->	
						model	-	1	
--	VIEW	
view	:	Signal.Address	Action	->	Model	->	Html	
view	address	model	=	
		div	[]	
				[	button	[	onClick	address	Decrement	]	[	text	"-"	]	
				,	div	[	countStyle	]	[	text	(toString	model)	]	 30
COUNTER.ELM
--	VIEW	
view	:	Signal.Address	Action	->	Model	->	Html	
view	address	model	=	
		div	[]	
				[	button	[	onClick	address	Decrement	]	[	text	"-"	]	
				,	div	[	countStyle	]	[	text	(toString	model)	]	
				,	button	[	onClick	address	Increment	]	[	text	"+"	]	
				]	
countStyle	:	Attribute	
countStyle	=	
		style	
				[	("font-size",	"20px")	
				,	("font-family",	"monospace")	
				,	("display",	"inline-block")	
				,	("width",	"50px")	
				,	("text-align",	"center")	
				]	
31
COUNTER.ELM
32
MAIN.ELM
import	Counter	exposing	(update,	view)	
import	StartApp.Simple	exposing	(start)	
main	=	
		start	
				{	model	=	0	
				,	update	=	update	
				,	view	=	view	
				}	
http://evancz.github.io/elm-architecture-tutorial/examples/1
33
side-effects
34
EFFECTS
type Action
= RequestMore
| NewGif (Maybe String)
update : Action -> Model -> (Model, Effects Action)
update action model =
case action of
RequestMore ->
(model, getRandomGif model.topic)
NewGif maybeUrl ->
( Model model.topic (Maybe.withDefault model.gifUrl maybeUrl)
, Effects.none
)
35
TASKS
getRandomGif : String -> Effects Action
getRandomGif topic =
Http.get decodeUrl (randomUrl topic)
|> Task.toMaybe
|> Task.map NewGif
|> Effects.task
randomUrl : String -> String
randomUrl topic =
Http.url "http://api.giphy.com/v1/gifs/random"
[ "api_key" => "dc6zaTOxFJmzC"
, "tag" => topic
]
36
invention or discovery?
37
try to escape the Elm Architecture,

I dare you!
38
TESTS
Only for checking what the compiler can’t
39
ELM TEST
module Example where
import ElmTest exposing (..)
tests : Test
tests =
suite "A Test Suite"
[ test "Addition" <|
assertEqual (3 + 7) 10
, test "This test should fail" <|
assert False
]
40
ELM TEST BDD STYLE
module Example where
import ElmTestBDDStyle exposing (..)
tests : Test
tests =
describe "A Test Suite"
[ it "adds two numbers" <|
expect (3 + 7) toBe 10
, it "fails for non-sense stuff" <|
expect True toBe False
]
41
PROPERTY-BASED TESTING
module Example where
import ElmTestBDDStyle exposing (..)
import Check.Investigator exposing (..)
tests : Test
tests =
describe "A Test Suite"
[ it "adds two numbers" <|
expect (3 + 7) toBe 10
, it "fails for non-sense stuff" <|
expect True toBe False
, itAlways "ends up with the same list when reversing twice" <|
expectThat
(list -> List.reverse (List.reverse list))
isTheSameAs
(identity)
forEvery
(list int)
]
42
JS
JAVASCRIPT
INTEROP
Avoid it at all costs
43
FROM JS TO ELM
port addUser : Signal (String, UserRecord)
myapp.ports.addUser.send([
"Tom",
{ age: 32, job: "lumberjack" }
]);
myapp.ports.addUser.send([
"Sue",
{ age: 37, job: "accountant" }
]);
JS
44
FROM ELM TO JS
port requestUser : Signal String
port requestUser =
signalOfUsersWeWantMoreInfoOn
myapp.ports.requestUser.subscribe(databaseLookup);
function databaseLookup(user) {
var userInfo = database.lookup(user);
myapp.ports.addUser.send(user, userInfo);
}
JS
45
NATIVE JS INTEROP
DON’T USE THIS
THANK YOU

More Related Content

What's hot (20)

PPTX
Software Engineering unit 3
Abhimanyu Mishra
 
PDF
Analiza TestLink - narzędzie do zarzadzania testowaniem
Radoslaw Smilgin
 
DOC
Course file for theory of computation dt 08 08-2016.
sumit jain
 
PDF
GPU - An Introduction
Dhan V Sagar
 
PDF
Dataflow Analysis
Miller Lee
 
PPTX
Software Engineering concept
Atamjitsingh92
 
PPT
Software resuse
Indu Sharma Bhardwaj
 
PPTX
Multistage graph unit 4 of algorithm.ppt
VidulaVinothkumar
 
PPTX
Engenharia de Software II - Teste de segurança de software
Juliano Padilha
 
PPT
lecture4 raster details in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
Ecologia di Powerpoint e dei suoi simili
Sergio Gridelli
 
PPT
Unit1
anuragmbst
 
PPTX
Usabilidade Aula-05. Processos: heuristicas
Alan Vasconcelos
 
PPTX
Rational Unified Process (RUP)
Carlos Henrique Martins da Silva
 
PDF
Software management disciplines
Kuppusamy P
 
PPT
Software Testing Strategies
NayyabMirTahir
 
PPTX
Monkey & banana problem in AI
Manjeet Kamboj
 
PDF
Introduction to spaCy
Ryo Takahashi
 
PDF
Daa notes 3
smruti sarangi
 
PPT
Computer graphics
katherineschuster
 
Software Engineering unit 3
Abhimanyu Mishra
 
Analiza TestLink - narzędzie do zarzadzania testowaniem
Radoslaw Smilgin
 
Course file for theory of computation dt 08 08-2016.
sumit jain
 
GPU - An Introduction
Dhan V Sagar
 
Dataflow Analysis
Miller Lee
 
Software Engineering concept
Atamjitsingh92
 
Software resuse
Indu Sharma Bhardwaj
 
Multistage graph unit 4 of algorithm.ppt
VidulaVinothkumar
 
Engenharia de Software II - Teste de segurança de software
Juliano Padilha
 
lecture4 raster details in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Ecologia di Powerpoint e dei suoi simili
Sergio Gridelli
 
Unit1
anuragmbst
 
Usabilidade Aula-05. Processos: heuristicas
Alan Vasconcelos
 
Rational Unified Process (RUP)
Carlos Henrique Martins da Silva
 
Software management disciplines
Kuppusamy P
 
Software Testing Strategies
NayyabMirTahir
 
Monkey & banana problem in AI
Manjeet Kamboj
 
Introduction to spaCy
Ryo Takahashi
 
Daa notes 3
smruti sarangi
 
Computer graphics
katherineschuster
 

Viewers also liked (20)

PDF
Rethink Frontend Development With Elm
Brian Hogan
 
PDF
Self-testing Code
Rogerio Chaves
 
PPTX
ELM Presentation 2016
Adriana Bell
 
PDF
ELM: Extreme Learning Machine: Learning without iterative tuning
zukun
 
PDF
Functional Web Development using Elm
💻 Spencer Schneidenbach
 
PPTX
Extreme learning machine:Theory and applications
James Chou
 
PDF
Single State Atom apps
Rogerio Chaves
 
PDF
Application of the extreme learning machine algorithm for the
mehmet şahin
 
PDF
Elm presentation
Marta Marecka
 
PDF
Claudia Doppioslash - Time Travel for game development with Elm
Codemotion
 
PDF
Elm a possible future for web frontend
Gaetano Contaldi
 
PDF
Elm: frontend code without runtime exceptions
Pietro Grandi
 
ODP
Very basic functional design patterns
Tomasz Kowal
 
ODP
Elixir and elm - the perfect couple
Tomasz Kowal
 
PDF
Elm: delightful web development
Amir Barylko
 
PDF
Collaborative music with elm and phoenix
Josh Adams
 
PPTX
Machine Learning : comparing neural network methods
Nichochar
 
PDF
Nodejs - A quick tour (v6)
Felix Geisendörfer
 
PDF
React redux
Michel Perez
 
Rethink Frontend Development With Elm
Brian Hogan
 
Self-testing Code
Rogerio Chaves
 
ELM Presentation 2016
Adriana Bell
 
ELM: Extreme Learning Machine: Learning without iterative tuning
zukun
 
Functional Web Development using Elm
💻 Spencer Schneidenbach
 
Extreme learning machine:Theory and applications
James Chou
 
Single State Atom apps
Rogerio Chaves
 
Application of the extreme learning machine algorithm for the
mehmet şahin
 
Elm presentation
Marta Marecka
 
Claudia Doppioslash - Time Travel for game development with Elm
Codemotion
 
Elm a possible future for web frontend
Gaetano Contaldi
 
Elm: frontend code without runtime exceptions
Pietro Grandi
 
Very basic functional design patterns
Tomasz Kowal
 
Elixir and elm - the perfect couple
Tomasz Kowal
 
Elm: delightful web development
Amir Barylko
 
Collaborative music with elm and phoenix
Josh Adams
 
Machine Learning : comparing neural network methods
Nichochar
 
Nodejs - A quick tour (v6)
Felix Geisendörfer
 
React redux
Michel Perez
 
Ad

Similar to Introduction to Elm (20)

PDF
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Codemotion
 
PDF
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Codemotion
 
PPTX
Sprouting into the world of Elm
Mike Onslow
 
PPTX
Elm Detroit 9/7/17 - Planting Seeds with Elm
Elm Detroit
 
PPTX
SEMjs - Planting Seeds with Elm
Mike Onslow
 
PDF
Play with Elm!
Paris Scala User Group
 
PDF
Elm @ DublinJS
Michael Twomey
 
PDF
Rethink Frontend Development With Elm
Brian Hogan
 
PDF
Elm dev front-end
Helder Pinto
 
PPTX
Your first Elm program
Per Lundholm
 
PDF
Conf 2018 Track 2 - Try Elm
TechExeter
 
PDF
Play with elm - Choucri fahed, Finstack - Lambadays
Finstack
 
PDF
A proper introduction to Elm
Johannes Ridderstedt
 
PDF
NodeJS The edge of Reason - Lille fp#6
Thomas Haessle
 
PDF
What About Elm?
Scott Smith
 
PDF
Forward JS 2017 | SF | Write applications as State Machines
Pasindu Perera
 
PDF
Introduction to elm
Amornthip Rakkwamsook
 
PPTX
Make Yourself a Happy Front-end Web Developer with Elm.
Froyo Framework
 
PPTX
Elm: Make Yourself A Happy Front-end Web Developer
Asep Bagja
 
Beyond JavaScript Frameworks: Writing Reliable Web Apps With Elm - Erik Wende...
Codemotion
 
Erik Wendel - Beyond JavaScript Frameworks: Writing Reliable Web Apps With El...
Codemotion
 
Sprouting into the world of Elm
Mike Onslow
 
Elm Detroit 9/7/17 - Planting Seeds with Elm
Elm Detroit
 
SEMjs - Planting Seeds with Elm
Mike Onslow
 
Play with Elm!
Paris Scala User Group
 
Elm @ DublinJS
Michael Twomey
 
Rethink Frontend Development With Elm
Brian Hogan
 
Elm dev front-end
Helder Pinto
 
Your first Elm program
Per Lundholm
 
Conf 2018 Track 2 - Try Elm
TechExeter
 
Play with elm - Choucri fahed, Finstack - Lambadays
Finstack
 
A proper introduction to Elm
Johannes Ridderstedt
 
NodeJS The edge of Reason - Lille fp#6
Thomas Haessle
 
What About Elm?
Scott Smith
 
Forward JS 2017 | SF | Write applications as State Machines
Pasindu Perera
 
Introduction to elm
Amornthip Rakkwamsook
 
Make Yourself a Happy Front-end Web Developer with Elm.
Froyo Framework
 
Elm: Make Yourself A Happy Front-end Web Developer
Asep Bagja
 
Ad

More from Rogerio Chaves (6)

PDF
Playing with RxJS
Rogerio Chaves
 
PDF
Continuous Delivery with JavaScript
Rogerio Chaves
 
PDF
Desenvolvimento de uma Aplicação para Utilização de Algoritmos Multi-Armed Ba...
Rogerio Chaves
 
PDF
Marketing Digital
Rogerio Chaves
 
PPT
O poder do JavaScript
Rogerio Chaves
 
PPT
Desenvolvimento Ágil com Ruby on Rails
Rogerio Chaves
 
Playing with RxJS
Rogerio Chaves
 
Continuous Delivery with JavaScript
Rogerio Chaves
 
Desenvolvimento de uma Aplicação para Utilização de Algoritmos Multi-Armed Ba...
Rogerio Chaves
 
Marketing Digital
Rogerio Chaves
 
O poder do JavaScript
Rogerio Chaves
 
Desenvolvimento Ágil com Ruby on Rails
Rogerio Chaves
 

Recently uploaded (20)

PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
MiniTool Power Data Recovery 8.8 With Crack New Latest 2025
bashirkhan333g
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 

Introduction to Elm