As-patterns

Anas-patternhas the formv@pwherevis aregular identifierandpis a pattern. This pattern matches ifpmatches, and the variablevwill be bound in the body to the value matchingp.

For example, this expression evaluates to3:

matchExpression : Nat
matchExpression = match 1 Nat.+ 1 with
  x@4 -> x Nat.* 2
  y@2 -> y Nat.+ 1
  _   -> 22