Skip to content

Commit d4b5a09

Browse files
committed
Show the weakness of current tuple normalization
1 parent 999a4c0 commit d4b5a09

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
:js
2+
:ucs desugared normalized
3+
4+
:import ../Prelude/Option.mls
5+
//│ Imported 3 member(s)
6+
7+
fun add_6(x, y) =
8+
if [x, y] is
9+
[Some(xv), Some(yv)] then xv + yv
10+
[Some(xv), None] then xv
11+
[None, Some(yv)] then yv
12+
[None, None] then 0
13+
//│ Desugared:
14+
//│ > if
15+
//│ > let $scrut@34 = [x@32#666, y@33#666]
16+
//│ > $scrut@34 is []=2 and
17+
//│ > let $first0@46 = $scrut@34#10.0
18+
//│ > let $first1@45 = $scrut@34#11.1
19+
//│ > $first0@46 is Some($param0@47) and
20+
//│ > let xv@48 = $param0@47#0
21+
//│ > $first1@45 is Some($param0@49) and
22+
//│ > let yv@50 = $param0@49#0
23+
//│ > else globalThis:import#Prelude#666.+‹member:+›(xv@48#666, yv@50#666)
24+
//│ > $scrut@34 is []=2 and
25+
//│ > let $first0@42 = $scrut@34#7.0
26+
//│ > let $first1@41 = $scrut@34#8.1
27+
//│ > $first0@42 is Some($param0@43) and
28+
//│ > let xv@44 = $param0@43#0
29+
//│ > $first1@41 is None then xv@44#666
30+
//│ > $scrut@34 is []=2 and
31+
//│ > let $first0@38 = $scrut@34#4.0
32+
//│ > let $first1@37 = $scrut@34#5.1
33+
//│ > $first0@38 is None and $first1@37 is Some($param0@39) and
34+
//│ > let yv@40 = $param0@39#0
35+
//│ > else yv@40#666
36+
//│ > $scrut@34 is []=2 and
37+
//│ > let $first0@36 = $scrut@34#1.0
38+
//│ > let $first1@35 = $scrut@34#2.1
39+
//│ > $first0@36 is None $first1@35 is None then 0
40+
//│ Normalized:
41+
//│ > if
42+
//│ > let $scrut@34 = [x@32#666, y@33#666]
43+
//│ > $scrut@34 is []=2 and
44+
//│ > let $first0@46 = $scrut@34#10.0
45+
//│ > let $first1@45 = $scrut@34#11.1
46+
//│ > $first0@46 is Some($param0@47) and
47+
//│ > let xv@48 = $param0@47#0
48+
//│ > $first1@45 is Some($param0@49) and
49+
//│ > let yv@50 = $param0@49#0
50+
//│ > else globalThis:import#Prelude#666.+‹member:+›(xv@48#666, yv@50#666)
51+
//│ > let $first0@42 = $scrut@34#7.0
52+
//│ > let $first1@41 = $scrut@34#8.1
53+
//│ > $first0@42 is Some($param0@43) and
54+
//│ > let xv@44 = $param0@43#0
55+
//│ > $first1@41 is None then xv@44#666
56+
//│ > let $first0@38 = $scrut@34#4.0
57+
//│ > let $first1@37 = $scrut@34#5.1
58+
//│ > $first0@38 is None and
59+
//│ > $first1@37 is Some($param0@39) and
60+
//│ > let yv@40 = $param0@39#0
61+
//│ > else yv@40#666
62+
//│ > let $first0@36 = $scrut@34#1.0
63+
//│ > let $first1@35 = $scrut@34#2.1
64+
//│ > $first0@36 is None $first1@35 is None then 0
65+
//│ > let $first0@36 = $scrut@34#1.0
66+
//│ > let $first1@35 = $scrut@34#2.1
67+
//│ > $first0@36 is None $first1@35 is None then 0
68+
//│ > let $first0@38 = $scrut@34#4.0
69+
//│ > let $first1@37 = $scrut@34#5.1
70+
//│ > $first0@38 is None and
71+
//│ > $first1@37 is Some($param0@39) and
72+
//│ > let yv@40 = $param0@39#0
73+
//│ > else yv@40#666
74+
//│ > let $first0@36 = $scrut@34#1.0
75+
//│ > let $first1@35 = $scrut@34#2.1
76+
//│ > $first0@36 is None $first1@35 is None then 0
77+
//│ > let $first0@36 = $scrut@34#1.0
78+
//│ > let $first1@35 = $scrut@34#2.1
79+
//│ > $first0@36 is None $first1@35 is None then 0
80+
//│ > let $first0@42 = $scrut@34#7.0
81+
//│ > let $first1@41 = $scrut@34#8.1
82+
//│ > $first0@42 is Some($param0@43) and
83+
//│ > let xv@44 = $param0@43#0
84+
//│ > $first1@41 is None then xv@44#666
85+
//│ > let $first0@38 = $scrut@34#4.0
86+
//│ > let $first1@37 = $scrut@34#5.1
87+
//│ > $first0@38 is None and
88+
//│ > $first1@37 is Some($param0@39) and
89+
//│ > let yv@40 = $param0@39#0
90+
//│ > else yv@40#666
91+
//│ > let $first0@36 = $scrut@34#1.0
92+
//│ > let $first1@35 = $scrut@34#2.1
93+
//│ > $first0@36 is None $first1@35 is None then 0
94+
//│ > let $first0@36 = $scrut@34#1.0
95+
//│ > let $first1@35 = $scrut@34#2.1
96+
//│ > $first0@36 is None $first1@35 is None then 0
97+
//│ > let $first0@38 = $scrut@34#4.0
98+
//│ > let $first1@37 = $scrut@34#5.1
99+
//│ > $first0@38 is None and
100+
//│ > $first1@37 is Some($param0@39) and
101+
//│ > let yv@40 = $param0@39#0
102+
//│ > else yv@40#666
103+
//│ > let $first0@36 = $scrut@34#1.0
104+
//│ > let $first1@35 = $scrut@34#2.1
105+
//│ > $first0@36 is None $first1@35 is None then 0
106+
//│ > let $first0@36 = $scrut@34#1.0
107+
//│ > let $first1@35 = $scrut@34#2.1
108+
//│ > $first0@36 is None $first1@35 is None then 0

0 commit comments

Comments
 (0)