A meta-command type that encapsulates all the command-like things a component might make.
Command is completely analagous to Cmd, only in addition to including
Cmd values, it can include requests to service components that are in the
application.
Like Cmd, Command is parametric in the type of messages that it's requests
might generate as responses. See map.
Maps Commands from one message type to another. Usually used so that
Commands generated in sub-components (which use the sub-component's
msg type) can be handled in the parent component.
type alias ParentModel = { ... childModel : Child.Model, ... }
type ParentMsg = ... | ChildMsg Child.Msg | ...
update : ParentMsg -> ParentModel -> (ParentModel, Command ParentMsg)
update msg model =
case msg of
...
ChildMsg childMsg ->
let
(childModel, childCommand) = Child.update childMsg model.childModel
in
( { model | childModel = childModel }
, Command.map ChildMsg childCommand
)
The command type. There are constructors for all the types of commands in the whole application.