On Wednesday, February 22, 2017 at 12:02:13 PM UTC, Rupert Smith wrote: > > Perhaps there are some combinations of states that I want to disallow - > for example, maybe I do not want to allow the menu to be opened when the > dialog is already open. >
I can introduce another type to enumerate the relationship between states that I do want to allow (if I refer to the menu and dialog as 'overlays' i.e. things that can appear over the normal page): type Overlay = Hidden | MenuOpen Menu | DialogOpen Dialog Interestingly when done this way, I don't want the Hidden states for Menu and Dialog any more, otherwise there will be 3 different ways to encode the state when nothing is shown. What should have been blindingly obvious to me is that to form a cross product, you just put things together in a tuple or record. To express some sub-set of a cross product you use a tagged union. -- 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.
