Get updates via , Github, or RSS | About

Episode 15: Upgrade to Elm 0.18 Nov 17, 2016

Elm 0.18 is out and provides a Migration Guide to help get you started. There are many changes to the API, especially in the Task module and the new elm-lang/http library (formerly the evancz/elm-http library). Follow along this week as we upgrade an existing Elm 0.17 project to Elm 0.18.

Examples

$ npm install -g elm-upgrade
$ npm install -g elm
$ elm-upgrade
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
  case msg of
    DealHand ->
      let
        localTask =
          locallyStore updated
            |> mapError LocallyStoreError
        remoteTask value =
          remotelyStore value model
            |> mapError (RemotelyStoreError << httpErrorToString)
        cmd =
          localTask
            |> andThen remoteTask
            |> Task.attempt Storage
      in
        model ! [cmd]
    Storage (Err error) ->
      let
        updated = updateModelFromErrorType error model
      in
        updated ! []
    Storage (Ok serverResponse) ->
      let
        updated = updateModelFromServerResponse serverResponse model
      in
        updated ! []