I was confronted to the same problem and I solved it by requiring each
subcomponent's model to be an extensible records:
{a | foo : Foo, bar : Bar}
The advantage is that the sub component does not have to know about all parts
of the main component's model:
update: Msg -> MainModel -> MainModel
update msg model =
case msg of
SubMsg m ->
Sub.update m model
I chose this solution because it was more flexible than the one presented in
the elm tutorial (counters) where each subcomponent's model is a separate field
of a bigger record, which makes it difficult to share parts of the model
between subcomponents without incestuous workarounds...
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.