News for hackers. Stuff that matters.
Re:Making Elm faster and friendlier in 0.16 by brodo on Thursday November 19, 2015 @05:09PM (#10598070)
You can have component local state in the Elm architecture. If you work through the Elm architecture tutorial (https://github.com/evancz/elm-architecture-tutorial/), section 6 describes how to do it. You can also have both local and global state if you want. Just follow the tutorial and in your "model" type add a record called "global". Than let each component take and return both the local and the global model. I personally use global actions instead of a global model. In this approach each update function for a component returns a new model and a global action. Each component has a "updateGlobal" function which is than called with all the actions returned by the update functions of all the components. This way, components can talk to each other, but may keep completely different models. Here is the relevant code in my main elm file: https://gist.github.com/brodo/6495e486648d235e10a5

This allows you to react differently to actions in each component if you want. You can check out the whole project here: https://github.com/brodo/MushroomCup/tree/master/elm

Re:Making Elm faster and friendlier in 0.16 by ablesearcher on Thursday November 19, 2015 @05:25PM (#10598148)
Your solution redefines the word "local" to mean "global." Yes, you can store a component's intrinsically local state as field in your global model and then use a specialized update function that is reached by a switch from your global update function. The question we are addressing is: Is that a good idea?
Re:Making Elm faster and friendlier in 0.16 by brodo on Thursday November 19, 2015 @05:46PM (#10598244)
You realize that each component can not see the other components local state in both solutions i suggested?