I can speculate as to why DOM side effects are different than all other side effects. But when explaining the Elm architecture to a friend I explained it like this:
- Elm apps take in a model and a Msg as inputs and run those two inputs through an update function - The update function returns a new model as well as a list of Cmd Msg - The resulting model is then sent into your view function which in turn returns an Html Msg - To summarize that, your Elm app returns a new model, an Html Msg, and a list of Cmd Msg everytime it receives a new Msg as input - Any commands returned from the app are descriptions of side effects (such as perform an Http request) and Elm takes care of that - Any html returned from the app are descriptions of side effects to the DOM specifically and Elm takes care of that as well However, I couldn't find any reasons on the spot why DOM side effects are special and literally all other side effect descriptions are grouped into a separate bucket called Cmd. My original assumption is that all Elm apps will have some kind of DOM so why not have a separate Html Msg construct? But I don't think that is a safe assumption if you're not using Elm for your view layer, or you using it in a NodeJS app. So, why aren't descriptions of DOM also bundled into the Cmd Msg bucket? -- 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.
