Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JazzCon 2018: Build Web Apps with Elm

JazzCon 2018: Build Web Apps with Elm

Jeremy Fairbank

March 21, 2018
Tweet

More Decks by Jeremy Fairbank

Other Decks in Programming

Transcript

  1. Jeremy Fairbank @elpapapollo / jfairbank Build Web Apps with Elm

    Visit README for demo and exercise URLs: bit.ly/jf-elm-workshop
  2. The 2nd argument to function `add` is causing a mismatch.

    7| add 2 "3" ^^^ Function `add` is expecting the 2nd argument to be: Int But it is: String Compile time static type checks
  3. Content • Functions and expressions • Lists, records, and immutability

    • Static types and type aliases • Union types and pattern matching • Building Apps with the Elm Architecture • JSON Decoders • Adding HTTP to applications
  4. elm Virtual DOM Todo List Learn Elm Build awesome Elm

    apps Learn functional programming <html /> Model: Todo List
  5. × Todo List Learn Elm Build awesome Elm apps Learn

    functional programming User deletes first todo item <html /> Model: New Todo List
  6. Todo List Learn Elm Build awesome Elm apps Learn functional

    programming View Model: New Todo List Elm notices missing todo item in virtual DOM list, so it just removes the corresponding <li> instead of fully rendering. elm Virtual DOM ×<html />
  7. elm app model Events Text Input Mouse Click When event

    triggers (i.e. user clicks), deliver message
  8. elm app model Receive back message with response value when

    command completes Commands HTTP Dates Random #’s
  9. { "id": 1, "title": "Learn Elm", "complete": false } Dynamic

    JSON Static Type type alias TodoItem = { id : Int , title : String , complete : Bool } ?
  10. JSON Decoders Ok { id = 1 , title =

    "Learn Elm" , complete = False } { "id": 1, "title": "Learn Elm", "complete": false }
  11. Resources • bit.ly/programming-elm • elm-lang.org • elm-lang.org/examples • guide.elm-lang.org •

    www.elm-tutorial.org • builtwithelm.co • Slack • elmlang.herokuapp.com