There have been two other discussions here asking a similar question
but I feel that there hasn’t been any comprehensive discussion about the implications of storing functions in the application model or msg type.
From what I’ve read, the following are implications with doing this:
- Potentially harder to understand code (though perhaps not always?)
- It prevents exporting debugger history (regardless if it’s the model or msg containing functions)
- Using == on a data structure containing a function causes a runtime error
- Prevents compiler optimizations (what kind of optimizations does the compiler do that are affected?)
- Breaks hot reloading (at least, it does in create-elm-app but I haven’t tested other tools. Also I’m not sure if this is only a problem for storing functions in the model or the msg type also.)
- It does not break Html.lazy due to lazy using reference equality
Are all these statements true? Are there things I’ve missed?