arliss_obsidian/fp/Language/Infix Operators/Associativity.md

15 lines
419 B
Markdown
Raw Normal View History

2024-09-23 23:56:55 +00:00
[[Infix Operators]] are left-, right- or non-associative _(`infixl`, `infixr`, `infix` respectively)_
When multiple infix operators with the same associativity & precedence are chained, associativity tells the language how to group the expressions.
e.g. `&&` is right-associative, while `*` is left associative:
```haskell
a && b && c
-- interpreted as
(a && (b && c))
a * b * c
-- interpreted as
((a * b) * c)
```