>>106
I made that suggestion in the pattern matching thread from a CS 101 perspective. I don't know anything about objects or patterns etc. I did look and it seems that the view pattern is the typical way to do this, although it looks like some academics defined a DSL to make this more ergonomic: www.microsoft.com/en-us/research/wp-content/uploads/2016/08/pattern-synonyms-Haskell16.pdf