Commit d8d96cf
committed
Optimise (f <<< g $ x) as (f (g x))
When writing PureScript code like:
not <<< not $ id true
We see a few function calls:
Prelude["<<<"](Prelude.semigroupoidArr)
(Prelude.not(Prelude.boolLikeBoolean))
(Prelude.not(Prelude.boolLikeBoolean))
(Prelude.id(Prelude.categoryArr)(
true));
We now see something very straight forward:
!!Prelude.id(Prelude.categoryArr)(true);
The implementation of this optimisation contains a lot of similarities
to the common binary operator inlining. We should extract some
functions out in another commit.1 parent fc4325e commit d8d96cf
File tree
3 files changed
+21
-1
lines changed- src/Language/PureScript
- CodeGen/JS
- Optimizer
3 files changed
+21
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
233 | 238 | | |
234 | 239 | | |
235 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
236 | 249 | | |
237 | 250 | | |
238 | 251 | | |
| |||
292 | 305 | | |
293 | 306 | | |
294 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| |||
0 commit comments