Operators and Precedence
Operators like + and == are just functions with infix syntax.
Using an operator as a value
Parentheses turn an operator into a function value:
(+) 1 2
This enables partial application:
map ((*) 2) [1, 2, 3]
Operators come from type classes
Many operators are methods on prelude classes:
+/zerofromAdditiveMonoid*/onefromMultiplicativeMonoid==/!=fromEq- ordering from
Ord
This is why you can write + for both numbers and strings.
Precedence
Rex has a fixed precedence table (see Language Reference). A good habit is to use parentheses whenever you mix application with multiple infix operators.
(1 + 2) * 3
Record projection is not an operator
x.field is field projection syntax, not an operator you can partially apply:
type User = User { name: string }
let u: User = User { name = "Ada" } in u.name