forked from fredcy/elm-faq
-
Notifications
You must be signed in to change notification settings - Fork 23
/
operators.html
83 lines (81 loc) · 1.82 KB
/
operators.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
layout: default
---
<h1>Operator precedences and associativities</h3>
<table class="precedence">
<thead>
<tr>
<th>precedence</th>
<th>left associative</th>
<th>right associative</th>
</tr>
</thead>
<tbody>
<tr>
<td>9</td>
<td><code>>></code></td>
<td><code><<</code></td>
</tr>
<tr>
<td>8</td>
<td></td>
<td><code>^</code></td>
</tr>
<tr>
<td>7</td>
<td><code>*</code> <code>/</code> <code>//</code> <code>%</code></td>
<td></td>
</tr>
<tr>
<td>6</td>
<td><code>+</code> <code>−</code></td>
<td></td>
</tr>
<tr>
<td>5</td>
<td></td>
<td><code>++</code> <code>::</code></td>
</tr>
<tr>
<td>4</td>
<td colspan="2" style="text-align: center">
<code>==</code> <code>/=</code> <code><</code> <code>></code>
<code><=</code> <code>>=</code>
<sup><a href="#nonassoc">*</a></sup>
</td>
</tr>
<tr>
<td>3</td>
<td></td>
<td><code>&&</code></td>
</tr>
<tr>
<td>2</td>
<td></td>
<td><code>||</code></td>
</tr>
<tr>
<td>0</td>
<td><code>|></code></td>
<td><code><|</code></td>
</tr>
</tbody>
</table>
<br>
<p>
The above lists the core infix operators in descending order of precedence.
</p>
<p>
Function application (by adjacency) is higher priority than all operators and
is left-associative:<br> <code>f g h x</code> is interpreted as <code>((f g) h) x</code>.
</p>
<p name="nonassoc">
*
The comparison operators (precedence 4) are non-associative.
</p>
<p>
This is based on
<a href="https://github.com/elm-lang/core/blob/master/src/Basics.elm">Basics.elm</a>
and
<a href="https://github.com/elm-lang/core/blob/master/src/List.elm">List.elm</a>.
</p>