On Friday, December 2, 2016 at 11:44:42 AM UTC-5, Max Goldstein wrote:
>
> I would want to move all of the view code to a new module, exposing only 
> the view function itself. In order to do that, you'll have to move the 
> definition of Model and Msg to a module imported by both Main and View. You 
> can call this module Common. I think the initial model belongs next to its 
> definition, in Common. I wish there was a way to keep Msg near update but 
> View needs it too. 
>
> If you have many helper functions that called from update directly, those 
> can live in Main. If you have many helpers that are only called from other 
> helpers, try to find the small interface update needs, expose that, and 
> hide the rest. 
>

Thanks so much, Max, that's extremely helpful and practical advice! :)
So your suggestion would give me a file structure that looks like this?

- common.elm: initial model and messages
- view.elm: all the view code
- main.elm: imports common, view. includes all the update code, 
subscriptions and app wiring

I also think of Msg as part of update, so I know what you mean about that 
separation seeming awkward.

Great, I'l try this!

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