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.* 4is parsed(1 + 3) * 4.You can group it differently using parentheses:1 Nat.+ (3 * 4)
  • a + b < c * dis parsed as((a + b) < c) * d.You can group it differently using parentheses:a + b < (c * d)
  • 3 - 1 + 11is 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. Sof x + g yis the same as(f x) + (g y).
  • Binds less tightly than keywords that introduceblocks.Sof let xis the same asf (let x)andf if b then p else qis the same asf (if b then p else q)
  • Binds less tightly than'and!(seedelayed computations),so'f x yis the same as(_ -> f) x yand!f x yis the same asf () x y.