⛅ Coming soon: create Unison Cloud clusters in minutes on your own infrastructure. Learn more

Tuple patterns

A tuple pattern has the form (p1, p2, … pn) where p1 through pn are patterns. The pattern matches if the scrutinee is a tuple of the same arity as the pattern and p1 through pn match against the elements of the tuple. The pattern (p) is the same as the pattern p, and the pattern () matches the literal value () of the trivial type {()} (both pronounced “unit”).

For example, this expression evaluates to 4:

(a, _, c) = (1, 2, 3) a Nat.+ c
4