Open protz opened 3 years ago
Thanks Jonathan! I guess in the meantime you can hide that verbose matching in a helper variable, so that lawyers don't have to review this big pattern match. I'm not a fan of this lexicographic ordering enforcement, since in other situations you may want to group cases together in the type declaration in a way that is more semantic than lexicographic.
It would be convenient to do:
where the pattern matches any constructors present in the enumeration declaration between
Cons1
andCons2
.This, of course, poses problems, such as semantics changing when constructors are re-ordered. But, in my use-case, I have something like:
and oftentimes, say in a followup statute, there will be something like "for infractions between 291-X and 291-Y"... I don't want to switch to pairs of integers (because I would lose the benefits of exhaustiveness checking), so an alternative might be to enforce that such patterns impose that the type declaration constructors be sorted by lexicographic order