Hi,
this is how I did it:
https://www.reddit.com/r/elm/comments/5wikog/easy_questions_beginners_thread_week_of_20170227/deeptz3/
The answer starting with: "My app is also small, it has now 3 pages. It's
model looks like…".

And this a similar queston with complex answer from Richard Feldman:
https://www.reddit.com/r/elm/comments/5jd2xn/how_to_structure_elm_with_multiple_models/
The answer starting with: "Here's my general advice."

Regards,
Witold Szczerba


On Wed, Mar 8, 2017 at 4:17 AM, Alex Rice <[email protected]> wrote:

> Hi all, I am new to Elm, and functional programming, and have been reading
> through all the docs and tutorials. One question that keeps cropping up for
> me is:
>
> How do you break up the Msg union type and the update function into
> logical, manageable and editable pieces in a large Elm project?
>
> type Msg =
>   many | things
>
> and
>
> update : Msg -> Model -> ( Model, Cmd Msg ) =
>   case msg of all... those.. things
>
> So the pattern is, the Msg is a union type of many things, and the update
> function is similarly lengthy case statement.
>
> How does that scale in real web apps? What if you have 100 messages, then
> the update function is always 100 cases long? In the the scenario where you
> are using Navigation.program, then shouldn't the update function only be
> testing the cases which are in scope for the current route of the SPA, not
> all 100 cases? In the Navigation.program examples I have seen, all the
> cases are evaluated.
>
> I hope there is a way to decompose the messages and the update function
> perhaps using some kind of pattern matching, or by some FP techniques, I
> just have not seen it yet. Looking forward to hearing what you think!
>
> --
> 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