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.

Reply via email to