All Projects → ccapndave → Elm Update Extra

ccapndave / Elm Update Extra

Licence: mit
Convenience functions for chaining together updates in Elm

Programming Languages

elm
856 projects

elm-update-extra

This is a simple collection of functions for working with the update function within the paradigm of a pipeline. It includes functions to recursively call update (including with a list of messages), update the model and add commands.

update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
    case msg of
      DoSomething ->
          (model, Cmd.none)
              |> Update.andThen (update DoSomethingElse)
              |> Update.sequence [ DoAnotherThing, DoThatThing ]
              |> Update.addCmd (log "I did all kinds of things"
              |> Update.updateModel (\m -> { m | x = m.x + 1 }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].