A Unison term declaration (or "term binding") consists of an optionaltype signature,and aterm definition.For example:
timesTwo : Nat -> Nat
timesTwo x = x * 2
The first line in the above is atype signature.The type signaturetimesTwo : Nat -> Nat
declares that the term namedtimesTwo
is a function accepting an argument of typeNat
and computes a value of typeNat
.The typeNat
is the type of 64-bit natural numbers starting from zero. SeeUnison typesfor details.
The second line is the term definition. The=
sign splits the definition into aleft-hand side,which is the term being defined, and theright-hand side,which is the definition of the term.
The general form of a term binding is:
name : Type
name p_1 p_2 … p_n = expression