Elm
The best of functional programming in your browser
@luke_dot_js
@luke_dot_js
@luke_dot_js
null
@luke_dot_js
@luke_dot_js
@luke_dot_js
@luke_dot_js
humblespark.com
@luke_dot_js
@luke_dot_js
@lukewestby
@luke
@luke_dot_js
elm-lang.org/install
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.5 <= v < 5.0.0",
"elm-lang/html": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.17.1 <= v < 0.18.0"
}
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
- "."
+ "./src"
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.5 <= v < 5.0.0",
"elm-lang/html": "1.1.0 <= v < 2.0.0"
},
"elm-version": "0.17.1 <= v < 0.18.0"
}
We're ready to write some Elm
Key players in Elm apps
Values in Elm
someInteger : Int
someInteger =
42
someString : String
someString =
"Hello, Abstractions!"
severalStrings : List String
severalStrings =
[ "Hello"
, "Abstractions"
, "!"
]
Functions in Elm
add : Int -> Int -> Int
add left right =
left + right
add42 : Int -> Int
add42 =
add 42
result : Int
result =
add42 10
add : Int -> Int -> Int
add left right =
left + right
Feature Team A
someValue : Int
someValue =
42
result : Int
result =
add 10 someValue
Feature Team B
add : Int -> Int -> Int
add left right =
left + right
Feature Team A
- someValue : Int
- someValue =
- 42
+ someValue : String
+ someValue =
+ "42"
result : Int
result =
add 10 someValue
Feature Team B
- add : Int -> Int -> Int
add left right =
left + right
Feature Team A
- someValue : String
someValue =
"42"
- result : Int
result =
add 10 someValue
Feature Team B
add : Int -> Int -> Int
add left right =
left + right
Feature Team A
- someValue : String
- someValue =
- "42"
+ someValue : Int
+ someValue =
+ 42
result : Int
result =
add 10 someValue
Feature Team B
Structured Data
luke : { name : String, age : Int }
luke =
{ name = "String"
, age = 25
}
Type equivalence is structural
luke : { name : String, age : Int }
luke =
{ name = "Luke"
, age = 25
}
beth : { name : String, age : Int }
beth =
{ name = "Beth"
, age = 25
}
luke : { name : String, age : Int }
luke =
{ name = "Luke"
, age = 25
}
beth : { name : String, age : Int }
beth =
{ name = "Beth"
, age = 25
}