Syntactic precedence of operators and prefix function application

All operators and infix function applications currently have the same precedence, and are parsed left-associative. Use parentheses to obtain a different grouping. So for instance:

  • 1 + 3 Nat.* 4 is parsed (1 + 3) * 4. You can group it differently using parentheses: 1 Nat.+ (3 * 4)
  • a + b < c * d is parsed as ((a + b) < c) * d. You can group it differently using parentheses: a + b < (c * d)
  • 3 - 1 + 11 is parsed as (x - 1) + 11.

When your code is printed back to you by Unison, it will be displayed with minimal necessary parentheses, so if Unison's default syntax later supports operator precedence, old definitions written originally with more parentheses will get displayed with only the parentheses currently needed for the current precedence settings.

Prefix function application:

  • Binds more tightly than infix operators. So f x + g y is the same as (f x) + (g y).
  • Binds less tightly than keywords that introduce blocks. So f let x is the same as f (let x) and f if b then p else q is the same as f (if b then p else q)
  • Binds less tightly than ' and ! (see delayed computations), so 'f x y is the same as (_ -> f) x y and !f x y is the same as f () x y.