What do you folks think about being able to pattern match same/equal elements? Here is an example:

arr match
case Array(x, x) => ... // where the array has two elements that are equal
...

Currently, we get a x is already defined error. And we would have to use if guard like so:

case Array(x, y) if x == y => ....

I am ignorant to know if this is even feasible from a compiler’s perspective. But thought I should throw it out here because I think it would be useful.

x match
case ExtractorA(y) & ExtractorB(y) => // branch if x matches both extractors, by analogy to
case ExtractorA(y) | ExtractorB(y) => // branch if x matches either extractors

Alternatively, the symbol could be @, as this is a generalisation of it:

x match
case y@Extractor(z) => // is equivalent to
case y & Extractor(z) =>