Elm
The best of functional programming in your browser
What is Elm? ● Purely functional● Statically typed● In the browser
Better Modeling with Custom STatic types
type Approval = Approved | Rejected | Pending
User Friendly
Writing great code should be easy… now it is
Handling Nothing Life without null
Maybetype Maybe a = Nothing | Just a
> Nothing
Nothing : Maybe a
> Just "hello"
Just "hello" : Maybe String
Side effects The real world
The Elm Architecture Simple patterns that scale
Modeltype alias Model = Int
model = 0
Viewview : Model -> Html Msg
view model =
div []
[ button [ onClick Decrement ] [ text "-" ]
, div [] [ text (toString model) ]
, button [ onClick Increment ] [ text "+" ]
]
Updatetype Msg = Increment | Decrement
update : Msg -> Model -> Model
update msg model =
case msg of
Increment -> model + 1
Decrement -> model - 1
Elm 0.17 Even more awesome
Simplified concepts● Commands● Subscriptions