the-sett/elm-update-helper/1.3.0

NOTE: this package is not compatible with Elm 0.19.1

Update2

Convenience function for lifting an update function for an inner model and messages into a parent one.

(model -> ( model, Cmd msg ))
-> ( model, Cmd msg )
-> ( model, Cmd msg )

Allows the output of an update function that returns type:

(model, Cmd msg)

To have its model evaluated in order to produce a new model, and to create more commands. The commands returned will be appended to those passed in using Cmd.batch.

Note that this allows multiple invokations of the same update function to be invoked recursively. Beware of causing infinite loops while doing this.

(model -> submodel)
-> (submodel -> model -> model)
-> (submsg -> msg)
-> (submsg -> submodel -> ( submodel, Cmd submsg ))
-> submsg
-> model
-> ( model, Cmd msg )

Lifts an update function of type:

update : submsg -> submodel -> ( submodel, Cmd submsg )

Into one that returns:

(model, Cmd  msg)