(A,B)is a type for binary tuples (pairs) of values, one of type
Aand another of type
(A,B,C)is a triple, and so on.
(A)is the same as the type
Aand 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 ofarity2 and higher are actually of a type
Tuple a bfor some types
(X,Y)is syntactic shorthand for the type
Tuple X (Tuple Y ()).
The arity of a function or data constructor describes the number of arguments that it takes.
For example, the function
addThree : Nat -> Nat -> Nat -> Natis a function of arity 3.
Some arities are common enough they get special terms:
- A "nullary" function has 0 arguments
- A "unary" function has 1 arguments
- A "binary" function has 2 arguments
- A "ternary" function has 3 arguments