SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
Elm
http://elm-lang.org/
Mostovenko Alexander
● fullstack engineer in datarobot
● for inspiration: haskell, elm, purescript
● for job: python, javascript
● twitter - https://twitter.com/MostovenkoA
● github - https://github.com/AlexMost
Elm in general
● Functional (ML-like, compiles to js).
● Immutable data structures.
● Statically typed. (ADT, type inference).
● With FRP in mind (Signals are built in language).
● Created for building rich UI apps.
Idea
Why another to-js lang ?
front end devs
front end devs
Haskell
OCaml
F#
...
front end devs
Haskell
OCaml
F#
...
Purescript
Fay
Elm
GHCJS
front end devs
Haskell
OCaml
F#
...
Purescript
Fay
Elm
GHCJS
Elm
The main focus
● Easy to get started.
● Simple and clean syntax.
● Focus on business logic (no frameworks holy wars e.t. c.).
● Simple refactor.
● Simple add features.
● Less bugs in production.
Minimal but powerful syntax
type alias Model = Int
-- UPDATE
type Action = Increment | Decrement
update : Action -> Model -> Model
update action model =
case action of
Increment -> model + 1
Decrement -> model - 1
● Comments
● Literals
● Lists
● Conditionals
● Union Types
● Records
● Functions
● Infix Operators
● Let Expressions
● Applying Functions
● Mapping with (<~) and (~)
● Modules
● Type Annotations
● Type Aliases
● JavaScript FFI
Extensible records
point = { x = 3, y = 4 } -- create a record
point.x -- access field
map .x [point,{x=0,y=0}] -- field access function
{ point - x } -- remove field
{ point | z = 12 } -- add field
{ point - x | z = point.x } -- rename field
{ point - x | x = 6 } -- update field
{ point | x <- 6 } -- nicer way to update a field
{ point | x <- point.x + 1
, y <- point.y + 1 } -- batch update fields
Extensible records
sumCoordinates: {a | x: Int, y: Int} -> Int
sumCoordinates {x, y} = x + y
http://research.microsoft.com/pubs/65409/scopedlabels.pdf
No runtime exceptions
(almost)
let list = [1, 2, 3];
let first = (lst) => lst[0];
let doubleFirst = (lst) => first(list) * 2
list = [1, 2, 3]
first lst = List.get 0 list
doubleFirst lst = (first lst) * 2
js Elm
let list = [1, 2, 3];
let first = (lst) => lst[0];
let doubleFirst = (lst) => first(list) * 2
list = [1, 2, 3]
first lst = List.get 0 list
doubleFirst lst = (first lst) * 2
js Elm
let list = [1, 2, 3];
let first = (lst) => lst[0];
let doubleFirst = (lst) => first(list) * 2
list = [1, 2, 3]
first list = get 0 list
doubleFirst list = case first list of
Just n -> Just (n * 2)
Nothing -> Nothing
js Elm
let list = [1, 2, 3];
let first = (lst) => lst[0];
let doubleFirst = (lst) => first(list) * 2
But it doesn’t fail if []?
NaN
Signals
UI app architecture
● Unidirectional data flow
● Virtual dom
● FRP based approach
The Elm architecture
https://github.com/evancz/elm-architecture-tutorial/
● Model (State)
● Update
● View
Blazing fast rendering
http://evancz.github.io/todomvc-perf-comparison/
Ecosystem
● Package manager
● Packege catalog - http://package.elm-lang.org/
● build tool (elm-make, elm-reactor)
● time travel debugger
● hot swap
Elm package manager
Semantic versioning (1.0.0 - major.minor.patch)
elm-package bump - new version
can see diff - elm-package diff 1.0.1
Time travel debugger
mario demo - http://debug.elm-lang.org/edit/Mario.elm
Unit Testing
https://github.com/deadfoxygrandpa/Elm-Test
Elm exists in production
Demo
2048 - https://github.com/AlexMost/2048
more demos - http://elm-lang.org/examples
:)

Weitere ähnliche Inhalte

Was ist angesagt?

使用.NET构建轻量级分布式框架
使用.NET构建轻量级分布式框架使用.NET构建轻量级分布式框架
使用.NET构建轻量级分布式框架
jeffz
 
Hipster Oriented Programming
Hipster Oriented ProgrammingHipster Oriented Programming
Hipster Oriented Programming
Jens Ravens
 

Was ist angesagt? (20)

Reflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond SmalltakReflection in Pharo: Beyond Smalltak
Reflection in Pharo: Beyond Smalltak
 
使用.NET构建轻量级分布式框架
使用.NET构建轻量级分布式框架使用.NET构建轻量级分布式框架
使用.NET构建轻量级分布式框架
 
