My approach is: there is one specific `Feature{X,Y,…}Msg` for each feature,
so the main `update` function has only one entry for each "submodule". Each
submodule's update looks like this:

update : FeatureXMsg -> Model -> ( Model, Cmd Msg )

The key is to have it just like this everywhere. Each and every update
function:
- takes the specific message, so it make a full case…of,
- takes the global/top level Model
- returns the global/top level tuple (Model, Cmd Msg)

I think it's the most simple and flexible solution.

Regards,
Witold Szczerba


On Mon, Mar 20, 2017 at 12:58 PM, Eirik Sletteberg <
[email protected]> wrote:

> In larger Elm apps, it makes sense to divide Updaters so you can
> package-by-feature.
> For example, a single page application could have updaters like this:
>
> - Configuration updater
> - Session updater
> - User Profile updater
> - User Settings updater
> - Content updater
> - Some other business specific updater
>
> The challenge is when there are dependencies between Updaters, for example
> the User Profile model might need data from the Session model, the Session
> updater might need to send messages to the User updater (Load user profile
> when session is updated), or the Content updater may need to check for the
> Session updater (get session ID to send as parameter to the API when
> fetching content), or some business-specific updater may need to interact
> with both the Content updater, the User updater, and the Configuration
> updater.
>
> In Redux, one would use combineReducers to mount each reducer under its
> own path, and then one can trigger actions across reducers. How would you
> solve this in Elm?
>
> --
> 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.
>

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