Hi, I’m new to Elm and am building a simple quiz UI (such as that of Buzzfeed) to teach myself the language and environment. I see my UI fitting into three distinct stages:
- Initial (showing the “hello and welcome to the quiz” screen)
- Quiz question (stores a running tally of options selected)
- Complete (shows the winning option)
I’m trying to model this with Elm, but I keep running into a wall, due to the fact that only a subset of
Msgs are applicable in each stage. In particular, the
Start message only makes sense in the Initial and Complete stages, and the
Next messages only make sense in the Quiz stage. My current approach uses
Maybe everywhere, even when it doesn’t make sense, because I can’t figure out how to model
Msgs that are only applicable in a particular stage.
Any advice? Thank you in advance!