the-sett/elm-update-helper/2.0.0

NOTE: the latest version is 2.3.0

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 )
(model -> ( model, Cmd msg ))
-> ( model, Cmd msg )
-> ( model, Cmd msg )

Allows update functions to be chained together. The Cmds will be batched together.

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

Allows update functions that also produce lists of out messages, to be chained together, whilst also transforming the model and outMsg type. The Cmds will be batched together.