Dynamically Composing Collection Operations through Collection Promises
Dynamically Composing Collection Operations through Collection PromisesDynamically Composing Collection Operations through Collection Promises
Dynamically Composing Collection Operations through Collection Promises
 
Building a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGLBuilding a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGL
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Advanced Reflection in Pharo
Advanced Reflection in PharoAdvanced Reflection in Pharo
Advanced Reflection in Pharo
 
Functional Programming In Practice
Functional Programming In PracticeFunctional Programming In Practice
Functional Programming In Practice
 
Hipster oriented programming (Mobilization Lodz 2015)
Hipster oriented programming (Mobilization Lodz 2015)Hipster oriented programming (Mobilization Lodz 2015)
Hipster oriented programming (Mobilization Lodz 2015)
 
Scala - just good for Java shops?
Scala - just good for Java shops?Scala - just good for Java shops?
Scala - just good for Java shops?
 
Scala coated JVM
Scala coated JVMScala coated JVM
Scala coated JVM
 
Kotlin on android
Kotlin on androidKotlin on android
Kotlin on android
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Hipster Oriented Programming
Hipster Oriented ProgrammingHipster Oriented Programming
Hipster Oriented Programming
 
Use the @types, Luke
Use the @types, LukeUse the @types, Luke
Use the @types, Luke
 
2014 java functional
2014 java functional2014 java functional
2014 java functional
 
Introduction to java 8 stream api
Introduction to java 8 stream apiIntroduction to java 8 stream api
Introduction to java 8 stream api
 
What You Need to Know About Lambdas - Jamie Allen (Typesafe)
What You Need to Know About Lambdas - Jamie Allen (Typesafe)What You Need to Know About Lambdas - Jamie Allen (Typesafe)
What You Need to Know About Lambdas - Jamie Allen (Typesafe)
 
Functional Programming for Busy Object Oriented Programmers
Functional Programming for Busy Object Oriented ProgrammersFunctional Programming for Busy Object Oriented Programmers
Functional Programming for Busy Object Oriented Programmers
 
Closures
ClosuresClosures
Closures
 
Scala for rubyists
Scala for rubyistsScala for rubyists
Scala for rubyists
 

Andere mochten auch

Andere mochten auch (7)

Modern javascript localization with c-3po and the good old gettext
Modern javascript localization with c-3po and the good old gettextModern javascript localization with c-3po and the good old gettext
Modern javascript localization with c-3po and the good old gettext
 
rx.js make async programming simpler
rx.js make async programming simplerrx.js make async programming simpler
rx.js make async programming simpler
 
Rxjs kyivjs 2015
Rxjs kyivjs 2015Rxjs kyivjs 2015
Rxjs kyivjs 2015
 
UX metrics
UX metricsUX metrics
UX metrics
 
структура It компании
структура It компанииструктура It компании
структура It компании
 
Agile UX & OOUX
Agile UX & OOUXAgile UX & OOUX
Agile UX & OOUX
 
SlideShare 101
SlideShare 101SlideShare 101
SlideShare 101
 

Ähnlich wie Elm kyivfprog 2015

Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#
Robert Pickering
 
External Language Stored Procedures for MySQL
External Language Stored Procedures for MySQLExternal Language Stored Procedures for MySQL
External Language Stored Procedures for MySQL
Antony T Curtis
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
g3_nittala
 

Ähnlich wie Elm kyivfprog 2015 (20)

C# programming
C# programming C# programming
C# programming
 
sonam Kumari python.ppt
sonam Kumari python.pptsonam Kumari python.ppt
sonam Kumari python.ppt
 
Monads in Swift
Monads in SwiftMonads in Swift
Monads in Swift
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
 
Python 培训讲义
Python 培训讲义Python 培训讲义
Python 培训讲义
 
Writing a compiler in go
Writing a compiler in goWriting a compiler in go
Writing a compiler in go
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Interm codegen
Interm codegenInterm codegen
Interm codegen
 
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
 
Clojure intro
Clojure introClojure intro
Clojure intro
 
Getting started with Clojure
Getting started with ClojureGetting started with Clojure
Getting started with Clojure
 
T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmer
 
Python scripting kick off
Python scripting kick offPython scripting kick off
Python scripting kick off
 
Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#
 
Coding convention
Coding conventionCoding convention
Coding convention
 
The joy of functional programming
The joy of functional programmingThe joy of functional programming
The joy of functional programming
 
External Language Stored Procedures for MySQL
External Language Stored Procedures for MySQLExternal Language Stored Procedures for MySQL
External Language Stored Procedures for MySQL
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
 
2014 holden - databricks umd scala crash course
2014   holden - databricks umd scala crash course2014   holden - databricks umd scala crash course
2014 holden - databricks umd scala crash course
 

Kürzlich hochgeladen

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Kürzlich hochgeladen (20)

WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

Elm kyivfprog 2015