Operators
Flix has a number of built-in unary and infix operators. In addition Flix supports infix function application by enclosing the function name in backticks. For example:
123 `sum` 456
is equivalent to the normal function call:
sum(123, 456)
In addition, a function named with an operator name (some combination of +
, -
, *
, <
, >
, =
, !
, &
, |
, ^
, and $
) can also be used infix. For example:
def <*>(x: Int32, y: Int32): Int32 = ???
can be used as follows:
1 <*> 2
Precedence
- Unary operators (
+
,-
,~~~
, andnot
) - User-defined operators (including operators defined in the standard library such as
|>
) - Functions applied infix with backticks
- Composition (
<+>
) - Multiplicative (
**
,*
,/
,mod
, andrem
) - Additive (
+
and-
) - Shift (
<<<
and>>>
) - Comparison (
<=
,>=
,<
, and>
) - Equality (
==
,!=
, and<==>
) - Bitwise And (
&&&
) - Bitwise Xor (
^^^
) - Bitwise Or (
|||
) - Logical
and
- Logical
or
- Channel
<-