SlideShare una empresa de Scribd logo
1 de 44
Descargar para leer sin conexión
delightful web
development
elm
HTML and JS
(so far)
IT’S A FREAKING
MESS!
The ELM
language
Open source
elm-lang.org
Haskell inspired
(and built with)
Functional
Simple
www.elm-tutorial.org
Transpiler
ES3
Web Assembly
Functions
add : Int -> Int -> Int

add x y = 

x + y
Partial Application
add2 = add 2

add2 3 -- result 5
Pipe Operator
3

|> multiply 2

|> add 1
Type Variables
switch : ( a, b ) -> ( b, a )

switch ( x, y ) =

( y, x )
Union types
type Answer 

= Yes 

| No 

| Other String



type Resource res 

= Loading 

| Loaded res
Type Aliases
type alias CustomerId = Int



type alias Email = String
Records
{ id : Int, name : String}



type alias Player = 

{ id : Int 

, name : String

}



label: Player -> String
Packages
http://package.elm-lang.org/
elm-lang/core
elm
packages
Maybe
type Maybe a

= Just a

| Nothing



withDefault : a -> Maybe a -> a



map : (a -> b) -> Maybe a -> Maybe b
List
length : List a -> Int

head : List a -> Maybe a

tail : List a -> Maybe (List a

filter : (a -> Bool) -> List a

take : Int -> List a -> List a

drop : Int -> List a -> List a
Result
type Result error value

= Ok value

| Err error


map : (a -> value) -> Result x a -> Result x value

andThen : Result x a -> (a -> Result x b) -> Result x b
elm-lang/html
elm
packages
Html
text : String -> Html msg

node: String

-> List (Attribute msg)

-> List (Html msg)

-> Html msg

type alias Html msg = Node msg

type alias Attribute msg = Property msg
Markup
h1 : List (Attribute msg) -> List (Html msg) -> Html msg

h2 : List (Attribute msg) -> List (Html msg) -> Html msg



div : List (Attribute msg) -> List (Html msg) -> Html msg

p : List (Attribute msg) -> List (Html msg) -> Html msg

hr : List (Attribute msg) -> List (Html msg) -> Html msg



span : List (Attribute msg) -> List (Html msg) -> Html msg

a : List (Attribute msg) -> List (Html msg) -> Html msg
Small Example
main =

ul [class "grocery-list"]

[ li [] [text "Pamplemousse"]

, li [] [text "Ananas"]

, li [] [text "Jus d'orange"]

, li [] [text "Boeuf"]

, li [] [text "Soupe du jour"]

, li [] [text "Camembert"]

, li [] [text "Jacques Cousteau"]

, li [] [text "Baguette"]

]
•Pamplemousse
•Ananas
•Jus d'orange
•Boeuf
•Soupe du jour
•Camembert
•Jacques Cousteau
•Baguette
The ELM
architecture
Model
type alias Model =

String





init : ( Model, Cmd Msg )

init =

( "Hello", Cmd.none )
Messages
type Msg

= PostToSlack

| FetchSponsors

| NoOp
View
view : Model -> Html Msg

view model =

div []

[ text model ]
Update
update : Msg -> Model -> ( Model, Cmd Msg )

update msg model =

case msg of
PostToSlack -> Api.sendPost model.email
NoOp -> ( model, Cmd.none )
Subscriptions
subscriptions : Model -> Sub Msg

subscriptions model =

Sub.none
Main
main : Program Never

main =

Html.App.program

{ init = init

, view = view

, update = update

, subscriptions = subscriptions

}
Expand sample Flow
Examples
Drawbacks
In flux (lightly)
Learn a language
Api still growing
THANK YOU!
amir@barylko.com
@abarylko
http://bit.ly/abarylkoslides
http://orthocoders.com
http://westerndevs.com

Más contenido relacionado

La actualidad más candente

Add text on image by karan chanana
Add text on image by karan chananaAdd text on image by karan chanana
Add text on image by karan chanana
karan chanana
 

La actualidad más candente (17)

Internal DSLs Scala
Internal DSLs ScalaInternal DSLs Scala
Internal DSLs Scala
 
Intro to F#
Intro to F#Intro to F#
Intro to F#
 
Scala Quick Introduction
Scala Quick IntroductionScala Quick Introduction
Scala Quick Introduction
 
Funcitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional WayFuncitonal Swift Conference: The Functional Way
Funcitonal Swift Conference: The Functional Way
 
Class 8 - Database Programming
Class 8 - Database ProgrammingClass 8 - Database Programming
Class 8 - Database Programming
 
Dropdown List in PHP
Dropdown List in PHPDropdown List in PHP
Dropdown List in PHP
 
6. Php MongoDB adaugarea unui document
6. Php MongoDB adaugarea unui document6. Php MongoDB adaugarea unui document
6. Php MongoDB adaugarea unui document
 
Add text on image by karan chanana
Add text on image by karan chananaAdd text on image by karan chanana
Add text on image by karan chanana
 
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabadpreventing sqli and xss by ravi rajput in owasp meet ahmedabad
preventing sqli and xss by ravi rajput in owasp meet ahmedabad
 
Html5 appunti.0
Html5   appunti.0Html5   appunti.0
Html5 appunti.0
 
Modern Perl
Modern PerlModern Perl
Modern Perl
 
Js lw melbourne
Js lw melbourneJs lw melbourne
Js lw melbourne
 
Quick beginner to Lower-Advanced guide/tutorial in PHP
Quick beginner to Lower-Advanced guide/tutorial in PHPQuick beginner to Lower-Advanced guide/tutorial in PHP
Quick beginner to Lower-Advanced guide/tutorial in PHP
 
CSS for developers
CSS for developersCSS for developers
CSS for developers
 
Php workshop L03 superglobals
Php workshop L03 superglobalsPhp workshop L03 superglobals
Php workshop L03 superglobals
 
Web 10 | PHP with MySQL
Web 10 | PHP with MySQLWeb 10 | PHP with MySQL
Web 10 | PHP with MySQL
 
7. Php MongoDB editarea unui document
7. Php MongoDB editarea unui document7. Php MongoDB editarea unui document
7. Php MongoDB editarea unui document
 

Destacado

track1 05. 스타트업 1인 개발 극복기’와 ‘javascript vs Scala, (함수형 언어 관점으로)방황기/ I/O Inc, ...
track1 05. 스타트업 1인 개발 극복기’와 ‘javascript vs Scala, (함수형 언어 관점으로)방황기/ I/O Inc, ...track1 05. 스타트업 1인 개발 극복기’와 ‘javascript vs Scala, (함수형 언어 관점으로)방황기/ I/O Inc, ...
track1 05. 스타트업 1인 개발 극복기’와 ‘javascript vs Scala, (함수형 언어 관점으로)방황기/ I/O Inc, ...
양 한빛
 

Destacado (16)

Functional Web Development using Elm
Functional Web Development using ElmFunctional Web Development using Elm
Functional Web Development using Elm
 
Elm a possible future for web frontend
Elm   a possible future for web frontendElm   a possible future for web frontend
Elm a possible future for web frontend
 
Claudia Doppioslash - Time Travel for game development with Elm
Claudia Doppioslash - Time Travel for game development with ElmClaudia Doppioslash - Time Travel for game development with Elm
Claudia Doppioslash - Time Travel for game development with Elm
 
Elm: frontend code without runtime exceptions
Elm: frontend code without runtime exceptionsElm: frontend code without runtime exceptions
Elm: frontend code without runtime exceptions
 
Very basic functional design patterns
Very basic functional design patternsVery basic functional design patterns
Very basic functional design patterns
 
Elixir and elm - the perfect couple
Elixir and elm - the perfect coupleElixir and elm - the perfect couple
Elixir and elm - the perfect couple
 
Flask! - python web framework flask 튜토리얼
Flask! - python web framework flask 튜토리얼Flask! - python web framework flask 튜토리얼
Flask! - python web framework flask 튜토리얼
 
Play with Elm!
Play with Elm!Play with Elm!
Play with Elm!
 
Rethink Frontend Development With Elm
Rethink Frontend Development With ElmRethink Frontend Development With Elm
Rethink Frontend Development With Elm
 
Elm: Make Yourself A Happy Front-end Web Developer
Elm: Make Yourself A Happy Front-end Web DeveloperElm: Make Yourself A Happy Front-end Web Developer
Elm: Make Yourself A Happy Front-end Web Developer
 
track1 05. 스타트업 1인 개발 극복기’와 ‘javascript vs Scala, (함수형 언어 관점으로)방황기/ I/O Inc, ...
track1 05. 스타트업 1인 개발 극복기’와 ‘javascript vs Scala, (함수형 언어 관점으로)방황기/ I/O Inc, ...track1 05. 스타트업 1인 개발 극복기’와 ‘javascript vs Scala, (함수형 언어 관점으로)방황기/ I/O Inc, ...
track1 05. 스타트업 1인 개발 극복기’와 ‘javascript vs Scala, (함수형 언어 관점으로)방황기/ I/O Inc, ...
 
플라스크 템플릿
플라스크 템플릿플라스크 템플릿
플라스크 템플릿
 
A recommendation engine for your applications - M.Orselli - Codemotion Rome 17
A recommendation engine for your applications - M.Orselli - Codemotion Rome 17A recommendation engine for your applications - M.Orselli - Codemotion Rome 17
A recommendation engine for your applications - M.Orselli - Codemotion Rome 17
 
파이썬 플라스크 이해하기
파이썬 플라스크 이해하기 파이썬 플라스크 이해하기
파이썬 플라스크 이해하기
 
Self-testing Code
Self-testing CodeSelf-testing Code
Self-testing Code
 
Introduction to Elm
Introduction to ElmIntroduction to Elm
Introduction to Elm
 

Similar a Elm: delightful web development

Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
Loïc Descotte
 
Pragmatic Real-World Scala
Pragmatic Real-World ScalaPragmatic Real-World Scala
Pragmatic Real-World Scala
parag978978
 
仕事で使うF#
仕事で使うF#仕事で使うF#
仕事で使うF#
bleis tift
 
Model-Driven Software Development - Static Analysis & Error Checking
Model-Driven Software Development - Static Analysis & Error CheckingModel-Driven Software Development - Static Analysis & Error Checking
Model-Driven Software Development - Static Analysis & Error Checking
Eelco Visser
 

Similar a Elm: delightful web development (20)

Python-The programming Language
Python-The programming LanguagePython-The programming Language
Python-The programming Language
 
PureScript & Pux
PureScript & PuxPureScript & Pux
PureScript & Pux
 
Elm introduction
Elm   introductionElm   introduction
Elm introduction
 
Grammarware Memes
Grammarware MemesGrammarware Memes
Grammarware Memes
 
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Metasepi team meeting #17: Invariant captured by ATS's API
Metasepi team meeting #17: Invariant captured by ATS's APIMetasepi team meeting #17: Invariant captured by ATS's API
Metasepi team meeting #17: Invariant captured by ATS's API
 
Python course Day 1
Python course Day 1Python course Day 1
Python course Day 1
 
Swift Rocks #2: Going functional
Swift Rocks #2: Going functionalSwift Rocks #2: Going functional
Swift Rocks #2: Going functional
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Introduction to python programming 1
Introduction to python programming   1Introduction to python programming   1
Introduction to python programming 1
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
Pragmatic Real-World Scala
Pragmatic Real-World ScalaPragmatic Real-World Scala
Pragmatic Real-World Scala
 
C# programming
C# programming C# programming
C# programming
 
仕事で使うF#
仕事で使うF#仕事で使うF#
仕事で使うF#
 
Model-Driven Software Development - Static Analysis & Error Checking
Model-Driven Software Development - Static Analysis & Error CheckingModel-Driven Software Development - Static Analysis & Error Checking
Model-Driven Software Development - Static Analysis & Error Checking
 
An Introduction to Functional Programming using Haskell
An Introduction to Functional Programming using HaskellAn Introduction to Functional Programming using Haskell
An Introduction to Functional Programming using Haskell
 
Elm kyivfprog 2015
Elm kyivfprog 2015Elm kyivfprog 2015
Elm kyivfprog 2015
 
The Ring programming language version 1.3 book - Part 14 of 88
The Ring programming language version 1.3 book - Part 14 of 88The Ring programming language version 1.3 book - Part 14 of 88
The Ring programming language version 1.3 book - Part 14 of 88
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummies
 

Más de Amir Barylko

Beutiful javascript with coffeescript
Beutiful javascript with coffeescriptBeutiful javascript with coffeescript
Beutiful javascript with coffeescript
Amir Barylko
 
Rich UI with Knockout.js & Coffeescript
Rich UI with Knockout.js & CoffeescriptRich UI with Knockout.js & Coffeescript
Rich UI with Knockout.js & Coffeescript
Amir Barylko
 

Más de Amir Barylko (20)

Functional converter project
Functional converter projectFunctional converter project
Functional converter project
 
Dot Net Core
Dot Net CoreDot Net Core
Dot Net Core
 
No estimates
No estimatesNo estimates
No estimates
 
User stories deep dive
User stories deep diveUser stories deep dive
User stories deep dive
 
Coderetreat hosting training
Coderetreat hosting trainingCoderetreat hosting training
Coderetreat hosting training
 
There's no charge for (functional) awesomeness
There's no charge for (functional) awesomenessThere's no charge for (functional) awesomeness
There's no charge for (functional) awesomeness
 
What's new in c# 6
What's new in c# 6What's new in c# 6
What's new in c# 6
 
Productive teams
Productive teamsProductive teams
Productive teams
 
Who killed object oriented design?
Who killed object oriented design?Who killed object oriented design?
Who killed object oriented design?
 
From coach to owner - What I learned from the other side
From coach to owner - What I learned from the other sideFrom coach to owner - What I learned from the other side
From coach to owner - What I learned from the other side
 
Communication is the Key to Teamwork and productivity
Communication is the Key to Teamwork and productivityCommunication is the Key to Teamwork and productivity
Communication is the Key to Teamwork and productivity
 
Acceptance Test Driven Development
Acceptance Test Driven DevelopmentAcceptance Test Driven Development
Acceptance Test Driven Development
 
Refactoring
RefactoringRefactoring
Refactoring
 
Agile requirements
Agile requirementsAgile requirements
Agile requirements
 
Agile teams and responsibilities
Agile teams and responsibilitiesAgile teams and responsibilities
Agile teams and responsibilities
 
Refactoring
RefactoringRefactoring
Refactoring
 
Beutiful javascript with coffeescript
Beutiful javascript with coffeescriptBeutiful javascript with coffeescript
Beutiful javascript with coffeescript
 
Sass & bootstrap
Sass & bootstrapSass & bootstrap
Sass & bootstrap
 
Rich UI with Knockout.js & Coffeescript
Rich UI with Knockout.js & CoffeescriptRich UI with Knockout.js & Coffeescript
Rich UI with Knockout.js & Coffeescript
 
Agile requirements
Agile requirementsAgile requirements
Agile requirements
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Elm: delightful web development