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 Msg
s are applicable in each stage. In particular, the Start
message only makes sense in the Initial and Complete stages, and the Select
and 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 Msg
s that are only applicable in a particular stage.
Any advice? Thank you in advance!