The type (A,B)
is a type for binary tuples (pairs) of values, one of type A
and another of type B
. The type (A,B,C)
is a triple, and so on.
The type (A)
is the same as the type A
and is not considered a tuple.
The nullary tuple type ()
is the type of the unique value also written ()
and is pronounced “unit”.
In the standard Unison syntax, tuples of arity 2 and higher are actually of a type Tuple a b
for some types a
and b
. For example, (X,Y)
is syntactic shorthand for the type Tuple X (Tuple Y ())
.
Tuples are either constructed with the syntactic shorthand (a,b)
(see tuple literals) or with the built-in Tuple.Cons
data constructor: (a, b)
.