This package proposes a Return type that helps building a structure for scalable programming on TEA.
An alternative type to (Model, Cmd msg), which is the return value of the general update function.
-- before
update : Msg -> Model -> (Model, Cmd Msg)
-- after
update : Msg -> Return Model Msg Output
asModelModifier : Return mod msg out -> Maybe (ModelModifier mod)
Convert to ModelModifier
asCmd : Return mod msg out -> Platform.Cmd.Cmd msg
Convert to Cmd
asOutputs : Return mod msg out -> List out
Convert to Outputs
returnModel : ReturnF mod msg out (ModelModifier mod)
Generate a Return having a ModelModifier.
returnCmd : ReturnF mod msg out (Platform.Cmd.Cmd msg)
Generate a Return having a Cmd.
returnOutput : ReturnF mod msg out out
Generate a Return having a Output.
returnOutputs : ReturnF mod msg out (List out)
Generate a Return having Output list.
returnNothing : Return mod msg out
Generate an empty Return.
withModel : ModelModifier mod -> Return mod msg out -> Return mod msg out
Add a ModelModifier to the return
withCmd : Platform.Cmd.Cmd msg -> Return mod msg out -> Return mod msg out
Add a Cmd to the return
withOutput : out -> Return mod msg out -> Return mod msg out
Add a Output to the return
withOutputs : List out -> Return mod msg out -> Return mod msg out
Add Output list to the return
transformModel : (after -> before) -> (after -> before -> after) -> Return before msg out -> Return after msg out
Transform a model type to the other.
mapCmd : (msg -> msg_) -> Return mod msg out -> Return mod msg_ out
Map a Cmd in a Return.
mapOutputs : (out -> out_) -> Return mod msg out -> Return mod msg out_
Map Outputs in a Return.
merge : Return mod msg out -> Return mod msg out -> Return mod msg out
Merge two Returns into a one Return.
mergeAll : List (Return mod msg out) -> Return mod msg out
Merge multiple Returns into a one Return.
applyModel : Return mod msg out -> mod -> mod
Apply a Model to ModelModifier.
handleOutputs : (out -> Return mod msg out) -> Return mod msg out -> Return mod msg out
Reflects the Output in the Return. the Return returned by the handle function is merged with the original Return.
clearOutputs : Return mod msg out -> Return mod msg out_
Make outputs empty.
consumeOutputs : (out -> Return mod msg out) -> Return mod msg out -> Return mod msg out_
Handle outputs then clear it.