Open jackie-scholl opened 2 years ago
Unison has no precedence rules for functions as of yet, so (+)
and (*)
behave like all other binary functions: they associate to the left.
Unison will eventually get precedence rules (hopefully soon!). I've opened an issue to track: https://github.com/unisonweb/unison/issues/3468
@runarorama this is resolved as of #5273, right?
This has been mentioned before, three years ago in a closed issue: https://github.com/unisonweb/unison/pull/896
In Unison,
1+2*3
evaluates to9
. This is mathematically incorrect behavior :( Haskell solves this by allowing infix operators to determine their own precedence. Most languages fix this by hardcoding precedence for the standard operators. If one were deeply opposed to the idea of operator precedence, one might ban the expression1+2*3
, calling it invalid syntax because it mixes operators without parentheses for clarity.