On Fri, Jul 29, 2016 at 12:52 PM, Paul Blair <[email protected]> wrote:

> toMessage : FromServer -> Message
> toMessage incoming =
>   case Dict.get incoming.message_type componentDictionary of
>     Just MyInnerComponent ->
>       InnerComponentModule.toMessage incoming |>
> MyInnerComponentMessageWrapper
>     Nothing ->
>       ...
>


I'm still learning Elm, so forgive that this is not necessarily going to be
expert advice :)

My first question is, what is the type of `componentDictionary`? It looks
to me like it has `String` type keys, but then I don't understand what the
type signature of the value is. `Maybe type`? How can you match on `Just
MyInnerComponent`?

Second question: it seems like the top-level component *must* know
something about the messages in order to route to subcomponents. Can you
include a list of json keys in that routing information, so that you can
pass a narrower scope of data into each subcomponent? It seems like if you
can, that would make your testing story a lot easier.

Duane

-- 
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.

Reply via email to