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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553// Generated by purs bundle 0.12.0
var PS = {};
(function(exports) {
"use strict";
exports.arrayMap = function (f) {
return function (arr) {
var l = arr.length;
var result = new Array(l);
for (var i = 0; i < l; i++) {
result[i] = f(arr[i]);
}
return result;
};
};
})(PS["Data.Functor"] = PS["Data.Functor"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Semigroupoid = function (compose) {
this.compose = compose;
};
var semigroupoidFn = new Semigroupoid(function (f) {
return function (g) {
return function (x) {
return f(g(x));
};
};
});
var compose = function (dict) {
return dict.compose;
};
var composeFlipped = function (dictSemigroupoid) {
return function (f) {
return function (g) {
return compose(dictSemigroupoid)(g)(f);
};
};
};
exports["compose"] = compose;
exports["Semigroupoid"] = Semigroupoid;
exports["composeFlipped"] = composeFlipped;
exports["semigroupoidFn"] = semigroupoidFn;
})(PS["Control.Semigroupoid"] = PS["Control.Semigroupoid"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Category = function (Semigroupoid0, identity) {
this.Semigroupoid0 = Semigroupoid0;
this.identity = identity;
};
var identity = function (dict) {
return dict.identity;
};
var categoryFn = new Category(function () {
return Control_Semigroupoid.semigroupoidFn;
}, function (x) {
return x;
});
exports["Category"] = Category;
exports["identity"] = identity;
exports["categoryFn"] = categoryFn;
})(PS["Control.Category"] = PS["Control.Category"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var otherwise = true;
exports["otherwise"] = otherwise;
})(PS["Data.Boolean"] = PS["Data.Boolean"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Category = PS["Control.Category"];
var Data_Boolean = PS["Data.Boolean"];
var Data_Ord = PS["Data.Ord"];
var Data_Ring = PS["Data.Ring"];
var flip = function (f) {
return function (b) {
return function (a) {
return f(a)(b);
};
};
};
var $$const = function (a) {
return function (v) {
return a;
};
};
exports["flip"] = flip;
exports["const"] = $$const;
})(PS["Data.Function"] = PS["Data.Function"] || {});
(function(exports) {
"use strict";
exports.unit = {};
})(PS["Data.Unit"] = PS["Data.Unit"] || {});
(function(exports) {
"use strict";
exports.showIntImpl = function (n) {
return n.toString();
};
exports.showStringImpl = function (s) {
var l = s.length;
return "\"" + s.replace(
/[\0-\x1F\x7F"\\]/g, // eslint-disable-line no-control-regex
function (c, i) {
switch (c) {
case "\"":
case "\\":
return "\\" + c;
case "\x07": return "\\a";
case "\b": return "\\b";
case "\f": return "\\f";
case "\n": return "\\n";
case "\r": return "\\r";
case "\t": return "\\t";
case "\v": return "\\v";
}
var k = i + 1;
var empty = k < l && s[k] >= "0" && s[k] <= "9" ? "\\&" : "";
return "\\" + c.charCodeAt(0).toString(10) + empty;
}
) + "\"";
};
})(PS["Data.Show"] = PS["Data.Show"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Symbol"];
var SProxy = (function () {
function SProxy() {
};
SProxy.value = new SProxy();
return SProxy;
})();
var IsSymbol = function (reflectSymbol) {
this.reflectSymbol = reflectSymbol;
};
var reflectSymbol = function (dict) {
return dict.reflectSymbol;
};
exports["IsSymbol"] = IsSymbol;
exports["reflectSymbol"] = reflectSymbol;
exports["SProxy"] = SProxy;
})(PS["Data.Symbol"] = PS["Data.Symbol"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var RLProxy = (function () {
function RLProxy() {
};
RLProxy.value = new RLProxy();
return RLProxy;
})();
exports["RLProxy"] = RLProxy;
})(PS["Type.Data.RowList"] = PS["Type.Data.RowList"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Show"];
var Data_Symbol = PS["Data.Symbol"];
var Record_Unsafe = PS["Record.Unsafe"];
var Type_Data_RowList = PS["Type.Data.RowList"];
var Show = function (show) {
this.show = show;
};
var showString = new Show($foreign.showStringImpl);
var showInt = new Show($foreign.showIntImpl);
var show = function (dict) {
return dict.show;
};
exports["Show"] = Show;
exports["show"] = show;
exports["showInt"] = showInt;
exports["showString"] = showString;
})(PS["Data.Show"] = PS["Data.Show"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Unit"];
var Data_Show = PS["Data.Show"];
exports["unit"] = $foreign.unit;
})(PS["Data.Unit"] = PS["Data.Unit"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Functor"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Function = PS["Data.Function"];
var Data_Unit = PS["Data.Unit"];
var Functor = function (map) {
this.map = map;
};
var map = function (dict) {
return dict.map;
};
var $$void = function (dictFunctor) {
return map(dictFunctor)(Data_Function["const"](Data_Unit.unit));
};
var functorFn = new Functor(Control_Semigroupoid.compose(Control_Semigroupoid.semigroupoidFn));
var functorArray = new Functor($foreign.arrayMap);
exports["Functor"] = Functor;
exports["map"] = map;
exports["void"] = $$void;
exports["functorFn"] = functorFn;
exports["functorArray"] = functorArray;
})(PS["Data.Functor"] = PS["Data.Functor"] || {});
(function(exports) {
"use strict";
exports.concatString = function (s1) {
return function (s2) {
return s1 + s2;
};
};
})(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Semigroup"];
var Data_Symbol = PS["Data.Symbol"];
var Data_Unit = PS["Data.Unit"];
var Data_Void = PS["Data.Void"];
var Record_Unsafe = PS["Record.Unsafe"];
var Type_Data_RowList = PS["Type.Data.RowList"];
var Semigroup = function (append) {
this.append = append;
};
var semigroupString = new Semigroup($foreign.concatString);
var append = function (dict) {
return dict.append;
};
exports["Semigroup"] = Semigroup;
exports["append"] = append;
exports["semigroupString"] = semigroupString;
})(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Data_Functor = PS["Data.Functor"];
var Data_Semigroup = PS["Data.Semigroup"];
var Alt = function (Functor0, alt) {
this.Functor0 = Functor0;
this.alt = alt;
};
var alt = function (dict) {
return dict.alt;
};
exports["Alt"] = Alt;
exports["alt"] = alt;
})(PS["Control.Alt"] = PS["Control.Alt"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Control.Apply"];
var Control_Category = PS["Control.Category"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Apply = function (Functor0, apply) {
this.Functor0 = Functor0;
this.apply = apply;
};
var apply = function (dict) {
return dict.apply;
};
var applySecond = function (dictApply) {
return function (a) {
return function (b) {
return apply(dictApply)(Data_Functor.map(dictApply.Functor0())(Data_Function["const"](Control_Category.identity(Control_Category.categoryFn)))(a))(b);
};
};
};
exports["Apply"] = Apply;
exports["apply"] = apply;
exports["applySecond"] = applySecond;
})(PS["Control.Apply"] = PS["Control.Apply"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Apply = PS["Control.Apply"];
var Data_Functor = PS["Data.Functor"];
var Data_Unit = PS["Data.Unit"];
var Applicative = function (Apply0, pure) {
this.Apply0 = Apply0;
this.pure = pure;
};
var pure = function (dict) {
return dict.pure;
};
var unless = function (dictApplicative) {
return function (v) {
return function (v1) {
if (!v) {
return v1;
};
if (v) {
return pure(dictApplicative)(Data_Unit.unit);
};
throw new Error("Failed pattern match at Control.Applicative line 62, column 1 - line 62, column 65: " + [ v.constructor.name, v1.constructor.name ]);
};
};
};
var liftA1 = function (dictApplicative) {
return function (f) {
return function (a) {
return Control_Apply.apply(dictApplicative.Apply0())(pure(dictApplicative)(f))(a);
};
};
};
exports["Applicative"] = Applicative;
exports["pure"] = pure;
exports["liftA1"] = liftA1;
exports["unless"] = unless;
})(PS["Control.Applicative"] = PS["Control.Applicative"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Data_Functor = PS["Data.Functor"];
var Plus = function (Alt0, empty) {
this.Alt0 = Alt0;
this.empty = empty;
};
var empty = function (dict) {
return dict.empty;
};
exports["Plus"] = Plus;
exports["empty"] = empty;
})(PS["Control.Plus"] = PS["Control.Plus"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Plus = PS["Control.Plus"];
var Data_Functor = PS["Data.Functor"];
var Alternative = function (Applicative0, Plus1) {
this.Applicative0 = Applicative0;
this.Plus1 = Plus1;
};
exports["Alternative"] = Alternative;
})(PS["Control.Alternative"] = PS["Control.Alternative"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Control.Bind"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Category = PS["Control.Category"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Unit = PS["Data.Unit"];
var Bind = function (Apply0, bind) {
this.Apply0 = Apply0;
this.bind = bind;
};
var Discard = function (discard) {
this.discard = discard;
};
var discard = function (dict) {
return dict.discard;
};
var bind = function (dict) {
return dict.bind;
};
var bindFlipped = function (dictBind) {
return Data_Function.flip(bind(dictBind));
};
var composeKleisli = function (dictBind) {
return function (f) {
return function (g) {
return function (a) {
return bind(dictBind)(f(a))(g);
};
};
};
};
var discardUnit = new Discard(function (dictBind) {
return bind(dictBind);
});
var ifM = function (dictBind) {
return function (cond) {
return function (t) {
return function (f) {
return bind(dictBind)(cond)(function (cond$prime) {
if (cond$prime) {
return t;
};
return f;
});
};
};
};
};
exports["Bind"] = Bind;
exports["bind"] = bind;
exports["bindFlipped"] = bindFlipped;
exports["Discard"] = Discard;
exports["discard"] = discard;
exports["composeKleisli"] = composeKleisli;
exports["ifM"] = ifM;
exports["discardUnit"] = discardUnit;
})(PS["Control.Bind"] = PS["Control.Bind"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Data_Functor = PS["Data.Functor"];
var Data_Unit = PS["Data.Unit"];
var Monad = function (Applicative0, Bind1) {
this.Applicative0 = Applicative0;
this.Bind1 = Bind1;
};
var ap = function (dictMonad) {
return function (f) {
return function (a) {
return Control_Bind.bind(dictMonad.Bind1())(f)(function (v) {
return Control_Bind.bind(dictMonad.Bind1())(a)(function (v1) {
return Control_Applicative.pure(dictMonad.Applicative0())(v(v1));
});
});
};
};
};
exports["Monad"] = Monad;
exports["ap"] = ap;
})(PS["Control.Monad"] = PS["Control.Monad"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Category = PS["Control.Category"];
var Bifunctor = function (bimap) {
this.bimap = bimap;
};
var bimap = function (dict) {
return dict.bimap;
};
var lmap = function (dictBifunctor) {
return function (f) {
return bimap(dictBifunctor)(f)(Control_Category.identity(Control_Category.categoryFn));
};
};
exports["bimap"] = bimap;
exports["Bifunctor"] = Bifunctor;
exports["lmap"] = lmap;
})(PS["Data.Bifunctor"] = PS["Data.Bifunctor"] || {});
(function(exports) {
"use strict";
exports.refEq = function (r1) {
return function (r2) {
return r1 === r2;
};
};
})(PS["Data.Eq"] = PS["Data.Eq"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Eq"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Symbol = PS["Data.Symbol"];
var Data_Unit = PS["Data.Unit"];
var Data_Void = PS["Data.Void"];
var Record_Unsafe = PS["Record.Unsafe"];
var Type_Data_RowList = PS["Type.Data.RowList"];
var Eq = function (eq) {
this.eq = eq;
};
var eqString = new Eq($foreign.refEq);
var eq = function (dict) {
return dict.eq;
};
exports["Eq"] = Eq;
exports["eq"] = eq;
exports["eqString"] = eqString;
})(PS["Data.Eq"] = PS["Data.Eq"] || {});
(function(exports) {
"use strict";
exports.foldrArray = function (f) {
return function (init) {
return function (xs) {
var acc = init;
var len = xs.length;
for (var i = len - 1; i >= 0; i--) {
acc = f(xs[i])(acc);
}
return acc;
};
};
};
exports.foldlArray = function (f) {
return function (init) {
return function (xs) {
var acc = init;
var len = xs.length;
for (var i = 0; i < len; i++) {
acc = f(acc)(xs[i]);
}
return acc;
};
};
};
})(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Data_Boolean = PS["Data.Boolean"];
var Data_Eq = PS["Data.Eq"];
var Data_EuclideanRing = PS["Data.EuclideanRing"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Symbol = PS["Data.Symbol"];
var Data_Unit = PS["Data.Unit"];
var Record_Unsafe = PS["Record.Unsafe"];
var Type_Data_RowList = PS["Type.Data.RowList"];
var Monoid = function (Semigroup0, mempty) {
this.Semigroup0 = Semigroup0;
this.mempty = mempty;
};
var monoidString = new Monoid(function () {
return Data_Semigroup.semigroupString;
}, "");
var mempty = function (dict) {
return dict.mempty;
};
exports["Monoid"] = Monoid;
exports["mempty"] = mempty;
exports["monoidString"] = monoidString;
})(PS["Data.Monoid"] = PS["Data.Monoid"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Extend = PS["Control.Extend"];
var Control_Monad = PS["Control.Monad"];
var Control_MonadZero = PS["Control.MonadZero"];
var Control_Plus = PS["Control.Plus"];
var Data_Bounded = PS["Data.Bounded"];
var Data_Eq = PS["Data.Eq"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Show = PS["Data.Show"];
var Data_Unit = PS["Data.Unit"];
var Prelude = PS["Prelude"];
var Nothing = (function () {
function Nothing() {
};
Nothing.value = new Nothing();
return Nothing;
})();
var Just = (function () {
function Just(value0) {
this.value0 = value0;
};
Just.create = function (value0) {
return new Just(value0);
};
return Just;
})();
var maybe = function (v) {
return function (v1) {
return function (v2) {
if (v2 instanceof Nothing) {
return v;
};
if (v2 instanceof Just) {
return v1(v2.value0);
};
throw new Error("Failed pattern match at Data.Maybe line 218, column 1 - line 218, column 51: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
};
};
};
var isNothing = maybe(true)(Data_Function["const"](false));
var functorMaybe = new Data_Functor.Functor(function (v) {
return function (v1) {
if (v1 instanceof Just) {
return new Just(v(v1.value0));
};
return Nothing.value;
};
});
var fromJust = function (dictPartial) {
return function (v) {
var $__unused = function (dictPartial1) {
return function ($dollar35) {
return $dollar35;
};
};
return $__unused(dictPartial)((function () {
if (v instanceof Just) {
return v.value0;
};
throw new Error("Failed pattern match at Data.Maybe line 269, column 1 - line 269, column 46: " + [ v.constructor.name ]);
})());
};
};
exports["Nothing"] = Nothing;
exports["Just"] = Just;
exports["maybe"] = maybe;
exports["isNothing"] = isNothing;
exports["fromJust"] = fromJust;
exports["functorMaybe"] = functorMaybe;
})(PS["Data.Maybe"] = PS["Data.Maybe"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
var Data_Monoid_Endo = PS["Data.Monoid.Endo"];
var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
var Data_Semigroup_First = PS["Data.Semigroup.First"];
var Data_Semigroup_Last = PS["Data.Semigroup.Last"];
var Prelude = PS["Prelude"];
var Newtype = function (unwrap, wrap) {
this.unwrap = unwrap;
this.wrap = wrap;
};
var wrap = function (dict) {
return dict.wrap;
};
var unwrap = function (dict) {
return dict.unwrap;
};
exports["unwrap"] = unwrap;
exports["wrap"] = wrap;
exports["Newtype"] = Newtype;
})(PS["Data.Newtype"] = PS["Data.Newtype"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Foldable"];
var Control_Alt = PS["Control.Alt"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Plus = PS["Control.Plus"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Eq = PS["Data.Eq"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Maybe_First = PS["Data.Maybe.First"];
var Data_Maybe_Last = PS["Data.Maybe.Last"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
var Data_Monoid_Endo = PS["Data.Monoid.Endo"];
var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
var Data_Newtype = PS["Data.Newtype"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Unit = PS["Data.Unit"];
var Prelude = PS["Prelude"];
var Foldable = function (foldMap, foldl, foldr) {
this.foldMap = foldMap;
this.foldl = foldl;
this.foldr = foldr;
};
var foldr = function (dict) {
return dict.foldr;
};
var oneOfMap = function (dictFoldable) {
return function (dictPlus) {
return function (f) {
return foldr(dictFoldable)(function ($194) {
return Control_Alt.alt(dictPlus.Alt0())(f($194));
})(Control_Plus.empty(dictPlus));
};
};
};
var foldl = function (dict) {
return dict.foldl;
};
var intercalate = function (dictFoldable) {
return function (dictMonoid) {
return function (sep) {
return function (xs) {
var go = function (v) {
return function (x) {
if (v.init) {
return {
init: false,
acc: x
};
};
return {
init: false,
acc: Data_Semigroup.append(dictMonoid.Semigroup0())(v.acc)(Data_Semigroup.append(dictMonoid.Semigroup0())(sep)(x))
};
};
};
return (foldl(dictFoldable)(go)({
init: true,
acc: Data_Monoid.mempty(dictMonoid)
})(xs)).acc;
};
};
};
};
var foldMapDefaultR = function (dictFoldable) {
return function (dictMonoid) {
return function (f) {
return foldr(dictFoldable)(function (x) {
return function (acc) {
return Data_Semigroup.append(dictMonoid.Semigroup0())(f(x))(acc);
};
})(Data_Monoid.mempty(dictMonoid));
};
};
};
var foldableArray = new Foldable(function (dictMonoid) {
return foldMapDefaultR(foldableArray)(dictMonoid);
}, $foreign.foldlArray, $foreign.foldrArray);
var foldMap = function (dict) {
return dict.foldMap;
};
exports["Foldable"] = Foldable;
exports["foldr"] = foldr;
exports["foldl"] = foldl;
exports["foldMap"] = foldMap;
exports["foldMapDefaultR"] = foldMapDefaultR;
exports["oneOfMap"] = oneOfMap;
exports["intercalate"] = intercalate;
exports["foldableArray"] = foldableArray;
})(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
(function(exports) {
"use strict";
// jshint maxparams: 3
exports.traverseArrayImpl = function () {
function array1(a) {
return [a];
}
function array2(a) {
return function (b) {
return [a, b];
};
}
function array3(a) {
return function (b) {
return function (c) {
return [a, b, c];
};
};
}
function concat2(xs) {
return function (ys) {
return xs.concat(ys);
};
}
return function (apply) {
return function (map) {
return function (pure) {
return function (f) {
return function (array) {
function go(bot, top) {
switch (top - bot) {
case 0: return pure([]);
case 1: return map(array1)(f(array[bot]));
case 2: return apply(map(array2)(f(array[bot])))(f(array[bot + 1]));
case 3: return apply(apply(map(array3)(f(array[bot])))(f(array[bot + 1])))(f(array[bot + 2]));
default:
// This slightly tricky pivot selection aims to produce two
// even-length partitions where possible.
var pivot = bot + Math.floor((top - bot) / 4) * 2;
return apply(map(concat2)(go(bot, pivot)))(go(pivot, top));
}
}
return go(0, array.length);
};
};
};
};
};
}();
})(PS["Data.Traversable"] = PS["Data.Traversable"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Traversable"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Category = PS["Control.Category"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Functor = PS["Data.Functor"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Maybe_First = PS["Data.Maybe.First"];
var Data_Maybe_Last = PS["Data.Maybe.Last"];
var Data_Monoid_Additive = PS["Data.Monoid.Additive"];
var Data_Monoid_Conj = PS["Data.Monoid.Conj"];
var Data_Monoid_Disj = PS["Data.Monoid.Disj"];
var Data_Monoid_Dual = PS["Data.Monoid.Dual"];
var Data_Monoid_Multiplicative = PS["Data.Monoid.Multiplicative"];
var Data_Traversable_Accum = PS["Data.Traversable.Accum"];
var Data_Traversable_Accum_Internal = PS["Data.Traversable.Accum.Internal"];
var Prelude = PS["Prelude"];
var Traversable = function (Foldable1, Functor0, sequence, traverse) {
this.Foldable1 = Foldable1;
this.Functor0 = Functor0;
this.sequence = sequence;
this.traverse = traverse;
};
var traverse = function (dict) {
return dict.traverse;
};
var sequenceDefault = function (dictTraversable) {
return function (dictApplicative) {
return traverse(dictTraversable)(dictApplicative)(Control_Category.identity(Control_Category.categoryFn));
};
};
var traversableArray = new Traversable(function () {
return Data_Foldable.foldableArray;
}, function () {
return Data_Functor.functorArray;
}, function (dictApplicative) {
return sequenceDefault(traversableArray)(dictApplicative);
}, function (dictApplicative) {
return $foreign.traverseArrayImpl(Control_Apply.apply(dictApplicative.Apply0()))(Data_Functor.map((dictApplicative.Apply0()).Functor0()))(Control_Applicative.pure(dictApplicative));
});
var sequence = function (dict) {
return dict.sequence;
};
exports["Traversable"] = Traversable;
exports["traverse"] = traverse;
exports["sequence"] = sequence;
exports["sequenceDefault"] = sequenceDefault;
exports["traversableArray"] = traversableArray;
})(PS["Data.Traversable"] = PS["Data.Traversable"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Extend = PS["Control.Extend"];
var Control_Monad = PS["Control.Monad"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Bifoldable = PS["Data.Bifoldable"];
var Data_Bifunctor = PS["Data.Bifunctor"];
var Data_Bitraversable = PS["Data.Bitraversable"];
var Data_Bounded = PS["Data.Bounded"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Prelude = PS["Prelude"];
var Left = (function () {
function Left(value0) {
this.value0 = value0;
};
Left.create = function (value0) {
return new Left(value0);
};
return Left;
})();
var Right = (function () {
function Right(value0) {
this.value0 = value0;
};
Right.create = function (value0) {
return new Right(value0);
};
return Right;
})();
var functorEither = new Data_Functor.Functor(function (f) {
return function (m) {
if (m instanceof Left) {
return new Left(m.value0);
};
if (m instanceof Right) {
return new Right(f(m.value0));
};
throw new Error("Failed pattern match at Data.Either line 35, column 8 - line 35, column 52: " + [ m.constructor.name ]);
};
});
var either = function (v) {
return function (v1) {
return function (v2) {
if (v2 instanceof Left) {
return v(v2.value0);
};
if (v2 instanceof Right) {
return v1(v2.value0);
};
throw new Error("Failed pattern match at Data.Either line 220, column 1 - line 220, column 64: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
};
};
};
var bifunctorEither = new Data_Bifunctor.Bifunctor(function (v) {
return function (v1) {
return function (v2) {
if (v2 instanceof Left) {
return new Left(v(v2.value0));
};
if (v2 instanceof Right) {
return new Right(v1(v2.value0));
};
throw new Error("Failed pattern match at Data.Either line 40, column 1 - line 40, column 45: " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
};
};
});
exports["Left"] = Left;
exports["Right"] = Right;
exports["either"] = either;
exports["functorEither"] = functorEither;
exports["bifunctorEither"] = bifunctorEither;
})(PS["Data.Either"] = PS["Data.Either"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Unit = PS["Data.Unit"];
var Prelude = PS["Prelude"];
var MonadThrow = function (Monad0, throwError) {
this.Monad0 = Monad0;
this.throwError = throwError;
};
var MonadError = function (MonadThrow0, catchError) {
this.MonadThrow0 = MonadThrow0;
this.catchError = catchError;
};
var throwError = function (dict) {
return dict.throwError;
};
var catchError = function (dict) {
return dict.catchError;
};
exports["catchError"] = catchError;
exports["throwError"] = throwError;
exports["MonadThrow"] = MonadThrow;
exports["MonadError"] = MonadError;
})(PS["Control.Monad.Error.Class"] = PS["Control.Monad.Error.Class"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Comonad = PS["Control.Comonad"];
var Control_Extend = PS["Control.Extend"];
var Control_Lazy = PS["Control.Lazy"];
var Control_Monad = PS["Control.Monad"];
var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
var Data_Bounded = PS["Data.Bounded"];
var Data_CommutativeRing = PS["Data.CommutativeRing"];
var Data_Eq = PS["Data.Eq"];
var Data_EuclideanRing = PS["Data.EuclideanRing"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Functor = PS["Data.Functor"];
var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Newtype = PS["Data.Newtype"];
var Data_Ord = PS["Data.Ord"];
var Data_Ring = PS["Data.Ring"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Prelude = PS["Prelude"];
var Identity = function (x) {
return x;
};
var newtypeIdentity = new Data_Newtype.Newtype(function (n) {
return n;
}, Identity);
var functorIdentity = new Data_Functor.Functor(function (f) {
return function (m) {
return f(m);
};
});
var applyIdentity = new Control_Apply.Apply(function () {
return functorIdentity;
}, function (v) {
return function (v1) {
return v(v1);
};
});
var bindIdentity = new Control_Bind.Bind(function () {
return applyIdentity;
}, function (v) {
return function (f) {
return f(v);
};
});
var applicativeIdentity = new Control_Applicative.Applicative(function () {
return applyIdentity;
}, Identity);
var monadIdentity = new Control_Monad.Monad(function () {
return applicativeIdentity;
}, function () {
return bindIdentity;
});
exports["Identity"] = Identity;
exports["newtypeIdentity"] = newtypeIdentity;
exports["functorIdentity"] = functorIdentity;
exports["applyIdentity"] = applyIdentity;
exports["applicativeIdentity"] = applicativeIdentity;
exports["bindIdentity"] = bindIdentity;
exports["monadIdentity"] = monadIdentity;
})(PS["Data.Identity"] = PS["Data.Identity"] || {});
(function(exports) {
"use strict";
exports.pureE = function (a) {
return function () {
return a;
};
};
exports.bindE = function (a) {
return function (f) {
return function () {
return f(a())();
};
};
};
})(PS["Effect"] = PS["Effect"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Effect"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad = PS["Control.Monad"];
var Data_Functor = PS["Data.Functor"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Semigroup = PS["Data.Semigroup"];
var Prelude = PS["Prelude"];
var monadEffect = new Control_Monad.Monad(function () {
return applicativeEffect;
}, function () {
return bindEffect;
});
var bindEffect = new Control_Bind.Bind(function () {
return applyEffect;
}, $foreign.bindE);
var applyEffect = new Control_Apply.Apply(function () {
return functorEffect;
}, Control_Monad.ap(monadEffect));
var applicativeEffect = new Control_Applicative.Applicative(function () {
return applyEffect;
}, $foreign.pureE);
var functorEffect = new Data_Functor.Functor(Control_Applicative.liftA1(applicativeEffect));
exports["functorEffect"] = functorEffect;
exports["applyEffect"] = applyEffect;
exports["applicativeEffect"] = applicativeEffect;
exports["bindEffect"] = bindEffect;
exports["monadEffect"] = monadEffect;
})(PS["Effect"] = PS["Effect"] || {});
(function(exports) {
"use strict";
// module Partial.Unsafe
exports.unsafePartial = function (f) {
return f();
};
})(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
(function(exports) {
"use strict";
// module Partial
exports.crashWith = function () {
return function (msg) {
throw new Error(msg);
};
};
})(PS["Partial"] = PS["Partial"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Partial"];
exports["crashWith"] = $foreign.crashWith;
})(PS["Partial"] = PS["Partial"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Partial.Unsafe"];
var Partial = PS["Partial"];
var unsafeCrashWith = function (msg) {
return $foreign.unsafePartial(function (dictPartial) {
return Partial.crashWith(dictPartial)(msg);
});
};
exports["unsafeCrashWith"] = unsafeCrashWith;
})(PS["Partial.Unsafe"] = PS["Partial.Unsafe"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad = PS["Control.Monad"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Bifunctor = PS["Data.Bifunctor"];
var Data_Either = PS["Data.Either"];
var Data_Functor = PS["Data.Functor"];
var Data_Identity = PS["Data.Identity"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Unit = PS["Data.Unit"];
var Effect = PS["Effect"];
var Effect_Ref = PS["Effect.Ref"];
var Partial_Unsafe = PS["Partial.Unsafe"];
var Prelude = PS["Prelude"];
var Loop = (function () {
function Loop(value0) {
this.value0 = value0;
};
Loop.create = function (value0) {
return new Loop(value0);
};
return Loop;
})();
var Done = (function () {
function Done(value0) {
this.value0 = value0;
};
Done.create = function (value0) {
return new Done(value0);
};
return Done;
})();
var MonadRec = function (Monad0, tailRecM) {
this.Monad0 = Monad0;
this.tailRecM = tailRecM;
};
var tailRecM = function (dict) {
return dict.tailRecM;
};
exports["Loop"] = Loop;
exports["Done"] = Done;
exports["MonadRec"] = MonadRec;
exports["tailRecM"] = tailRecM;
})(PS["Control.Monad.Rec.Class"] = PS["Control.Monad.Rec.Class"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Biapplicative = PS["Control.Biapplicative"];
var Control_Biapply = PS["Control.Biapply"];
var Control_Bind = PS["Control.Bind"];
var Control_Comonad = PS["Control.Comonad"];
var Control_Extend = PS["Control.Extend"];
var Control_Lazy = PS["Control.Lazy"];
var Control_Monad = PS["Control.Monad"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Bifoldable = PS["Data.Bifoldable"];
var Data_Bifunctor = PS["Data.Bifunctor"];
var Data_Bitraversable = PS["Data.Bitraversable"];
var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
var Data_Bounded = PS["Data.Bounded"];
var Data_CommutativeRing = PS["Data.CommutativeRing"];
var Data_Distributive = PS["Data.Distributive"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Functor_Invariant = PS["Data.Functor.Invariant"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Maybe_First = PS["Data.Maybe.First"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Newtype = PS["Data.Newtype"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Ring = PS["Data.Ring"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Unit = PS["Data.Unit"];
var Prelude = PS["Prelude"];
var Type_Equality = PS["Type.Equality"];
var Tuple = (function () {
function Tuple(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Tuple.create = function (value0) {
return function (value1) {
return new Tuple(value0, value1);
};
};
return Tuple;
})();
var snd = function (v) {
return v.value1;
};
var fst = function (v) {
return v.value0;
};
exports["Tuple"] = Tuple;
exports["fst"] = fst;
exports["snd"] = snd;
})(PS["Data.Tuple"] = PS["Data.Tuple"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Data_Tuple = PS["Data.Tuple"];
var Data_Unit = PS["Data.Unit"];
var Prelude = PS["Prelude"];
var MonadState = function (Monad0, state) {
this.Monad0 = Monad0;
this.state = state;
};
var state = function (dict) {
return dict.state;
};
var put = function (dictMonadState) {
return function (s) {
return state(dictMonadState)(function (v) {
return new Data_Tuple.Tuple(Data_Unit.unit, s);
});
};
};
var get = function (dictMonadState) {
return state(dictMonadState)(function (s) {
return new Data_Tuple.Tuple(s, s);
});
};
exports["state"] = state;
exports["MonadState"] = MonadState;
exports["get"] = get;
exports["put"] = put;
})(PS["Control.Monad.State.Class"] = PS["Control.Monad.State.Class"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Prelude = PS["Prelude"];
var MonadTrans = function (lift) {
this.lift = lift;
};
var lift = function (dict) {
return dict.lift;
};
exports["lift"] = lift;
exports["MonadTrans"] = MonadTrans;
})(PS["Control.Monad.Trans.Class"] = PS["Control.Monad.Trans.Class"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Category = PS["Control.Category"];
var Control_Monad = PS["Control.Monad"];
var Effect = PS["Effect"];
var MonadEffect = function (Monad0, liftEffect) {
this.Monad0 = Monad0;
this.liftEffect = liftEffect;
};
var liftEffect = function (dict) {
return dict.liftEffect;
};
exports["liftEffect"] = liftEffect;
exports["MonadEffect"] = MonadEffect;
})(PS["Effect.Class"] = PS["Effect.Class"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Monad = PS["Control.Monad"];
var Control_Monad_Cont_Class = PS["Control.Monad.Cont.Class"];
var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
var Control_Monad_Reader_Class = PS["Control.Monad.Reader.Class"];
var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
var Control_Monad_Writer_Class = PS["Control.Monad.Writer.Class"];
var Control_MonadPlus = PS["Control.MonadPlus"];
var Control_MonadZero = PS["Control.MonadZero"];
var Control_Plus = PS["Control.Plus"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Newtype = PS["Data.Newtype"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Tuple = PS["Data.Tuple"];
var Effect_Class = PS["Effect.Class"];
var Prelude = PS["Prelude"];
var ExceptT = function (x) {
return x;
};
var runExceptT = function (v) {
return v;
};
var mapExceptT = function (f) {
return function (v) {
return f(v);
};
};
var functorExceptT = function (dictFunctor) {
return new Data_Functor.Functor(function (f) {
return mapExceptT(Data_Functor.map(dictFunctor)(Data_Functor.map(Data_Either.functorEither)(f)));
});
};
var monadExceptT = function (dictMonad) {
return new Control_Monad.Monad(function () {
return applicativeExceptT(dictMonad);
}, function () {
return bindExceptT(dictMonad);
});
};
var bindExceptT = function (dictMonad) {
return new Control_Bind.Bind(function () {
return applyExceptT(dictMonad);
}, function (v) {
return function (k) {
return Control_Bind.bind(dictMonad.Bind1())(v)(Data_Either.either(function ($97) {
return Control_Applicative.pure(dictMonad.Applicative0())(Data_Either.Left.create($97));
})(function (a) {
var v1 = k(a);
return v1;
}));
};
});
};
var applyExceptT = function (dictMonad) {
return new Control_Apply.Apply(function () {
return functorExceptT(((dictMonad.Bind1()).Apply0()).Functor0());
}, Control_Monad.ap(monadExceptT(dictMonad)));
};
var applicativeExceptT = function (dictMonad) {
return new Control_Applicative.Applicative(function () {
return applyExceptT(dictMonad);
}, function ($98) {
return ExceptT(Control_Applicative.pure(dictMonad.Applicative0())(Data_Either.Right.create($98)));
});
};
var monadThrowExceptT = function (dictMonad) {
return new Control_Monad_Error_Class.MonadThrow(function () {
return monadExceptT(dictMonad);
}, function ($102) {
return ExceptT(Control_Applicative.pure(dictMonad.Applicative0())(Data_Either.Left.create($102)));
});
};
var altExceptT = function (dictSemigroup) {
return function (dictMonad) {
return new Control_Alt.Alt(function () {
return functorExceptT(((dictMonad.Bind1()).Apply0()).Functor0());
}, function (v) {
return function (v1) {
return Control_Bind.bind(dictMonad.Bind1())(v)(function (v2) {
if (v2 instanceof Data_Either.Right) {
return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Either.Right(v2.value0));
};
if (v2 instanceof Data_Either.Left) {
return Control_Bind.bind(dictMonad.Bind1())(v1)(function (v3) {
if (v3 instanceof Data_Either.Right) {
return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Either.Right(v3.value0));
};
if (v3 instanceof Data_Either.Left) {
return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Either.Left(Data_Semigroup.append(dictSemigroup)(v2.value0)(v3.value0)));
};
throw new Error("Failed pattern match at Control.Monad.Except.Trans line 86, column 9 - line 88, column 49: " + [ v3.constructor.name ]);
});
};
throw new Error("Failed pattern match at Control.Monad.Except.Trans line 82, column 5 - line 88, column 49: " + [ v2.constructor.name ]);
});
};
});
};
};
exports["ExceptT"] = ExceptT;
exports["runExceptT"] = runExceptT;
exports["mapExceptT"] = mapExceptT;
exports["functorExceptT"] = functorExceptT;
exports["applyExceptT"] = applyExceptT;
exports["applicativeExceptT"] = applicativeExceptT;
exports["bindExceptT"] = bindExceptT;
exports["monadExceptT"] = monadExceptT;
exports["altExceptT"] = altExceptT;
exports["monadThrowExceptT"] = monadThrowExceptT;
})(PS["Control.Monad.Except.Trans"] = PS["Control.Monad.Except.Trans"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Identity = PS["Data.Identity"];
var Data_Newtype = PS["Data.Newtype"];
var Prelude = PS["Prelude"];
var runExcept = function ($0) {
return Data_Newtype.unwrap(Data_Identity.newtypeIdentity)(Control_Monad_Except_Trans.runExceptT($0));
};
var mapExcept = function (f) {
return Control_Monad_Except_Trans.mapExceptT(function ($1) {
return Data_Identity.Identity(f(Data_Newtype.unwrap(Data_Identity.newtypeIdentity)($1)));
});
};
exports["runExcept"] = runExcept;
exports["mapExcept"] = mapExcept;
})(PS["Control.Monad.Except"] = PS["Control.Monad.Except"] || {});
(function(exports) {
"use strict";
exports.unfoldrArrayImpl = function (isNothing) {
return function (fromJust) {
return function (fst) {
return function (snd) {
return function (f) {
return function (b) {
var result = [];
var value = b;
while (true) { // eslint-disable-line no-constant-condition
var maybe = f(value);
if (isNothing(maybe)) return result;
var tuple = fromJust(maybe);
result.push(fst(tuple));
value = snd(tuple);
}
};
};
};
};
};
};
})(PS["Data.Unfoldable"] = PS["Data.Unfoldable"] || {});
(function(exports) {
"use strict";
exports.unfoldr1ArrayImpl = function (isNothing) {
return function (fromJust) {
return function (fst) {
return function (snd) {
return function (f) {
return function (b) {
var result = [];
var value = b;
while (true) { // eslint-disable-line no-constant-condition
var tuple = f(value);
result.push(fst(tuple));
var maybe = snd(tuple);
if (isNothing(maybe)) return result;
value = fromJust(maybe);
}
};
};
};
};
};
};
})(PS["Data.Unfoldable1"] = PS["Data.Unfoldable1"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Unfoldable1"];
var Data_Boolean = PS["Data.Boolean"];
var Data_Eq = PS["Data.Eq"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Ord = PS["Data.Ord"];
var Data_Ring = PS["Data.Ring"];
var Data_Semigroup_Traversable = PS["Data.Semigroup.Traversable"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Tuple = PS["Data.Tuple"];
var Partial_Unsafe = PS["Partial.Unsafe"];
var Prelude = PS["Prelude"];
var Unfoldable1 = function (unfoldr1) {
this.unfoldr1 = unfoldr1;
};
var unfoldr1 = function (dict) {
return dict.unfoldr1;
};
var unfoldable1Array = new Unfoldable1($foreign.unfoldr1ArrayImpl(Data_Maybe.isNothing)(Data_Maybe.fromJust())(Data_Tuple.fst)(Data_Tuple.snd));
exports["Unfoldable1"] = Unfoldable1;
exports["unfoldr1"] = unfoldr1;
exports["unfoldable1Array"] = unfoldable1Array;
})(PS["Data.Unfoldable1"] = PS["Data.Unfoldable1"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Unfoldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Ord = PS["Data.Ord"];
var Data_Ring = PS["Data.Ring"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable1 = PS["Data.Unfoldable1"];
var Data_Unit = PS["Data.Unit"];
var Partial_Unsafe = PS["Partial.Unsafe"];
var Prelude = PS["Prelude"];
var Unfoldable = function (Unfoldable10, unfoldr) {
this.Unfoldable10 = Unfoldable10;
this.unfoldr = unfoldr;
};
var unfoldr = function (dict) {
return dict.unfoldr;
};
var unfoldableArray = new Unfoldable(function () {
return Data_Unfoldable1.unfoldable1Array;
}, $foreign.unfoldrArrayImpl(Data_Maybe.isNothing)(Data_Maybe.fromJust())(Data_Tuple.fst)(Data_Tuple.snd));
exports["Unfoldable"] = Unfoldable;
exports["unfoldr"] = unfoldr;
exports["unfoldableArray"] = unfoldableArray;
})(PS["Data.Unfoldable"] = PS["Data.Unfoldable"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Category = PS["Control.Category"];
var Control_Plus = PS["Control.Plus"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semigroup_Foldable = PS["Data.Semigroup.Foldable"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Data_Unfoldable1 = PS["Data.Unfoldable1"];
var Prelude = PS["Prelude"];
var NonEmpty = (function () {
function NonEmpty(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
NonEmpty.create = function (value0) {
return function (value1) {
return new NonEmpty(value0, value1);
};
};
return NonEmpty;
})();
var singleton = function (dictPlus) {
return function (a) {
return new NonEmpty(a, Control_Plus.empty(dictPlus));
};
};
var showNonEmpty = function (dictShow) {
return function (dictShow1) {
return new Data_Show.Show(function (v) {
return "(NonEmpty " + (Data_Show.show(dictShow)(v.value0) + (" " + (Data_Show.show(dictShow1)(v.value1) + ")")));
});
};
};
var functorNonEmpty = function (dictFunctor) {
return new Data_Functor.Functor(function (f) {
return function (m) {
return new NonEmpty(f(m.value0), Data_Functor.map(dictFunctor)(f)(m.value1));
};
});
};
exports["NonEmpty"] = NonEmpty;
exports["singleton"] = singleton;
exports["showNonEmpty"] = showNonEmpty;
exports["functorNonEmpty"] = functorNonEmpty;
})(PS["Data.NonEmpty"] = PS["Data.NonEmpty"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Comonad = PS["Control.Comonad"];
var Control_Extend = PS["Control.Extend"];
var Control_Monad = PS["Control.Monad"];
var Control_MonadPlus = PS["Control.MonadPlus"];
var Control_MonadZero = PS["Control.MonadZero"];
var Control_Plus = PS["Control.Plus"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Newtype = PS["Data.Newtype"];
var Data_NonEmpty = PS["Data.NonEmpty"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Ring = PS["Data.Ring"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semigroup_Foldable = PS["Data.Semigroup.Foldable"];
var Data_Semigroup_Traversable = PS["Data.Semigroup.Traversable"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Data_Unfoldable1 = PS["Data.Unfoldable1"];
var Prelude = PS["Prelude"];
var Nil = (function () {
function Nil() {
};
Nil.value = new Nil();
return Nil;
})();
var Cons = (function () {
function Cons(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Cons.create = function (value0) {
return function (value1) {
return new Cons(value0, value1);
};
};
return Cons;
})();
var NonEmptyList = function (x) {
return x;
};
var toList = function (v) {
return new Cons(v.value0, v.value1);
};
var foldableList = new Data_Foldable.Foldable(function (dictMonoid) {
return function (f) {
return Data_Foldable.foldl(foldableList)(function (acc) {
return function ($174) {
return Data_Semigroup.append(dictMonoid.Semigroup0())(acc)(f($174));
};
})(Data_Monoid.mempty(dictMonoid));
};
}, function (f) {
var go = function ($copy_b) {
return function ($copy_v) {
var $tco_var_b = $copy_b;
var $tco_done = false;
var $tco_result;
function $tco_loop(b, v) {
if (v instanceof Nil) {
$tco_done = true;
return b;
};
if (v instanceof Cons) {
$tco_var_b = f(b)(v.value0);
$copy_v = v.value1;
return;
};
throw new Error("Failed pattern match at Data.List.Types line 81, column 12 - line 83, column 30: " + [ v.constructor.name ]);
};
while (!$tco_done) {
$tco_result = $tco_loop($tco_var_b, $copy_v);
};
return $tco_result;
};
};
return go;
}, function (f) {
return function (b) {
var rev = Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value);
return function ($175) {
return Data_Foldable.foldl(foldableList)(Data_Function.flip(f))(b)(rev($175));
};
};
});
var functorList = new Data_Functor.Functor(function (f) {
return Data_Foldable.foldr(foldableList)(function (x) {
return function (acc) {
return new Cons(f(x), acc);
};
})(Nil.value);
});
var functorNonEmptyList = Data_NonEmpty.functorNonEmpty(functorList);
var semigroupList = new Data_Semigroup.Semigroup(function (xs) {
return function (ys) {
return Data_Foldable.foldr(foldableList)(Cons.create)(ys)(xs);
};
});
var semigroupNonEmptyList = new Data_Semigroup.Semigroup(function (v) {
return function (as$prime) {
return new Data_NonEmpty.NonEmpty(v.value0, Data_Semigroup.append(semigroupList)(v.value1)(toList(as$prime)));
};
});
var showList = function (dictShow) {
return new Data_Show.Show(function (v) {
if (v instanceof Nil) {
return "Nil";
};
return "(" + (Data_Foldable.intercalate(foldableList)(Data_Monoid.monoidString)(" : ")(Data_Functor.map(functorList)(Data_Show.show(dictShow))(v)) + " : Nil)");
});
};
var showNonEmptyList = function (dictShow) {
return new Data_Show.Show(function (v) {
return "(NonEmptyList " + (Data_Show.show(Data_NonEmpty.showNonEmpty(dictShow)(showList(dictShow)))(v) + ")");
});
};
var applyList = new Control_Apply.Apply(function () {
return functorList;
}, function (v) {
return function (v1) {
if (v instanceof Nil) {
return Nil.value;
};
if (v instanceof Cons) {
return Data_Semigroup.append(semigroupList)(Data_Functor.map(functorList)(v.value0)(v1))(Control_Apply.apply(applyList)(v.value1)(v1));
};
throw new Error("Failed pattern match at Data.List.Types line 127, column 1 - line 127, column 33: " + [ v.constructor.name, v1.constructor.name ]);
};
});
var applyNonEmptyList = new Control_Apply.Apply(function () {
return functorNonEmptyList;
}, function (v) {
return function (v1) {
return new Data_NonEmpty.NonEmpty(v.value0(v1.value0), Data_Semigroup.append(semigroupList)(Control_Apply.apply(applyList)(v.value1)(new Cons(v1.value0, Nil.value)))(Control_Apply.apply(applyList)(new Cons(v.value0, v.value1))(v1.value1)));
};
});
var altList = new Control_Alt.Alt(function () {
return functorList;
}, Data_Semigroup.append(semigroupList));
var plusList = new Control_Plus.Plus(function () {
return altList;
}, Nil.value);
var applicativeNonEmptyList = new Control_Applicative.Applicative(function () {
return applyNonEmptyList;
}, function ($188) {
return NonEmptyList(Data_NonEmpty.singleton(plusList)($188));
});
exports["Nil"] = Nil;
exports["Cons"] = Cons;
exports["NonEmptyList"] = NonEmptyList;
exports["toList"] = toList;
exports["showList"] = showList;
exports["semigroupList"] = semigroupList;
exports["functorList"] = functorList;
exports["foldableList"] = foldableList;
exports["applyList"] = applyList;
exports["altList"] = altList;
exports["plusList"] = plusList;
exports["showNonEmptyList"] = showNonEmptyList;
exports["functorNonEmptyList"] = functorNonEmptyList;
exports["applyNonEmptyList"] = applyNonEmptyList;
exports["applicativeNonEmptyList"] = applicativeNonEmptyList;
exports["semigroupNonEmptyList"] = semigroupNonEmptyList;
})(PS["Data.List.Types"] = PS["Data.List.Types"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Lazy = PS["Control.Lazy"];
var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Bifunctor = PS["Data.Bifunctor"];
var Data_Boolean = PS["Data.Boolean"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Newtype = PS["Data.Newtype"];
var Data_NonEmpty = PS["Data.NonEmpty"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Ring = PS["Data.Ring"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Data_Unit = PS["Data.Unit"];
var Prelude = PS["Prelude"];
var uncons = function (v) {
if (v instanceof Data_List_Types.Nil) {
return Data_Maybe.Nothing.value;
};
if (v instanceof Data_List_Types.Cons) {
return new Data_Maybe.Just({
head: v.value0,
tail: v.value1
});
};
throw new Error("Failed pattern match at Data.List line 259, column 1 - line 259, column 66: " + [ v.constructor.name ]);
};
var toUnfoldable = function (dictUnfoldable) {
return Data_Unfoldable.unfoldr(dictUnfoldable)(function (xs) {
return Data_Functor.map(Data_Maybe.functorMaybe)(function (rec) {
return new Data_Tuple.Tuple(rec.head, rec.tail);
})(uncons(xs));
});
};
var tail = function (v) {
if (v instanceof Data_List_Types.Nil) {
return Data_Maybe.Nothing.value;
};
if (v instanceof Data_List_Types.Cons) {
return new Data_Maybe.Just(v.value1);
};
throw new Error("Failed pattern match at Data.List line 245, column 1 - line 245, column 43: " + [ v.constructor.name ]);
};
var singleton = function (a) {
return new Data_List_Types.Cons(a, Data_List_Types.Nil.value);
};
var reverse = (function () {
var go = function ($copy_acc) {
return function ($copy_v) {
var $tco_var_acc = $copy_acc;
var $tco_done = false;
var $tco_result;
function $tco_loop(acc, v) {
if (v instanceof Data_List_Types.Nil) {
$tco_done = true;
return acc;
};
if (v instanceof Data_List_Types.Cons) {
$tco_var_acc = new Data_List_Types.Cons(v.value0, acc);
$copy_v = v.value1;
return;
};
throw new Error("Failed pattern match at Data.List line 368, column 3 - line 368, column 19: " + [ acc.constructor.name, v.constructor.name ]);
};
while (!$tco_done) {
$tco_result = $tco_loop($tco_var_acc, $copy_v);
};
return $tco_result;
};
};
return go(Data_List_Types.Nil.value);
})();
var $$null = function (v) {
if (v instanceof Data_List_Types.Nil) {
return true;
};
return false;
};
var head = function (v) {
if (v instanceof Data_List_Types.Nil) {
return Data_Maybe.Nothing.value;
};
if (v instanceof Data_List_Types.Cons) {
return new Data_Maybe.Just(v.value0);
};
throw new Error("Failed pattern match at Data.List line 230, column 1 - line 230, column 22: " + [ v.constructor.name ]);
};
var fromFoldable = function (dictFoldable) {
return Data_Foldable.foldr(dictFoldable)(Data_List_Types.Cons.create)(Data_List_Types.Nil.value);
};
exports["toUnfoldable"] = toUnfoldable;
exports["fromFoldable"] = fromFoldable;
exports["singleton"] = singleton;
exports["null"] = $$null;
exports["head"] = head;
exports["tail"] = tail;
exports["uncons"] = uncons;
exports["reverse"] = reverse;
})(PS["Data.List"] = PS["Data.List"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad = PS["Control.Monad"];
var Control_MonadPlus = PS["Control.MonadPlus"];
var Control_MonadZero = PS["Control.MonadZero"];
var Control_Plus = PS["Control.Plus"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_List = PS["Data.List"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Data_Unfoldable1 = PS["Data.Unfoldable1"];
var Prelude = PS["Prelude"];
var CatQueue = (function () {
function CatQueue(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
CatQueue.create = function (value0) {
return function (value1) {
return new CatQueue(value0, value1);
};
};
return CatQueue;
})();
var uncons = function ($copy_v) {
var $tco_done = false;
var $tco_result;
function $tco_loop(v) {
if (v.value0 instanceof Data_List_Types.Nil && v.value1 instanceof Data_List_Types.Nil) {
$tco_done = true;
return Data_Maybe.Nothing.value;
};
if (v.value0 instanceof Data_List_Types.Nil) {
$copy_v = new CatQueue(Data_List.reverse(v.value1), Data_List_Types.Nil.value);
return;
};
if (v.value0 instanceof Data_List_Types.Cons) {
$tco_done = true;
return new Data_Maybe.Just(new Data_Tuple.Tuple(v.value0.value0, new CatQueue(v.value0.value1, v.value1)));
};
throw new Error("Failed pattern match at Data.CatQueue line 83, column 1 - line 83, column 63: " + [ v.constructor.name ]);
};
while (!$tco_done) {
$tco_result = $tco_loop($copy_v);
};
return $tco_result;
};
var snoc = function (v) {
return function (a) {
return new CatQueue(v.value0, new Data_List_Types.Cons(a, v.value1));
};
};
var $$null = function (v) {
if (v.value0 instanceof Data_List_Types.Nil && v.value1 instanceof Data_List_Types.Nil) {
return true;
};
return false;
};
var empty = new CatQueue(Data_List_Types.Nil.value, Data_List_Types.Nil.value);
exports["CatQueue"] = CatQueue;
exports["empty"] = empty;
exports["null"] = $$null;
exports["snoc"] = snoc;
exports["uncons"] = uncons;
})(PS["Data.CatQueue"] = PS["Data.CatQueue"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad = PS["Control.Monad"];
var Control_MonadPlus = PS["Control.MonadPlus"];
var Control_MonadZero = PS["Control.MonadZero"];
var Control_Plus = PS["Control.Plus"];
var Data_CatQueue = PS["Data.CatQueue"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_List = PS["Data.List"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Data_Unfoldable1 = PS["Data.Unfoldable1"];
var Prelude = PS["Prelude"];
var CatNil = (function () {
function CatNil() {
};
CatNil.value = new CatNil();
return CatNil;
})();
var CatCons = (function () {
function CatCons(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
CatCons.create = function (value0) {
return function (value1) {
return new CatCons(value0, value1);
};
};
return CatCons;
})();
var link = function (v) {
return function (cat) {
if (v instanceof CatNil) {
return cat;
};
if (v instanceof CatCons) {
return new CatCons(v.value0, Data_CatQueue.snoc(v.value1)(cat));
};
throw new Error("Failed pattern match at Data.CatList line 111, column 1 - line 111, column 54: " + [ v.constructor.name, cat.constructor.name ]);
};
};
var foldr = function (k) {
return function (b) {
return function (q) {
var foldl = function ($copy_v) {
return function ($copy_c) {
return function ($copy_v1) {
var $tco_var_v = $copy_v;
var $tco_var_c = $copy_c;
var $tco_done = false;
var $tco_result;
function $tco_loop(v, c, v1) {
if (v1 instanceof Data_List_Types.Nil) {
$tco_done = true;
return c;
};
if (v1 instanceof Data_List_Types.Cons) {
$tco_var_v = v;
$tco_var_c = v(c)(v1.value0);
$copy_v1 = v1.value1;
return;
};
throw new Error("Failed pattern match at Data.CatList line 126, column 3 - line 126, column 59: " + [ v.constructor.name, c.constructor.name, v1.constructor.name ]);
};
while (!$tco_done) {
$tco_result = $tco_loop($tco_var_v, $tco_var_c, $copy_v1);
};
return $tco_result;
};
};
};
var go = function ($copy_xs) {
return function ($copy_ys) {
var $tco_var_xs = $copy_xs;
var $tco_done = false;
var $tco_result;
function $tco_loop(xs, ys) {
var v = Data_CatQueue.uncons(xs);
if (v instanceof Data_Maybe.Nothing) {
$tco_done = true;
return foldl(function (x) {
return function (i) {
return i(x);
};
})(b)(ys);
};
if (v instanceof Data_Maybe.Just) {
$tco_var_xs = v.value0.value1;
$copy_ys = new Data_List_Types.Cons(k(v.value0.value0), ys);
return;
};
throw new Error("Failed pattern match at Data.CatList line 122, column 14 - line 124, column 67: " + [ v.constructor.name ]);
};
while (!$tco_done) {
$tco_result = $tco_loop($tco_var_xs, $copy_ys);
};
return $tco_result;
};
};
return go(q)(Data_List_Types.Nil.value);
};
};
};
var uncons = function (v) {
if (v instanceof CatNil) {
return Data_Maybe.Nothing.value;
};
if (v instanceof CatCons) {
return new Data_Maybe.Just(new Data_Tuple.Tuple(v.value0, (function () {
var $45 = Data_CatQueue["null"](v.value1);
if ($45) {
return CatNil.value;
};
return foldr(link)(CatNil.value)(v.value1);
})()));
};
throw new Error("Failed pattern match at Data.CatList line 102, column 1 - line 102, column 61: " + [ v.constructor.name ]);
};
var empty = CatNil.value;
var append = function (v) {
return function (v1) {
if (v1 instanceof CatNil) {
return v;
};
if (v instanceof CatNil) {
return v1;
};
return link(v)(v1);
};
};
var semigroupCatList = new Data_Semigroup.Semigroup(append);
var snoc = function (cat) {
return function (a) {
return append(cat)(new CatCons(a, Data_CatQueue.empty));
};
};
exports["CatNil"] = CatNil;
exports["CatCons"] = CatCons;
exports["empty"] = empty;
exports["append"] = append;
exports["snoc"] = snoc;
exports["uncons"] = uncons;
exports["semigroupCatList"] = semigroupCatList;
})(PS["Data.CatList"] = PS["Data.CatList"] || {});
(function(exports) {
"use strict";
// module Unsafe.Coerce
exports.unsafeCoerce = function (x) {
return x;
};
})(PS["Unsafe.Coerce"] = PS["Unsafe.Coerce"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Unsafe.Coerce"];
exports["unsafeCoerce"] = $foreign.unsafeCoerce;
})(PS["Unsafe.Coerce"] = PS["Unsafe.Coerce"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Monad = PS["Control.Monad"];
var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_CatList = PS["Data.CatList"];
var Data_Either = PS["Data.Either"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Tuple = PS["Data.Tuple"];
var Prelude = PS["Prelude"];
var Unsafe_Coerce = PS["Unsafe.Coerce"];
var Free = (function () {
function Free(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Free.create = function (value0) {
return function (value1) {
return new Free(value0, value1);
};
};
return Free;
})();
var Return = (function () {
function Return(value0) {
this.value0 = value0;
};
Return.create = function (value0) {
return new Return(value0);
};
return Return;
})();
var Bind = (function () {
function Bind(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Bind.create = function (value0) {
return function (value1) {
return new Bind(value0, value1);
};
};
return Bind;
})();
var toView = function ($copy_v) {
var $tco_done = false;
var $tco_result;
function $tco_loop(v) {
var runExpF = function (v2) {
return v2;
};
var concatF = function (v2) {
return function (r) {
return new Free(v2.value0, Data_Semigroup.append(Data_CatList.semigroupCatList)(v2.value1)(r));
};
};
if (v.value0 instanceof Return) {
var v2 = Data_CatList.uncons(v.value1);
if (v2 instanceof Data_Maybe.Nothing) {
$tco_done = true;
return new Return(v.value0.value0);
};
if (v2 instanceof Data_Maybe.Just) {
$copy_v = concatF(runExpF(v2.value0.value0)(v.value0.value0))(v2.value0.value1);
return;
};
throw new Error("Failed pattern match at Control.Monad.Free line 220, column 7 - line 224, column 64: " + [ v2.constructor.name ]);
};
if (v.value0 instanceof Bind) {
$tco_done = true;
return new Bind(v.value0.value0, function (a) {
return concatF(v.value0.value1(a))(v.value1);
});
};
throw new Error("Failed pattern match at Control.Monad.Free line 218, column 3 - line 226, column 56: " + [ v.value0.constructor.name ]);
};
while (!$tco_done) {
$tco_result = $tco_loop($copy_v);
};
return $tco_result;
};
var fromView = function (f) {
return new Free(f, Data_CatList.empty);
};
var freeMonad = new Control_Monad.Monad(function () {
return freeApplicative;
}, function () {
return freeBind;
});
var freeFunctor = new Data_Functor.Functor(function (k) {
return function (f) {
return Control_Bind.bindFlipped(freeBind)(function ($118) {
return Control_Applicative.pure(freeApplicative)(k($118));
})(f);
};
});
var freeBind = new Control_Bind.Bind(function () {
return freeApply;
}, function (v) {
return function (k) {
return new Free(v.value0, Data_CatList.snoc(v.value1)(k));
};
});
var freeApply = new Control_Apply.Apply(function () {
return freeFunctor;
}, Control_Monad.ap(freeMonad));
var freeApplicative = new Control_Applicative.Applicative(function () {
return freeApply;
}, function ($119) {
return fromView(Return.create($119));
});
var liftF = function (f) {
return fromView(new Bind(f, function ($120) {
return Control_Applicative.pure(freeApplicative)($120);
}));
};
var foldFree = function (dictMonadRec) {
return function (k) {
var go = function (f) {
var v = toView(f);
if (v instanceof Return) {
return Data_Functor.map((((dictMonadRec.Monad0()).Bind1()).Apply0()).Functor0())(Control_Monad_Rec_Class.Done.create)(Control_Applicative.pure((dictMonadRec.Monad0()).Applicative0())(v.value0));
};
if (v instanceof Bind) {
return Data_Functor.map((((dictMonadRec.Monad0()).Bind1()).Apply0()).Functor0())(function ($127) {
return Control_Monad_Rec_Class.Loop.create(v.value1($127));
})(k(v.value0));
};
throw new Error("Failed pattern match at Control.Monad.Free line 151, column 10 - line 153, column 37: " + [ v.constructor.name ]);
};
return Control_Monad_Rec_Class.tailRecM(dictMonadRec)(go);
};
};
exports["liftF"] = liftF;
exports["foldFree"] = foldFree;
exports["freeFunctor"] = freeFunctor;
exports["freeBind"] = freeBind;
exports["freeApplicative"] = freeApplicative;
exports["freeApply"] = freeApply;
exports["freeMonad"] = freeMonad;
})(PS["Control.Monad.Free"] = PS["Control.Monad.Free"] || {});
(function(exports) {
"use strict";
exports.map_ = function (f) {
return function (a) {
return function () {
return f(a());
};
};
};
exports.pure_ = function (a) {
return function () {
return a;
};
};
exports.bind_ = function (a) {
return function (f) {
return function () {
return f(a())();
};
};
};
})(PS["Control.Monad.ST.Internal"] = PS["Control.Monad.ST.Internal"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Control.Monad.ST.Internal"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad = PS["Control.Monad"];
var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
var Data_Functor = PS["Data.Functor"];
var Data_Unit = PS["Data.Unit"];
var Partial_Unsafe = PS["Partial.Unsafe"];
var Prelude = PS["Prelude"];
var functorST = new Data_Functor.Functor($foreign.map_);
var monadST = new Control_Monad.Monad(function () {
return applicativeST;
}, function () {
return bindST;
});
var bindST = new Control_Bind.Bind(function () {
return applyST;
}, $foreign.bind_);
var applyST = new Control_Apply.Apply(function () {
return functorST;
}, Control_Monad.ap(monadST));
var applicativeST = new Control_Applicative.Applicative(function () {
return applyST;
}, $foreign.pure_);
exports["functorST"] = functorST;
exports["applyST"] = applyST;
exports["applicativeST"] = applicativeST;
exports["bindST"] = bindST;
exports["monadST"] = monadST;
})(PS["Control.Monad.ST.Internal"] = PS["Control.Monad.ST.Internal"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Lazy = PS["Control.Lazy"];
var Control_Monad = PS["Control.Monad"];
var Control_Monad_Cont_Class = PS["Control.Monad.Cont.Class"];
var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
var Control_Monad_Reader_Class = PS["Control.Monad.Reader.Class"];
var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
var Control_Monad_Writer_Class = PS["Control.Monad.Writer.Class"];
var Control_MonadPlus = PS["Control.MonadPlus"];
var Control_MonadZero = PS["Control.MonadZero"];
var Control_Plus = PS["Control.Plus"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Newtype = PS["Data.Newtype"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unit = PS["Data.Unit"];
var Effect_Class = PS["Effect.Class"];
var Prelude = PS["Prelude"];
var StateT = function (x) {
return x;
};
var runStateT = function (v) {
return v;
};
var monadTransStateT = new Control_Monad_Trans_Class.MonadTrans(function (dictMonad) {
return function (m) {
return function (s) {
return Control_Bind.bind(dictMonad.Bind1())(m)(function (v) {
return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Tuple.Tuple(v, s));
});
};
};
});
var functorStateT = function (dictFunctor) {
return new Data_Functor.Functor(function (f) {
return function (v) {
return function (s) {
return Data_Functor.map(dictFunctor)(function (v1) {
return new Data_Tuple.Tuple(f(v1.value0), v1.value1);
})(v(s));
};
};
});
};
var evalStateT = function (dictFunctor) {
return function (v) {
return function (s) {
return Data_Functor.map(dictFunctor)(Data_Tuple.fst)(v(s));
};
};
};
var monadStateT = function (dictMonad) {
return new Control_Monad.Monad(function () {
return applicativeStateT(dictMonad);
}, function () {
return bindStateT(dictMonad);
});
};
var bindStateT = function (dictMonad) {
return new Control_Bind.Bind(function () {
return applyStateT(dictMonad);
}, function (v) {
return function (f) {
return function (s) {
return Control_Bind.bind(dictMonad.Bind1())(v(s))(function (v1) {
var v3 = f(v1.value0);
return v3(v1.value1);
});
};
};
});
};
var applyStateT = function (dictMonad) {
return new Control_Apply.Apply(function () {
return functorStateT(((dictMonad.Bind1()).Apply0()).Functor0());
}, Control_Monad.ap(monadStateT(dictMonad)));
};
var applicativeStateT = function (dictMonad) {
return new Control_Applicative.Applicative(function () {
return applyStateT(dictMonad);
}, function (a) {
return function (s) {
return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Tuple.Tuple(a, s));
};
});
};
var monadRecStateT = function (dictMonadRec) {
return new Control_Monad_Rec_Class.MonadRec(function () {
return monadStateT(dictMonadRec.Monad0());
}, function (f) {
return function (a) {
var f$prime = function (v) {
return Control_Bind.bind((dictMonadRec.Monad0()).Bind1())((function () {
var v1 = f(v.value0);
return v1;
})()(v.value1))(function (v1) {
return Control_Applicative.pure((dictMonadRec.Monad0()).Applicative0())((function () {
if (v1.value0 instanceof Control_Monad_Rec_Class.Loop) {
return new Control_Monad_Rec_Class.Loop(new Data_Tuple.Tuple(v1.value0.value0, v1.value1));
};
if (v1.value0 instanceof Control_Monad_Rec_Class.Done) {
return new Control_Monad_Rec_Class.Done(new Data_Tuple.Tuple(v1.value0.value0, v1.value1));
};
throw new Error("Failed pattern match at Control.Monad.State.Trans line 87, column 16 - line 89, column 40: " + [ v1.value0.constructor.name ]);
})());
});
};
return function (s) {
return Control_Monad_Rec_Class.tailRecM(dictMonadRec)(f$prime)(new Data_Tuple.Tuple(a, s));
};
};
});
};
var monadStateStateT = function (dictMonad) {
return new Control_Monad_State_Class.MonadState(function () {
return monadStateT(dictMonad);
}, function (f) {
return StateT(function ($111) {
return Control_Applicative.pure(dictMonad.Applicative0())(f($111));
});
});
};
var monadThrowStateT = function (dictMonadThrow) {
return new Control_Monad_Error_Class.MonadThrow(function () {
return monadStateT(dictMonadThrow.Monad0());
}, function (e) {
return Control_Monad_Trans_Class.lift(monadTransStateT)(dictMonadThrow.Monad0())(Control_Monad_Error_Class.throwError(dictMonadThrow)(e));
});
};
exports["StateT"] = StateT;
exports["runStateT"] = runStateT;
exports["evalStateT"] = evalStateT;
exports["functorStateT"] = functorStateT;
exports["applyStateT"] = applyStateT;
exports["applicativeStateT"] = applicativeStateT;
exports["bindStateT"] = bindStateT;
exports["monadStateT"] = monadStateT;
exports["monadRecStateT"] = monadRecStateT;
exports["monadTransStateT"] = monadTransStateT;
exports["monadThrowStateT"] = monadThrowStateT;
exports["monadStateStateT"] = monadStateStateT;
})(PS["Control.Monad.State.Trans"] = PS["Control.Monad.State.Trans"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad_Cont_Trans = PS["Control.Monad.Cont.Trans"];
var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
var Control_Monad_Maybe_Trans = PS["Control.Monad.Maybe.Trans"];
var Control_Monad_Reader_Trans = PS["Control.Monad.Reader.Trans"];
var Control_Monad_Writer_Trans = PS["Control.Monad.Writer.Trans"];
var Control_Plus = PS["Control.Plus"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Functor_Compose = PS["Data.Functor.Compose"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Newtype = PS["Data.Newtype"];
var Data_Unit = PS["Data.Unit"];
var Effect_Class = PS["Effect.Class"];
var Effect_Ref = PS["Effect.Ref"];
var Prelude = PS["Prelude"];
var Parallel = function (Applicative1, Monad0, parallel, sequential) {
this.Applicative1 = Applicative1;
this.Monad0 = Monad0;
this.parallel = parallel;
this.sequential = sequential;
};
var sequential = function (dict) {
return dict.sequential;
};
var parallel = function (dict) {
return dict.parallel;
};
exports["parallel"] = parallel;
exports["sequential"] = sequential;
exports["Parallel"] = Parallel;
})(PS["Control.Parallel.Class"] = PS["Control.Parallel.Class"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alternative = PS["Control.Alternative"];
var Control_Apply = PS["Control.Apply"];
var Control_Category = PS["Control.Category"];
var Control_Parallel_Class = PS["Control.Parallel.Class"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Traversable = PS["Data.Traversable"];
var Prelude = PS["Prelude"];
var parOneOf = function (dictParallel) {
return function (dictAlternative) {
return function (dictFoldable) {
return function (dictFunctor) {
return function ($23) {
return Control_Parallel_Class.sequential(dictParallel)(Data_Foldable.oneOfMap(dictFoldable)(dictAlternative.Plus1())(Control_Parallel_Class.parallel(dictParallel))($23));
};
};
};
};
};
exports["parOneOf"] = parOneOf;
})(PS["Control.Parallel"] = PS["Control.Parallel"] || {});
(function(exports) {
"use strict";
//------------------------------------------------------------------------------
// Array creation --------------------------------------------------------------
//------------------------------------------------------------------------------
exports.range = function (start) {
return function (end) {
var step = start > end ? -1 : 1;
var result = new Array(step * (end - start) + 1);
var i = start, n = 0;
while (i !== end) {
result[n++] = i;
i += step;
}
result[n] = i;
return result;
};
};
//------------------------------------------------------------------------------
// Array size ------------------------------------------------------------------
//------------------------------------------------------------------------------
exports.length = function (xs) {
return xs.length;
};
//------------------------------------------------------------------------------
// Zipping ---------------------------------------------------------------------
//------------------------------------------------------------------------------
exports.zipWith = function (f) {
return function (xs) {
return function (ys) {
var l = xs.length < ys.length ? xs.length : ys.length;
var result = new Array(l);
for (var i = 0; i < l; i++) {
result[i] = f(xs[i])(ys[i]);
}
return result;
};
};
};
})(PS["Data.Array"] = PS["Data.Array"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Array"];
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Lazy = PS["Control.Lazy"];
var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
var Control_Monad_ST = PS["Control.Monad.ST"];
var Control_Monad_ST_Internal = PS["Control.Monad.ST.Internal"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Array_NonEmpty_Internal = PS["Data.Array.NonEmpty.Internal"];
var Data_Array_ST = PS["Data.Array.ST"];
var Data_Array_ST_Iterator = PS["Data.Array.ST.Iterator"];
var Data_Boolean = PS["Data.Boolean"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Ring = PS["Data.Ring"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Partial_Unsafe = PS["Partial.Unsafe"];
var Prelude = PS["Prelude"];
var Unsafe_Coerce = PS["Unsafe.Coerce"];
exports["range"] = $foreign.range;
exports["length"] = $foreign.length;
exports["zipWith"] = $foreign.zipWith;
})(PS["Data.Array"] = PS["Data.Array"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Unsafe_Coerce = PS["Unsafe.Coerce"];
var runExists = Unsafe_Coerce.unsafeCoerce;
var mkExists = Unsafe_Coerce.unsafeCoerce;
exports["mkExists"] = mkExists;
exports["runExists"] = runExists;
})(PS["Data.Exists"] = PS["Data.Exists"] || {});
(function(exports) {
"use strict";
exports.runFn4 = function (fn) {
return function (a) {
return function (b) {
return function (c) {
return function (d) {
return fn(a, b, c, d);
};
};
};
};
};
})(PS["Data.Function.Uncurried"] = PS["Data.Function.Uncurried"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Data.Function.Uncurried"];
var Data_Unit = PS["Data.Unit"];
exports["runFn4"] = $foreign.runFn4;
})(PS["Data.Function.Uncurried"] = PS["Data.Function.Uncurried"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Data_Maybe = PS["Data.Maybe"];
var Inl = (function () {
function Inl(value0) {
this.value0 = value0;
};
Inl.create = function (value0) {
return new Inl(value0);
};
return Inl;
})();
var Inr = (function () {
function Inr(value0) {
this.value0 = value0;
};
Inr.create = function (value0) {
return new Inr(value0);
};
return Inr;
})();
var Product = (function () {
function Product(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Product.create = function (value0) {
return function (value1) {
return new Product(value0, value1);
};
};
return Product;
})();
var NoArguments = (function () {
function NoArguments() {
};
NoArguments.value = new NoArguments();
return NoArguments;
})();
var Constructor = function (x) {
return x;
};
var Generic = function (from, to) {
this.from = from;
this.to = to;
};
var to = function (dict) {
return dict.to;
};
var from = function (dict) {
return dict.from;
};
exports["Generic"] = Generic;
exports["to"] = to;
exports["from"] = from;
exports["NoArguments"] = NoArguments;
exports["Inl"] = Inl;
exports["Inr"] = Inr;
exports["Product"] = Product;
exports["Constructor"] = Constructor;
})(PS["Data.Generic.Rep"] = PS["Data.Generic.Rep"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Boolean = PS["Data.Boolean"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
var Data_List = PS["Data.List"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Maybe = PS["Data.Maybe"];
var Data_NonEmpty = PS["Data.NonEmpty"];
var Data_Ord = PS["Data.Ord"];
var Data_Ring = PS["Data.Ring"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semigroup_Foldable = PS["Data.Semigroup.Foldable"];
var Data_Semigroup_Traversable = PS["Data.Semigroup.Traversable"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Partial_Unsafe = PS["Partial.Unsafe"];
var Prelude = PS["Prelude"];
var singleton = function ($165) {
return Data_List_Types.NonEmptyList(Data_NonEmpty.singleton(Data_List_Types.plusList)($165));
};
exports["singleton"] = singleton;
})(PS["Data.List.NonEmpty"] = PS["Data.List.NonEmpty"] || {});
(function(exports) {
/* globals exports, setTimeout */
"use strict";
var AVar = function () {
function MutableQueue () {
this.head = null;
this.last = null;
this.size = 0;
}
function MutableCell (queue, value) {
this.queue = queue;
this.value = value;
this.next = null;
this.prev = null;
}
function AVar (value) {
this.draining = false;
this.error = null;
this.value = value;
this.takes = new MutableQueue();
this.reads = new MutableQueue();
this.puts = new MutableQueue();
}
var EMPTY = {};
function runEff(eff) {
try {
eff();
} catch (error) {
setTimeout(function () {
throw error;
}, 0);
}
}
function putLast (queue, value) {
var cell = new MutableCell(queue, value);
switch (queue.size) {
case 0:
queue.head = cell;
break;
case 1:
cell.prev = queue.head;
queue.head.next = cell;
queue.last = cell;
break;
default:
cell.prev = queue.last;
queue.last.next = cell;
queue.last = cell;
}
queue.size++;
return cell;
}
function takeLast (queue) {
var cell;
switch (queue.size) {
case 0:
return null;
case 1:
cell = queue.head;
queue.head = null;
break;
case 2:
cell = queue.last;
queue.head.next = null;
queue.last = null;
break;
default:
cell = queue.last;
queue.last = cell.prev;
queue.last.next = null;
}
cell.prev = null;
cell.queue = null;
queue.size--;
return cell.value;
}
function takeHead (queue) {
var cell;
switch (queue.size) {
case 0:
return null;
case 1:
cell = queue.head;
queue.head = null;
break;
case 2:
cell = queue.head;
queue.last.prev = null;
queue.head = queue.last;
queue.last = null;
break;
default:
cell = queue.head;
queue.head = cell.next;
queue.head.prev = null;
}
cell.next = null;
cell.queue = null;
queue.size--;
return cell.value;
}
function deleteCell (cell) {
if (cell.queue === null) {
return;
}
if (cell.queue.last === cell) {
takeLast(cell.queue);
return;
}
if (cell.queue.head === cell) {
takeHead(cell.queue);
return;
}
if (cell.prev) {
cell.prev.next = cell.next;
}
if (cell.next) {
cell.next.prev = cell.prev;
}
cell.queue.size--;
cell.queue = null;
cell.value = null;
cell.next = null;
cell.prev = null;
}
function drainVar (util, avar) {
if (avar.draining) {
return;
}
var ps = avar.puts;
var ts = avar.takes;
var rs = avar.reads;
var p, r, t, value, rsize;
avar.draining = true;
while (1) { // eslint-disable-line no-constant-condition
p = null;
r = null;
t = null;
value = avar.value;
rsize = rs.size;
if (avar.error !== null) {
value = util.left(avar.error);
while (p = takeHead(ps)) { // eslint-disable-line no-cond-assign
runEff(p.cb(value));
}
while (r = takeHead(rs)) { // eslint-disable-line no-cond-assign
runEff(r(value));
}
while (t = takeHead(ts)) { // eslint-disable-line no-cond-assign
runEff(t(value));
}
break;
}
// Process the next put. We do not immediately invoke the callback
// because we want to preserve ordering. If there are takes/reads
// we want to run those first.
if (value === EMPTY && (p = takeHead(ps))) {
avar.value = value = p.value;
}
if (value !== EMPTY) {
// We go ahead and queue up the next take for the same reasons as
// above. Invoking the read callbacks can affect the mutable queue.
t = takeHead(ts);
// We only want to process the reads queued up before running these
// callbacks so we guard on rsize.
while (rsize-- && (r = takeHead(rs))) {
runEff(r(util.right(value)));
}
if (t !== null) {
avar.value = EMPTY;
runEff(t(util.right(value)));
}
}
if (p !== null) {
runEff(p.cb(util.right(void 0)));
}
// Callbacks could have queued up more items so we need to guard on the
// actual mutable properties.
if (avar.value === EMPTY && ps.size === 0 || avar.value !== EMPTY && ts.size === 0) {
break;
}
}
avar.draining = false;
}
AVar.EMPTY = EMPTY;
AVar.putLast = putLast;
AVar.takeLast = takeLast;
AVar.takeHead = takeHead;
AVar.deleteCell = deleteCell;
AVar.drainVar = drainVar;
return AVar;
}();
exports.empty = function () {
return new AVar(AVar.EMPTY);
};
exports._newVar = function (value) {
return function () {
return new AVar(value);
};
};
exports._putVar = function (util, value, avar, cb) {
return function () {
var cell = AVar.putLast(avar.puts, { cb: cb, value: value });
AVar.drainVar(util, avar);
return function () {
AVar.deleteCell(cell);
};
};
};
exports._takeVar = function (util, avar, cb) {
return function () {
var cell = AVar.putLast(avar.takes, cb);
AVar.drainVar(util, avar);
return function () {
AVar.deleteCell(cell);
};
};
};
exports._readVar = function (util, avar, cb) {
return function () {
var cell = AVar.putLast(avar.reads, cb);
AVar.drainVar(util, avar);
return function () {
AVar.deleteCell(cell);
};
};
};
})(PS["Effect.AVar"] = PS["Effect.AVar"] || {});
(function(exports) {
"use strict";
exports.showErrorImpl = function (err) {
return err.stack || err.toString();
};
exports.error = function (msg) {
return new Error(msg);
};
exports.message = function (e) {
return e.message;
};
exports.catchException = function (c) {
return function (t) {
return function () {
try {
return t();
} catch (e) {
if (e instanceof Error || Object.prototype.toString.call(e) === "[object Error]") {
return c(e)();
} else {
return c(new Error(e.toString()))();
}
}
};
};
};
})(PS["Effect.Exception"] = PS["Effect.Exception"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Effect.Exception"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Functor = PS["Data.Functor"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Show = PS["Data.Show"];
var Effect = PS["Effect"];
var Prelude = PS["Prelude"];
var $$try = function (action) {
return $foreign.catchException(function ($0) {
return Control_Applicative.pure(Effect.applicativeEffect)(Data_Either.Left.create($0));
})(Data_Functor.map(Effect.functorEffect)(Data_Either.Right.create)(action));
};
var showError = new Data_Show.Show($foreign.showErrorImpl);
exports["try"] = $$try;
exports["showError"] = showError;
exports["error"] = $foreign.error;
exports["message"] = $foreign.message;
})(PS["Effect.Exception"] = PS["Effect.Exception"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Effect.AVar"];
var Data_Either = PS["Data.Either"];
var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
var Data_Maybe = PS["Data.Maybe"];
var Effect = PS["Effect"];
var Effect_Exception = PS["Effect.Exception"];
var Prelude = PS["Prelude"];
var Killed = (function () {
function Killed(value0) {
this.value0 = value0;
};
Killed.create = function (value0) {
return new Killed(value0);
};
return Killed;
})();
var Filled = (function () {
function Filled(value0) {
this.value0 = value0;
};
Filled.create = function (value0) {
return new Filled(value0);
};
return Filled;
})();
var Empty = (function () {
function Empty() {
};
Empty.value = new Empty();
return Empty;
})();
var $$new = $foreign._newVar;
var ffiUtil = {
left: Data_Either.Left.create,
right: Data_Either.Right.create,
nothing: Data_Maybe.Nothing.value,
just: Data_Maybe.Just.create,
killed: Killed.create,
filled: Filled.create,
empty: Empty.value
};
var put = function (value) {
return function (avar) {
return function (cb) {
return $foreign._putVar(ffiUtil, value, avar, cb);
};
};
};
var read = function (avar) {
return function (cb) {
return $foreign._readVar(ffiUtil, avar, cb);
};
};
var take = function (avar) {
return function (cb) {
return $foreign._takeVar(ffiUtil, avar, cb);
};
};
exports["Killed"] = Killed;
exports["Filled"] = Filled;
exports["Empty"] = Empty;
exports["new"] = $$new;
exports["take"] = take;
exports["put"] = put;
exports["read"] = read;
exports["empty"] = $foreign.empty;
})(PS["Effect.AVar"] = PS["Effect.AVar"] || {});
(function(exports) {
/* globals setImmediate, clearImmediate, setTimeout, clearTimeout */
/* jshint -W083, -W098, -W003 */
"use strict";
var Aff = function () {
// A unique value for empty.
var EMPTY = {};
/*
An awkward approximation. We elide evidence we would otherwise need in PS for
efficiency sake.
data Aff eff a
= Pure a
| Throw Error
| Catch (Aff eff a) (Error -> Aff eff a)
| Sync (Eff eff a)
| Async ((Either Error a -> Eff eff Unit) -> Eff eff (Canceler eff))
| forall b. Bind (Aff eff b) (b -> Aff eff a)
| forall b. Bracket (Aff eff b) (BracketConditions eff b) (b -> Aff eff a)
| forall b. Fork Boolean (Aff eff b) ?(Fiber eff b -> a)
| Sequential (ParAff aff a)
*/
var PURE = "Pure";
var THROW = "Throw";
var CATCH = "Catch";
var SYNC = "Sync";
var ASYNC = "Async";
var BIND = "Bind";
var BRACKET = "Bracket";
var FORK = "Fork";
var SEQ = "Sequential";
/*
data ParAff eff a
= forall b. Map (b -> a) (ParAff eff b)
| forall b. Apply (ParAff eff (b -> a)) (ParAff eff b)
| Alt (ParAff eff a) (ParAff eff a)
| ?Par (Aff eff a)
*/
var MAP = "Map";
var APPLY = "Apply";
var ALT = "Alt";
// Various constructors used in interpretation
var CONS = "Cons"; // Cons-list, for stacks
var RESUME = "Resume"; // Continue indiscriminately
var RELEASE = "Release"; // Continue with bracket finalizers
var FINALIZER = "Finalizer"; // A non-interruptible effect
var FINALIZED = "Finalized"; // Marker for finalization
var FORKED = "Forked"; // Reference to a forked fiber, with resumption stack
var FIBER = "Fiber"; // Actual fiber reference
var THUNK = "Thunk"; // Primed effect, ready to invoke
function Aff(tag, _1, _2, _3) {
this.tag = tag;
this._1 = _1;
this._2 = _2;
this._3 = _3;
}
function AffCtr(tag) {
var fn = function (_1, _2, _3) {
return new Aff(tag, _1, _2, _3);
};
fn.tag = tag;
return fn;
}
function nonCanceler(error) {
return new Aff(PURE, void 0);
}
function runEff(eff) {
try {
eff();
} catch (error) {
setTimeout(function () {
throw error;
}, 0);
}
}
function runSync(left, right, eff) {
try {
return right(eff());
} catch (error) {
return left(error);
}
}
function runAsync(left, eff, k) {
try {
return eff(k)();
} catch (error) {
k(left(error))();
return nonCanceler;
}
}
var Scheduler = function () {
var limit = 1024;
var size = 0;
var ix = 0;
var queue = new Array(limit);
var draining = false;
function drain() {
var thunk;
draining = true;
while (size !== 0) {
size--;
thunk = queue[ix];
queue[ix] = void 0;
ix = (ix + 1) % limit;
thunk();
}
draining = false;
}
return {
isDraining: function () {
return draining;
},
enqueue: function (cb) {
var i, tmp;
if (size === limit) {
tmp = draining;
drain();
draining = tmp;
}
queue[(ix + size) % limit] = cb;
size++;
if (!draining) {
drain();
}
}
};
}();
function Supervisor(util) {
var fibers = {};
var fiberId = 0;
var count = 0;
return {
register: function (fiber) {
var fid = fiberId++;
fiber.onComplete({
rethrow: true,
handler: function (result) {
return function () {
count--;
delete fibers[fid];
};
}
});
fibers[fid] = fiber;
count++;
},
isEmpty: function () {
return count === 0;
},
killAll: function (killError, cb) {
return function () {
var killCount = 0;
var kills = {};
function kill(fid) {
kills[fid] = fibers[fid].kill(killError, function (result) {
return function () {
delete kills[fid];
killCount--;
if (util.isLeft(result) && util.fromLeft(result)) {
setTimeout(function () {
throw util.fromLeft(result);
}, 0);
}
if (killCount === 0) {
cb();
}
};
})();
}
for (var k in fibers) {
if (fibers.hasOwnProperty(k)) {
killCount++;
kill(k);
}
}
fibers = {};
fiberId = 0;
count = 0;
return function (error) {
return new Aff(SYNC, function () {
for (var k in kills) {
if (kills.hasOwnProperty(k)) {
kills[k]();
}
}
});
};
};
}
};
}
// Fiber state machine
var SUSPENDED = 0; // Suspended, pending a join.
var CONTINUE = 1; // Interpret the next instruction.
var STEP_BIND = 2; // Apply the next bind.
var STEP_RESULT = 3; // Handle potential failure from a result.
var PENDING = 4; // An async effect is running.
var RETURN = 5; // The current stack has returned.
var COMPLETED = 6; // The entire fiber has completed.
function Fiber(util, supervisor, aff) {
// Monotonically increasing tick, increased on each asynchronous turn.
var runTick = 0;
// The current branch of the state machine.
var status = SUSPENDED;
// The current point of interest for the state machine branch.
var step = aff; // Successful step
var fail = null; // Failure step
var interrupt = null; // Asynchronous interrupt
// Stack of continuations for the current fiber.
var bhead = null;
var btail = null;
// Stack of attempts and finalizers for error recovery. Every `Cons` is also
// tagged with current `interrupt` state. We use this to track which items
// should be ignored or evaluated as a result of a kill.
var attempts = null;
// A special state is needed for Bracket, because it cannot be killed. When
// we enter a bracket acquisition or finalizer, we increment the counter,
// and then decrement once complete.
var bracketCount = 0;
// Each join gets a new id so they can be revoked.
var joinId = 0;
var joins = null;
var rethrow = true;
// Each invocation of `run` requires a tick. When an asynchronous effect is
// resolved, we must check that the local tick coincides with the fiber
// tick before resuming. This prevents multiple async continuations from
// accidentally resuming the same fiber. A common example may be invoking
// the provided callback in `makeAff` more than once, but it may also be an
// async effect resuming after the fiber was already cancelled.
function run(localRunTick) {
var tmp, result, attempt;
while (true) {
tmp = null;
result = null;
attempt = null;
switch (status) {
case STEP_BIND:
status = CONTINUE;
step = bhead(step);
if (btail === null) {
bhead = null;
} else {
bhead = btail._1;
btail = btail._2;
}
break;
case STEP_RESULT:
if (util.isLeft(step)) {
status = RETURN;
fail = step;
step = null;
} else if (bhead === null) {
status = RETURN;
} else {
status = STEP_BIND;
step = util.fromRight(step);
}
break;
case CONTINUE:
switch (step.tag) {
case BIND:
if (bhead) {
btail = new Aff(CONS, bhead, btail);
}
bhead = step._2;
status = CONTINUE;
step = step._1;
break;
case PURE:
if (bhead === null) {
status = RETURN;
step = util.right(step._1);
} else {
status = STEP_BIND;
step = step._1;
}
break;
case SYNC:
status = STEP_RESULT;
step = runSync(util.left, util.right, step._1);
break;
case ASYNC:
status = PENDING;
step = runAsync(util.left, step._1, function (result) {
return function () {
if (runTick !== localRunTick) {
return;
}
runTick++;
Scheduler.enqueue(function () {
// It's possible to interrupt the fiber between enqueuing and
// resuming, so we need to check that the runTick is still
// valid.
if (runTick !== localRunTick + 1) {
return;
}
status = STEP_RESULT;
step = result;
run(runTick);
});
};
});
return;
case THROW:
status = RETURN;
fail = util.left(step._1);
step = null;
break;
// Enqueue the Catch so that we can call the error handler later on
// in case of an exception.
case CATCH:
if (bhead === null) {
attempts = new Aff(CONS, step, attempts, interrupt);
} else {
attempts = new Aff(CONS, step, new Aff(CONS, new Aff(RESUME, bhead, btail), attempts, interrupt), interrupt);
}
bhead = null;
btail = null;
status = CONTINUE;
step = step._1;
break;
// Enqueue the Bracket so that we can call the appropriate handlers
// after resource acquisition.
case BRACKET:
bracketCount++;
if (bhead === null) {
attempts = new Aff(CONS, step, attempts, interrupt);
} else {
attempts = new Aff(CONS, step, new Aff(CONS, new Aff(RESUME, bhead, btail), attempts, interrupt), interrupt);
}
bhead = null;
btail = null;
status = CONTINUE;
step = step._1;
break;
case FORK:
status = STEP_RESULT;
tmp = Fiber(util, supervisor, step._2);
if (supervisor) {
supervisor.register(tmp);
}
if (step._1) {
tmp.run();
}
step = util.right(tmp);
break;
case SEQ:
status = CONTINUE;
step = sequential(util, supervisor, step._1);
break;
}
break;
case RETURN:
bhead = null;
btail = null;
// If the current stack has returned, and we have no other stacks to
// resume or finalizers to run, the fiber has halted and we can
// invoke all join callbacks. Otherwise we need to resume.
if (attempts === null) {
status = COMPLETED;
step = interrupt || fail || step;
} else {
// The interrupt status for the enqueued item.
tmp = attempts._3;
attempt = attempts._1;
attempts = attempts._2;
switch (attempt.tag) {
// We cannot recover from an interrupt. Otherwise we should
// continue stepping, or run the exception handler if an exception
// was raised.
case CATCH:
// We should compare the interrupt status as well because we
// only want it to apply if there has been an interrupt since
// enqueuing the catch.
if (interrupt && interrupt !== tmp) {
status = RETURN;
} else if (fail) {
status = CONTINUE;
step = attempt._2(util.fromLeft(fail));
fail = null;
}
break;
// We cannot resume from an interrupt or exception.
case RESUME:
// As with Catch, we only want to ignore in the case of an
// interrupt since enqueing the item.
if (interrupt && interrupt !== tmp || fail) {
status = RETURN;
} else {
bhead = attempt._1;
btail = attempt._2;
status = STEP_BIND;
step = util.fromRight(step);
}
break;
// If we have a bracket, we should enqueue the handlers,
// and continue with the success branch only if the fiber has
// not been interrupted. If the bracket acquisition failed, we
// should not run either.
case BRACKET:
bracketCount--;
if (fail === null) {
result = util.fromRight(step);
// We need to enqueue the Release with the same interrupt
// status as the Bracket that is initiating it.
attempts = new Aff(CONS, new Aff(RELEASE, attempt._2, result), attempts, tmp);
// We should only coninue as long as the interrupt status has not changed or
// we are currently within a non-interruptable finalizer.
if (interrupt === tmp || bracketCount > 0) {
status = CONTINUE;
step = attempt._3(result);
}
}
break;
// Enqueue the appropriate handler. We increase the bracket count
// because it should not be cancelled.
case RELEASE:
bracketCount++;
attempts = new Aff(CONS, new Aff(FINALIZED, step, fail), attempts, interrupt);
status = CONTINUE;
// It has only been killed if the interrupt status has changed
// since we enqueued the item.
if (interrupt && interrupt !== tmp) {
step = attempt._1.killed(util.fromLeft(interrupt))(attempt._2);
} else if (fail) {
step = attempt._1.failed(util.fromLeft(fail))(attempt._2);
} else {
step = attempt._1.completed(util.fromRight(step))(attempt._2);
}
fail = null;
break;
case FINALIZER:
bracketCount++;
attempts = new Aff(CONS, new Aff(FINALIZED, step, fail), attempts, interrupt);
status = CONTINUE;
step = attempt._1;
break;
case FINALIZED:
bracketCount--;
status = RETURN;
step = attempt._1;
fail = attempt._2;
break;
}
}
break;
case COMPLETED:
for (var k in joins) {
if (joins.hasOwnProperty(k)) {
rethrow = rethrow && joins[k].rethrow;
runEff(joins[k].handler(step));
}
}
joins = null;
// If we have an interrupt and a fail, then the thread threw while
// running finalizers. This should always rethrow in a fresh stack.
if (interrupt && fail) {
setTimeout(function () {
throw util.fromLeft(fail);
}, 0);
// If we have an unhandled exception, and no other fiber has joined
// then we need to throw the exception in a fresh stack.
} else if (util.isLeft(step) && rethrow) {
setTimeout(function () {
// Guard on reathrow because a completely synchronous fiber can
// still have an observer which was added after-the-fact.
if (rethrow) {
throw util.fromLeft(step);
}
}, 0);
}
return;
case SUSPENDED:
status = CONTINUE;
break;
case PENDING: return;
}
}
}
function onComplete(join) {
return function () {
if (status === COMPLETED) {
rethrow = rethrow && join.rethrow;
join.handler(step)();
return function () {};
}
var jid = joinId++;
joins = joins || {};
joins[jid] = join;
return function() {
if (joins !== null) {
delete joins[jid];
}
};
};
}
function kill(error, cb) {
return function () {
if (status === COMPLETED) {
cb(util.right(void 0))();
return function () {};
}
var canceler = onComplete({
rethrow: false,
handler: function (/* unused */) {
return cb(util.right(void 0));
}
})();
switch (status) {
case SUSPENDED:
interrupt = util.left(error);
status = COMPLETED;
step = interrupt;
run(runTick);
break;
case PENDING:
if (interrupt === null) {
interrupt = util.left(error);
}
if (bracketCount === 0) {
if (status === PENDING) {
attempts = new Aff(CONS, new Aff(FINALIZER, step(error)), attempts, interrupt);
}
status = RETURN;
step = null;
fail = null;
run(++runTick);
}
break;
default:
if (interrupt === null) {
interrupt = util.left(error);
}
if (bracketCount === 0) {
status = RETURN;
step = null;
fail = null;
}
}
return canceler;
};
}
function join(cb) {
return function () {
var canceler = onComplete({
rethrow: false,
handler: cb
})();
if (status === SUSPENDED) {
run(runTick);
}
return canceler;
};
}
return {
kill: kill,
join: join,
onComplete: onComplete,
isSuspended: function () {
return status === SUSPENDED;
},
run: function () {
if (status === SUSPENDED) {
if (!Scheduler.isDraining()) {
Scheduler.enqueue(function () {
run(runTick);
});
} else {
run(runTick);
}
}
}
};
}
function runPar(util, supervisor, par, cb) {
// Table of all forked fibers.
var fiberId = 0;
var fibers = {};
// Table of currently running cancelers, as a product of `Alt` behavior.
var killId = 0;
var kills = {};
// Error used for early cancelation on Alt branches.
var early = new Error("[ParAff] Early exit");
// Error used to kill the entire tree.
var interrupt = null;
// The root pointer of the tree.
var root = EMPTY;
// Walks a tree, invoking all the cancelers. Returns the table of pending
// cancellation fibers.
function kill(error, par, cb) {
var step = par;
var head = null;
var tail = null;
var count = 0;
var kills = {};
var tmp, kid;
loop: while (true) {
tmp = null;
switch (step.tag) {
case FORKED:
if (step._3 === EMPTY) {
tmp = fibers[step._1];
kills[count++] = tmp.kill(error, function (result) {
return function () {
count--;
if (count === 0) {
cb(result)();
}
};
});
}
// Terminal case.
if (head === null) {
break loop;
}
// Go down the right side of the tree.
step = head._2;
if (tail === null) {
head = null;
} else {
head = tail._1;
tail = tail._2;
}
break;
case MAP:
step = step._2;
break;
case APPLY:
case ALT:
if (head) {
tail = new Aff(CONS, head, tail);
}
head = step;
step = step._1;
break;
}
}
if (count === 0) {
cb(util.right(void 0))();
} else {
// Run the cancelation effects. We alias `count` because it's mutable.
kid = 0;
tmp = count;
for (; kid < tmp; kid++) {
kills[kid] = kills[kid]();
}
}
return kills;
}
// When a fiber resolves, we need to bubble back up the tree with the
// result, computing the applicative nodes.
function join(result, head, tail) {
var fail, step, lhs, rhs, tmp, kid;
if (util.isLeft(result)) {
fail = result;
step = null;
} else {
step = result;
fail = null;
}
loop: while (true) {
lhs = null;
rhs = null;
tmp = null;
kid = null;
// We should never continue if the entire tree has been interrupted.
if (interrupt !== null) {
return;
}
// We've made it all the way to the root of the tree, which means
// the tree has fully evaluated.
if (head === null) {
cb(fail || step)();
return;
}
// The tree has already been computed, so we shouldn't try to do it
// again. This should never happen.
// TODO: Remove this?
if (head._3 !== EMPTY) {
return;
}
switch (head.tag) {
case MAP:
if (fail === null) {
head._3 = util.right(head._1(util.fromRight(step)));
step = head._3;
} else {
head._3 = fail;
}
break;
case APPLY:
lhs = head._1._3;
rhs = head._2._3;
// If we have a failure we should kill the other side because we
// can't possible yield a result anymore.
if (fail) {
head._3 = fail;
tmp = true;
kid = killId++;
kills[kid] = kill(early, fail === lhs ? head._2 : head._1, function (/* unused */) {
return function () {
delete kills[kid];
if (tmp) {
tmp = false;
} else if (tail === null) {
join(fail, null, null);
} else {
join(fail, tail._1, tail._2);
}
};
});
if (tmp) {
tmp = false;
return;
}
} else if (lhs === EMPTY || rhs === EMPTY) {
// We can only proceed if both sides have resolved.
return;
} else {
step = util.right(util.fromRight(lhs)(util.fromRight(rhs)));
head._3 = step;
}
break;
case ALT:
lhs = head._1._3;
rhs = head._2._3;
// We can only proceed if both have resolved or we have a success
if (lhs === EMPTY && util.isLeft(rhs) || rhs === EMPTY && util.isLeft(lhs)) {
return;
}
// If both sides resolve with an error, we should continue with the
// first error
if (lhs !== EMPTY && util.isLeft(lhs) && rhs !== EMPTY && util.isLeft(rhs)) {
fail = step === lhs ? rhs : lhs;
step = null;
head._3 = fail;
} else {
head._3 = step;
tmp = true;
kid = killId++;
// Once a side has resolved, we need to cancel the side that is still
// pending before we can continue.
kills[kid] = kill(early, step === lhs ? head._2 : head._1, function (/* unused */) {
return function () {
delete kills[kid];
if (tmp) {
tmp = false;
} else if (tail === null) {
join(step, null, null);
} else {
join(step, tail._1, tail._2);
}
};
});
if (tmp) {
tmp = false;
return;
}
}
break;
}
if (tail === null) {
head = null;
} else {
head = tail._1;
tail = tail._2;
}
}
}
function resolve(fiber) {
return function (result) {
return function () {
delete fibers[fiber._1];
fiber._3 = result;
join(result, fiber._2._1, fiber._2._2);
};
};
}
// Walks the applicative tree, substituting non-applicative nodes with
// `FORKED` nodes. In this tree, all applicative nodes use the `_3` slot
// as a mutable slot for memoization. In an unresolved state, the `_3`
// slot is `EMPTY`. In the cases of `ALT` and `APPLY`, we always walk
// the left side first, because both operations are left-associative. As
// we `RETURN` from those branches, we then walk the right side.
function run() {
var status = CONTINUE;
var step = par;
var head = null;
var tail = null;
var tmp, fid;
loop: while (true) {
tmp = null;
fid = null;
switch (status) {
case CONTINUE:
switch (step.tag) {
case MAP:
if (head) {
tail = new Aff(CONS, head, tail);
}
head = new Aff(MAP, step._1, EMPTY, EMPTY);
step = step._2;
break;
case APPLY:
if (head) {
tail = new Aff(CONS, head, tail);
}
head = new Aff(APPLY, EMPTY, step._2, EMPTY);
step = step._1;
break;
case ALT:
if (head) {
tail = new Aff(CONS, head, tail);
}
head = new Aff(ALT, EMPTY, step._2, EMPTY);
step = step._1;
break;
default:
// When we hit a leaf value, we suspend the stack in the `FORKED`.
// When the fiber resolves, it can bubble back up the tree.
fid = fiberId++;
status = RETURN;
tmp = step;
step = new Aff(FORKED, fid, new Aff(CONS, head, tail), EMPTY);
tmp = Fiber(util, supervisor, tmp);
tmp.onComplete({
rethrow: false,
handler: resolve(step)
})();
fibers[fid] = tmp;
if (supervisor) {
supervisor.register(tmp);
}
}
break;
case RETURN:
// Terminal case, we are back at the root.
if (head === null) {
break loop;
}
// If we are done with the right side, we need to continue down the
// left. Otherwise we should continue up the stack.
if (head._1 === EMPTY) {
head._1 = step;
status = CONTINUE;
step = head._2;
head._2 = EMPTY;
} else {
head._2 = step;
step = head;
if (tail === null) {
head = null;
} else {
head = tail._1;
tail = tail._2;
}
}
}
}
// Keep a reference to the tree root so it can be cancelled.
root = step;
for (fid = 0; fid < fiberId; fid++) {
fibers[fid].run();
}
}
// Cancels the entire tree. If there are already subtrees being canceled,
// we need to first cancel those joins. We will then add fresh joins for
// all pending branches including those that were in the process of being
// canceled.
function cancel(error, cb) {
interrupt = util.left(error);
var innerKills;
for (var kid in kills) {
if (kills.hasOwnProperty(kid)) {
innerKills = kills[kid];
for (kid in innerKills) {
if (innerKills.hasOwnProperty(kid)) {
innerKills[kid]();
}
}
}
}
kills = null;
var newKills = kill(error, root, cb);
return function (killError) {
return new Aff(ASYNC, function (killCb) {
return function () {
for (var kid in newKills) {
if (newKills.hasOwnProperty(kid)) {
newKills[kid]();
}
}
return nonCanceler;
};
});
};
}
run();
return function (killError) {
return new Aff(ASYNC, function (killCb) {
return function () {
return cancel(killError, killCb);
};
});
};
}
function sequential(util, supervisor, par) {
return new Aff(ASYNC, function (cb) {
return function () {
return runPar(util, supervisor, par, cb);
};
});
}
Aff.EMPTY = EMPTY;
Aff.Pure = AffCtr(PURE);
Aff.Throw = AffCtr(THROW);
Aff.Catch = AffCtr(CATCH);
Aff.Sync = AffCtr(SYNC);
Aff.Async = AffCtr(ASYNC);
Aff.Bind = AffCtr(BIND);
Aff.Bracket = AffCtr(BRACKET);
Aff.Fork = AffCtr(FORK);
Aff.Seq = AffCtr(SEQ);
Aff.ParMap = AffCtr(MAP);
Aff.ParApply = AffCtr(APPLY);
Aff.ParAlt = AffCtr(ALT);
Aff.Fiber = Fiber;
Aff.Supervisor = Supervisor;
Aff.Scheduler = Scheduler;
Aff.nonCanceler = nonCanceler;
return Aff;
}();
exports._pure = Aff.Pure;
exports._throwError = Aff.Throw;
exports._catchError = function (aff) {
return function (k) {
return Aff.Catch(aff, k);
};
};
exports._map = function (f) {
return function (aff) {
if (aff.tag === Aff.Pure.tag) {
return Aff.Pure(f(aff._1));
} else {
return Aff.Bind(aff, function (value) {
return Aff.Pure(f(value));
});
}
};
};
exports._bind = function (aff) {
return function (k) {
return Aff.Bind(aff, k);
};
};
exports._fork = function (immediate) {
return function (aff) {
return Aff.Fork(immediate, aff);
};
};
exports._liftEffect = Aff.Sync;
exports._parAffMap = function (f) {
return function (aff) {
return Aff.ParMap(f, aff);
};
};
exports._parAffApply = function (aff1) {
return function (aff2) {
return Aff.ParApply(aff1, aff2);
};
};
exports._parAffAlt = function (aff1) {
return function (aff2) {
return Aff.ParAlt(aff1, aff2);
};
};
exports.makeAff = Aff.Async;
exports._makeFiber = function (util, aff) {
return function () {
return Aff.Fiber(util, null, aff);
};
};
exports._delay = function () {
function setDelay(n, k) {
if (n === 0 && typeof setImmediate !== "undefined") {
return setImmediate(k);
} else {
return setTimeout(k, n);
}
}
function clearDelay(n, t) {
if (n === 0 && typeof clearImmediate !== "undefined") {
return clearImmediate(t);
} else {
return clearTimeout(t);
}
}
return function (right, ms) {
return Aff.Async(function (cb) {
return function () {
var timer = setDelay(ms, cb(right()));
return function () {
return Aff.Sync(function () {
return right(clearDelay(ms, timer));
});
};
};
});
};
}();
exports._sequential = Aff.Seq;
})(PS["Effect.Aff"] = PS["Effect.Aff"] || {});
(function(exports) {
"use strict";
exports.unsafePerformEffect = function (f) {
return f();
};
})(PS["Effect.Unsafe"] = PS["Effect.Unsafe"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Effect.Unsafe"];
var Effect = PS["Effect"];
exports["unsafePerformEffect"] = $foreign.unsafePerformEffect;
})(PS["Effect.Unsafe"] = PS["Effect.Unsafe"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Effect.Aff"];
var Control_Alt = PS["Control.Alt"];
var Control_Alternative = PS["Control.Alternative"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Lazy = PS["Control.Lazy"];
var Control_Monad = PS["Control.Monad"];
var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
var Control_Monad_Rec_Class = PS["Control.Monad.Rec.Class"];
var Control_Parallel = PS["Control.Parallel"];
var Control_Parallel_Class = PS["Control.Parallel.Class"];
var Control_Plus = PS["Control.Plus"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
var Data_Functor = PS["Data.Functor"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Newtype = PS["Data.Newtype"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Time_Duration = PS["Data.Time.Duration"];
var Data_Unit = PS["Data.Unit"];
var Effect = PS["Effect"];
var Effect_Class = PS["Effect.Class"];
var Effect_Exception = PS["Effect.Exception"];
var Effect_Unsafe = PS["Effect.Unsafe"];
var Partial_Unsafe = PS["Partial.Unsafe"];
var Prelude = PS["Prelude"];
var Unsafe_Coerce = PS["Unsafe.Coerce"];
var Canceler = function (x) {
return x;
};
var functorParAff = new Data_Functor.Functor($foreign._parAffMap);
var functorAff = new Data_Functor.Functor($foreign._map);
var forkAff = $foreign._fork(true);
var ffiUtil = (function () {
var unsafeFromRight = function (v) {
if (v instanceof Data_Either.Right) {
return v.value0;
};
if (v instanceof Data_Either.Left) {
return Partial_Unsafe.unsafeCrashWith("unsafeFromRight: Left");
};
throw new Error("Failed pattern match at Effect.Aff line 395, column 21 - line 397, column 31: " + [ v.constructor.name ]);
};
var unsafeFromLeft = function (v) {
if (v instanceof Data_Either.Left) {
return v.value0;
};
if (v instanceof Data_Either.Right) {
return Partial_Unsafe.unsafeCrashWith("unsafeFromLeft: Right");
};
throw new Error("Failed pattern match at Effect.Aff line 390, column 20 - line 394, column 3: " + [ v.constructor.name ]);
};
var isLeft = function (v) {
if (v instanceof Data_Either.Left) {
return true;
};
if (v instanceof Data_Either.Right) {
return false;
};
throw new Error("Failed pattern match at Effect.Aff line 385, column 12 - line 387, column 20: " + [ v.constructor.name ]);
};
return {
isLeft: isLeft,
fromLeft: unsafeFromLeft,
fromRight: unsafeFromRight,
left: Data_Either.Left.create,
right: Data_Either.Right.create
};
})();
var makeFiber = function (aff) {
return $foreign._makeFiber(ffiUtil, aff);
};
var launchAff = function (aff) {
return function __do() {
var v = makeFiber(aff)();
v.run();
return v;
};
};
var launchAff_ = function ($49) {
return Data_Functor["void"](Effect.functorEffect)(launchAff($49));
};
var delay = function (v) {
return $foreign._delay(Data_Either.Right.create, v);
};
var applyParAff = new Control_Apply.Apply(function () {
return functorParAff;
}, $foreign._parAffApply);
var monadAff = new Control_Monad.Monad(function () {
return applicativeAff;
}, function () {
return bindAff;
});
var bindAff = new Control_Bind.Bind(function () {
return applyAff;
}, $foreign._bind);
var applyAff = new Control_Apply.Apply(function () {
return functorAff;
}, Control_Monad.ap(monadAff));
var applicativeAff = new Control_Applicative.Applicative(function () {
return applyAff;
}, $foreign._pure);
var monadEffectAff = new Effect_Class.MonadEffect(function () {
return monadAff;
}, $foreign._liftEffect);
var effectCanceler = function ($50) {
return Canceler(Data_Function["const"](Effect_Class.liftEffect(monadEffectAff)($50)));
};
var monadThrowAff = new Control_Monad_Error_Class.MonadThrow(function () {
return monadAff;
}, $foreign._throwError);
var monadErrorAff = new Control_Monad_Error_Class.MonadError(function () {
return monadThrowAff;
}, $foreign._catchError);
var parallelAff = new Control_Parallel_Class.Parallel(function () {
return applicativeParAff;
}, function () {
return monadAff;
}, Unsafe_Coerce.unsafeCoerce, $foreign._sequential);
var applicativeParAff = new Control_Applicative.Applicative(function () {
return applyParAff;
}, function ($53) {
return Control_Parallel_Class.parallel(parallelAff)(Control_Applicative.pure(applicativeAff)($53));
});
var monadRecAff = new Control_Monad_Rec_Class.MonadRec(function () {
return monadAff;
}, function (k) {
var go = function (a) {
return Control_Bind.bind(bindAff)(k(a))(function (v) {
if (v instanceof Control_Monad_Rec_Class.Done) {
return Control_Applicative.pure(applicativeAff)(v.value0);
};
if (v instanceof Control_Monad_Rec_Class.Loop) {
return go(v.value0);
};
throw new Error("Failed pattern match at Effect.Aff line 99, column 7 - line 101, column 22: " + [ v.constructor.name ]);
});
};
return go;
});
var nonCanceler = Data_Function["const"](Control_Applicative.pure(applicativeAff)(Data_Unit.unit));
var altParAff = new Control_Alt.Alt(function () {
return functorParAff;
}, $foreign._parAffAlt);
var altAff = new Control_Alt.Alt(function () {
return functorAff;
}, function (a1) {
return function (a2) {
return Control_Monad_Error_Class.catchError(monadErrorAff)(a1)(Data_Function["const"](a2));
};
});
var plusAff = new Control_Plus.Plus(function () {
return altAff;
}, Control_Monad_Error_Class.throwError(monadThrowAff)(Effect_Exception.error("Always fails")));
var plusParAff = new Control_Plus.Plus(function () {
return altParAff;
}, Control_Parallel_Class.parallel(parallelAff)(Control_Plus.empty(plusAff)));
var alternativeParAff = new Control_Alternative.Alternative(function () {
return applicativeParAff;
}, function () {
return plusParAff;
});
exports["Canceler"] = Canceler;
exports["launchAff"] = launchAff;
exports["launchAff_"] = launchAff_;
exports["forkAff"] = forkAff;
exports["delay"] = delay;
exports["nonCanceler"] = nonCanceler;
exports["effectCanceler"] = effectCanceler;
exports["functorAff"] = functorAff;
exports["applyAff"] = applyAff;
exports["applicativeAff"] = applicativeAff;
exports["bindAff"] = bindAff;
exports["monadAff"] = monadAff;
exports["altAff"] = altAff;
exports["plusAff"] = plusAff;
exports["monadRecAff"] = monadRecAff;
exports["monadThrowAff"] = monadThrowAff;
exports["monadErrorAff"] = monadErrorAff;
exports["monadEffectAff"] = monadEffectAff;
exports["functorParAff"] = functorParAff;
exports["applyParAff"] = applyParAff;
exports["applicativeParAff"] = applicativeParAff;
exports["altParAff"] = altParAff;
exports["plusParAff"] = plusParAff;
exports["alternativeParAff"] = alternativeParAff;
exports["parallelAff"] = parallelAff;
exports["makeAff"] = $foreign.makeAff;
})(PS["Effect.Aff"] = PS["Effect.Aff"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Maybe = PS["Data.Maybe"];
var Effect = PS["Effect"];
var Effect_AVar = PS["Effect.AVar"];
var Effect_Aff = PS["Effect.Aff"];
var Effect_Class = PS["Effect.Class"];
var Effect_Exception = PS["Effect.Exception"];
var Prelude = PS["Prelude"];
var take = function (avar) {
return Effect_Aff.makeAff(function (k) {
return function __do() {
var v = Effect_AVar.take(avar)(k)();
return Effect_Aff.effectCanceler(v);
};
});
};
var read = function (avar) {
return Effect_Aff.makeAff(function (k) {
return function __do() {
var v = Effect_AVar.read(avar)(k)();
return Effect_Aff.effectCanceler(v);
};
});
};
var put = function (value) {
return function (avar) {
return Effect_Aff.makeAff(function (k) {
return function __do() {
var v = Effect_AVar.put(value)(avar)(k)();
return Effect_Aff.effectCanceler(v);
};
});
};
};
var $$new = function ($10) {
return Effect_Class.liftEffect(Effect_Aff.monadEffectAff)(Effect_AVar["new"]($10));
};
var empty = Effect_Class.liftEffect(Effect_Aff.monadEffectAff)(Effect_AVar.empty);
exports["new"] = $$new;
exports["empty"] = empty;
exports["take"] = take;
exports["put"] = put;
exports["read"] = read;
})(PS["Effect.Aff.AVar"] = PS["Effect.Aff.AVar"] || {});
(function(exports) {
"use strict";
exports.unsafeToForeign = function (value) {
return value;
};
exports.unsafeFromForeign = function (value) {
return value;
};
exports.typeOf = function (value) {
return typeof value;
};
exports.tagOf = function (value) {
return Object.prototype.toString.call(value).slice(8, -1);
};
exports.isNull = function (value) {
return value === null;
};
exports.isUndefined = function (value) {
return value === undefined;
};
exports.isArray = Array.isArray || function (value) {
return Object.prototype.toString.call(value) === "[object Array]";
};
})(PS["Foreign"] = PS["Foreign"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Foreign"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
var Control_Monad_Except = PS["Control.Monad.Except"];
var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Boolean = PS["Data.Boolean"];
var Data_Either = PS["Data.Either"];
var Data_Eq = PS["Data.Eq"];
var Data_Function = PS["Data.Function"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Identity = PS["Data.Identity"];
var Data_Int = PS["Data.Int"];
var Data_List_NonEmpty = PS["Data.List.NonEmpty"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Show = PS["Data.Show"];
var Data_String_CodeUnits = PS["Data.String.CodeUnits"];
var Prelude = PS["Prelude"];
var ForeignError = (function () {
function ForeignError(value0) {
this.value0 = value0;
};
ForeignError.create = function (value0) {
return new ForeignError(value0);
};
return ForeignError;
})();
var TypeMismatch = (function () {
function TypeMismatch(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
TypeMismatch.create = function (value0) {
return function (value1) {
return new TypeMismatch(value0, value1);
};
};
return TypeMismatch;
})();
var ErrorAtIndex = (function () {
function ErrorAtIndex(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
ErrorAtIndex.create = function (value0) {
return function (value1) {
return new ErrorAtIndex(value0, value1);
};
};
return ErrorAtIndex;
})();
var ErrorAtProperty = (function () {
function ErrorAtProperty(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
ErrorAtProperty.create = function (value0) {
return function (value1) {
return new ErrorAtProperty(value0, value1);
};
};
return ErrorAtProperty;
})();
var showForeignError = new Data_Show.Show(function (v) {
if (v instanceof ForeignError) {
return "(ForeignError " + (Data_Show.show(Data_Show.showString)(v.value0) + ")");
};
if (v instanceof ErrorAtIndex) {
return "(ErrorAtIndex " + (Data_Show.show(Data_Show.showInt)(v.value0) + (" " + (Data_Show.show(showForeignError)(v.value1) + ")")));
};
if (v instanceof ErrorAtProperty) {
return "(ErrorAtProperty " + (Data_Show.show(Data_Show.showString)(v.value0) + (" " + (Data_Show.show(showForeignError)(v.value1) + ")")));
};
if (v instanceof TypeMismatch) {
return "(TypeMismatch " + (Data_Show.show(Data_Show.showString)(v.value0) + (" " + (Data_Show.show(Data_Show.showString)(v.value1) + ")")));
};
throw new Error("Failed pattern match at Foreign line 63, column 1 - line 63, column 47: " + [ v.constructor.name ]);
});
var fail = function ($107) {
return Control_Monad_Error_Class.throwError(Control_Monad_Except_Trans.monadThrowExceptT(Data_Identity.monadIdentity))(Data_List_NonEmpty.singleton($107));
};
var readArray = function (value) {
if ($foreign.isArray(value)) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))($foreign.unsafeFromForeign(value));
};
if (Data_Boolean.otherwise) {
return fail(new TypeMismatch("array", $foreign.tagOf(value)));
};
throw new Error("Failed pattern match at Foreign line 147, column 1 - line 147, column 42: " + [ value.constructor.name ]);
};
var unsafeReadTagged = function (tag) {
return function (value) {
if ($foreign.tagOf(value) === tag) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))($foreign.unsafeFromForeign(value));
};
if (Data_Boolean.otherwise) {
return fail(new TypeMismatch(tag, $foreign.tagOf(value)));
};
throw new Error("Failed pattern match at Foreign line 106, column 1 - line 106, column 55: " + [ tag.constructor.name, value.constructor.name ]);
};
};
var readString = unsafeReadTagged("String");
exports["ForeignError"] = ForeignError;
exports["TypeMismatch"] = TypeMismatch;
exports["ErrorAtIndex"] = ErrorAtIndex;
exports["ErrorAtProperty"] = ErrorAtProperty;
exports["unsafeReadTagged"] = unsafeReadTagged;
exports["readString"] = readString;
exports["readArray"] = readArray;
exports["fail"] = fail;
exports["showForeignError"] = showForeignError;
exports["unsafeToForeign"] = $foreign.unsafeToForeign;
exports["typeOf"] = $foreign.typeOf;
exports["isNull"] = $foreign.isNull;
exports["isUndefined"] = $foreign.isUndefined;
})(PS["Foreign"] = PS["Foreign"] || {});
(function(exports) {
"use strict";
exports._copyST = function (m) {
return function () {
var r = {};
for (var k in m) {
if (hasOwnProperty.call(m, k)) {
r[k] = m[k];
}
}
return r;
};
};
exports.empty = {};
exports.runST = function (f) {
return f();
};
exports._foldM = function (bind) {
return function (f) {
return function (mz) {
return function (m) {
var acc = mz;
function g(k) {
return function (z) {
return f(z)(k)(m[k]);
};
}
for (var k in m) {
if (hasOwnProperty.call(m, k)) {
acc = bind(acc)(g(k));
}
}
return acc;
};
};
};
};
exports._lookup = function (no, yes, k, m) {
return k in m ? yes(m[k]) : no;
};
function toArrayWithKey(f) {
return function (m) {
var r = [];
for (var k in m) {
if (hasOwnProperty.call(m, k)) {
r.push(f(k)(m[k]));
}
}
return r;
};
}
})(PS["Foreign.Object"] = PS["Foreign.Object"] || {});
(function(exports) {
"use strict";
exports["new"] = function () {
return {};
};
exports.poke = function (k) {
return function (v) {
return function (m) {
return function () {
m[k] = v;
return m;
};
};
};
};
})(PS["Foreign.Object.ST"] = PS["Foreign.Object.ST"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Foreign.Object.ST"];
var Control_Monad_ST = PS["Control.Monad.ST"];
var Data_Maybe = PS["Data.Maybe"];
exports["new"] = $foreign["new"];
exports["poke"] = $foreign.poke;
})(PS["Foreign.Object.ST"] = PS["Foreign.Object.ST"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Foreign.Object"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Monad_ST = PS["Control.Monad.ST"];
var Control_Monad_ST_Internal = PS["Control.Monad.ST.Internal"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Array = PS["Data.Array"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_FoldableWithIndex = PS["Data.FoldableWithIndex"];
var Data_Function = PS["Data.Function"];
var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
var Data_Functor = PS["Data.Functor"];
var Data_FunctorWithIndex = PS["Data.FunctorWithIndex"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Ord = PS["Data.Ord"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Show = PS["Data.Show"];
var Data_Traversable = PS["Data.Traversable"];
var Data_TraversableWithIndex = PS["Data.TraversableWithIndex"];
var Data_Tuple = PS["Data.Tuple"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Foreign_Object_ST = PS["Foreign.Object.ST"];
var Prelude = PS["Prelude"];
var thawST = $foreign._copyST;
var singleton = function (k) {
return function (v) {
return $foreign.runST(Control_Bind.bindFlipped(Control_Monad_ST_Internal.bindST)(Foreign_Object_ST.poke(k)(v))(Foreign_Object_ST["new"]));
};
};
var mutate = function (f) {
return function (m) {
return $foreign.runST(Control_Bind.bind(Control_Monad_ST_Internal.bindST)(thawST(m))(function (v) {
return Control_Bind.bind(Control_Monad_ST_Internal.bindST)(f(v))(function (v1) {
return Control_Applicative.pure(Control_Monad_ST_Internal.applicativeST)(v);
});
}));
};
};
var lookup = Data_Function_Uncurried.runFn4($foreign._lookup)(Data_Maybe.Nothing.value)(Data_Maybe.Just.create);
var insert = function (k) {
return function (v) {
return mutate(Foreign_Object_ST.poke(k)(v));
};
};
var foldM = function (dictMonad) {
return function (f) {
return function (z) {
return $foreign._foldM(Control_Bind.bind(dictMonad.Bind1()))(f)(Control_Applicative.pure(dictMonad.Applicative0())(z));
};
};
};
var union = function (m) {
return mutate(function (s) {
return foldM(Control_Monad_ST_Internal.monadST)(function (s$prime) {
return function (k) {
return function (v) {
return Foreign_Object_ST.poke(k)(v)(s$prime);
};
};
})(s)(m);
});
};
exports["singleton"] = singleton;
exports["insert"] = insert;
exports["lookup"] = lookup;
exports["union"] = union;
exports["foldM"] = foldM;
exports["thawST"] = thawST;
exports["empty"] = $foreign.empty;
})(PS["Foreign.Object"] = PS["Foreign.Object"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Monad_Except = PS["Control.Monad.Except"];
var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Array = PS["Data.Array"];
var Data_Bifunctor = PS["Data.Bifunctor"];
var Data_Either = PS["Data.Either"];
var Data_Functor = PS["Data.Functor"];
var Data_Identity = PS["Data.Identity"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Traversable = PS["Data.Traversable"];
var Data_Unit = PS["Data.Unit"];
var Data_Void = PS["Data.Void"];
var Foreign = PS["Foreign"];
var Foreign_Internal = PS["Foreign.Internal"];
var Foreign_NullOrUndefined = PS["Foreign.NullOrUndefined"];
var Foreign_Object = PS["Foreign.Object"];
var Prelude = PS["Prelude"];
var Decode = function (decode) {
this.decode = decode;
};
var Encode = function (encode) {
this.encode = encode;
};
var stringEncode = new Encode(Foreign.unsafeToForeign);
var stringDecode = new Decode(Foreign.readString);
var intEncode = new Encode(Foreign.unsafeToForeign);
var encode = function (dict) {
return dict.encode;
};
var decode = function (dict) {
return dict.decode;
};
var arrayDecode = function (dictDecode) {
return new Decode((function () {
var readElement = function (i) {
return function (value) {
return Control_Monad_Except.mapExcept(Data_Bifunctor.lmap(Data_Either.bifunctorEither)(Data_Functor.map(Data_List_Types.functorNonEmptyList)(Foreign.ErrorAtIndex.create(i))))(decode(dictDecode)(value));
};
};
var readElements = function (arr) {
return Data_Traversable.sequence(Data_Traversable.traversableArray)(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(Data_Array.zipWith(readElement)(Data_Array.range(0)(Data_Array.length(arr)))(arr));
};
return Control_Bind.composeKleisli(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Foreign.readArray)(readElements);
})());
};
exports["decode"] = decode;
exports["encode"] = encode;
exports["Decode"] = Decode;
exports["Encode"] = Encode;
exports["stringDecode"] = stringDecode;
exports["arrayDecode"] = arrayDecode;
exports["stringEncode"] = stringEncode;
exports["intEncode"] = intEncode;
})(PS["Foreign.Class"] = PS["Foreign.Class"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var TaggedObject = (function () {
function TaggedObject(value0) {
this.value0 = value0;
};
TaggedObject.create = function (value0) {
return new TaggedObject(value0);
};
return TaggedObject;
})();
exports["TaggedObject"] = TaggedObject;
})(PS["Foreign.Generic.Types"] = PS["Foreign.Generic.Types"] || {});
(function(exports) {
"use strict";
exports.unsafeReadPropImpl = function (f, s, key, value) {
return value == null ? f : s(value[key]);
};
exports.unsafeHasOwnProperty = function (prop, value) {
return Object.prototype.hasOwnProperty.call(value, prop);
};
exports.unsafeHasProperty = function (prop, value) {
return prop in value;
};
})(PS["Foreign.Index"] = PS["Foreign.Index"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Foreign.Index"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
var Data_Eq = PS["Data.Eq"];
var Data_Function = PS["Data.Function"];
var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Identity = PS["Data.Identity"];
var Data_List_NonEmpty = PS["Data.List.NonEmpty"];
var Foreign = PS["Foreign"];
var Prelude = PS["Prelude"];
var Index = function (errorAt, hasOwnProperty, hasProperty, index) {
this.errorAt = errorAt;
this.hasOwnProperty = hasOwnProperty;
this.hasProperty = hasProperty;
this.index = index;
};
var unsafeReadProp = function (k) {
return function (value) {
return $foreign.unsafeReadPropImpl(Foreign.fail(new Foreign.TypeMismatch("object", Foreign.typeOf(value))), Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity)), k, value);
};
};
var readProp = unsafeReadProp;
var index = function (dict) {
return dict.index;
};
var hasPropertyImpl = function (v) {
return function (value) {
if (Foreign.isNull(value)) {
return false;
};
if (Foreign.isUndefined(value)) {
return false;
};
if (Foreign.typeOf(value) === "object" || Foreign.typeOf(value) === "function") {
return $foreign.unsafeHasProperty(v, value);
};
return false;
};
};
var hasProperty = function (dict) {
return dict.hasProperty;
};
var hasOwnPropertyImpl = function (v) {
return function (value) {
if (Foreign.isNull(value)) {
return false;
};
if (Foreign.isUndefined(value)) {
return false;
};
if (Foreign.typeOf(value) === "object" || Foreign.typeOf(value) === "function") {
return $foreign.unsafeHasOwnProperty(v, value);
};
return false;
};
};
var indexString = new Index(Foreign.ErrorAtProperty.create, hasOwnPropertyImpl, hasPropertyImpl, Data_Function.flip(readProp));
var hasOwnProperty = function (dict) {
return dict.hasOwnProperty;
};
var errorAt = function (dict) {
return dict.errorAt;
};
exports["Index"] = Index;
exports["readProp"] = readProp;
exports["index"] = index;
exports["hasProperty"] = hasProperty;
exports["hasOwnProperty"] = hasOwnProperty;
exports["errorAt"] = errorAt;
exports["indexString"] = indexString;
})(PS["Foreign.Index"] = PS["Foreign.Index"] || {});
(function(exports) {
"use strict";
exports.copyRecord = function(rec) {
var copy = {};
for (var key in rec) {
if ({}.hasOwnProperty.call(rec, key)) {
copy[key] = rec[key];
}
}
return copy;
};
exports.unsafeInsert = function(l) {
return function(a) {
return function(rec) {
rec[l] = a;
return rec;
};
};
};
})(PS["Record.Builder"] = PS["Record.Builder"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Record.Builder"];
var Control_Category = PS["Control.Category"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
var Data_Symbol = PS["Data.Symbol"];
var Prelude = PS["Prelude"];
var Record_Unsafe_Union = PS["Record.Unsafe.Union"];
var Type_Row = PS["Type.Row"];
var Unsafe_Coerce = PS["Unsafe.Coerce"];
var semigroupoidBuilder = Control_Semigroupoid.semigroupoidFn;
var insert = function (dictCons) {
return function (dictLacks) {
return function (dictIsSymbol) {
return function (l) {
return function (a) {
return function (r1) {
return $foreign.unsafeInsert(Data_Symbol.reflectSymbol(dictIsSymbol)(l))(a)(r1);
};
};
};
};
};
};
var categoryBuilder = Control_Category.categoryFn;
var build = function (v) {
return function (r1) {
return v($foreign.copyRecord(r1));
};
};
exports["build"] = build;
exports["insert"] = insert;
exports["semigroupoidBuilder"] = semigroupoidBuilder;
exports["categoryBuilder"] = categoryBuilder;
})(PS["Record.Builder"] = PS["Record.Builder"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad = PS["Control.Monad"];
var Data_BooleanAlgebra = PS["Data.BooleanAlgebra"];
var Data_Bounded = PS["Data.Bounded"];
var Data_CommutativeRing = PS["Data.CommutativeRing"];
var Data_Eq = PS["Data.Eq"];
var Data_Functor = PS["Data.Functor"];
var Data_HeytingAlgebra = PS["Data.HeytingAlgebra"];
var Data_Ord = PS["Data.Ord"];
var Data_Ordering = PS["Data.Ordering"];
var Data_Ring = PS["Data.Ring"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Show = PS["Data.Show"];
var Prelude = PS["Prelude"];
var $$Proxy = (function () {
function $$Proxy() {
};
$$Proxy.value = new $$Proxy();
return $$Proxy;
})();
exports["Proxy"] = $$Proxy;
})(PS["Type.Proxy"] = PS["Type.Proxy"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Alt = PS["Control.Alt"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Monad_Except = PS["Control.Monad.Except"];
var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Bifunctor = PS["Data.Bifunctor"];
var Data_Either = PS["Data.Either"];
var Data_Eq = PS["Data.Eq"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Generic_Rep = PS["Data.Generic.Rep"];
var Data_Identity = PS["Data.Identity"];
var Data_List = PS["Data.List"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Monoid = PS["Data.Monoid"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Show = PS["Data.Show"];
var Data_Symbol = PS["Data.Symbol"];
var Data_Unfoldable = PS["Data.Unfoldable"];
var Foreign = PS["Foreign"];
var Foreign_Class = PS["Foreign.Class"];
var Foreign_Generic_Types = PS["Foreign.Generic.Types"];
var Foreign_Index = PS["Foreign.Index"];
var Foreign_Object = PS["Foreign.Object"];
var Prelude = PS["Prelude"];
var Record = PS["Record"];
var Record_Builder = PS["Record.Builder"];
var Type_Data_RowList = PS["Type.Data.RowList"];
var Type_Proxy = PS["Type.Proxy"];
var Unsafe_Coerce = PS["Unsafe.Coerce"];
var GenericDecode = function (decodeOpts) {
this.decodeOpts = decodeOpts;
};
var GenericEncode = function (encodeOpts) {
this.encodeOpts = encodeOpts;
};
var GenericDecodeArgs = function (decodeArgs) {
this.decodeArgs = decodeArgs;
};
var GenericEncodeArgs = function (encodeArgs) {
this.encodeArgs = encodeArgs;
};
var GenericCountArgs = function (countArgs) {
this.countArgs = countArgs;
};
var Decode_ = function (decode_) {
this.decode_ = decode_;
};
var Encode_ = function (encode_) {
this.encode_ = encode_;
};
var DecodeRecord = function (decodeRecord_) {
this.decodeRecord_ = decodeRecord_;
};
var genericDecodeArgsNoArguments = new GenericDecodeArgs(function (v) {
return function (v1) {
return function (v2) {
if (v2 instanceof Data_List_Types.Nil) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))({
result: Data_Generic_Rep.NoArguments.value,
rest: Data_List_Types.Nil.value,
next: v1
});
};
return Foreign.fail(new Foreign.ForeignError("Too many constructor arguments"));
};
};
});
var genericCountArgsNoArguments = new GenericCountArgs(function (v) {
return new Data_Either.Left(Data_Generic_Rep.NoArguments.value);
});
var genericCountArgsArgument = new GenericCountArgs(function (v) {
return new Data_Either.Right(1);
});
var encode_Other = function (dictEncode) {
return new Encode_(function (v) {
return Foreign_Class.encode(dictEncode);
});
};
var encode_ = function (dict) {
return dict.encode_;
};
var genericEncodeArgsArgument = function (dictEncode_) {
return new GenericEncodeArgs(function (opts) {
return function (v) {
return Data_List.singleton(encode_(dictEncode_)(opts)(v));
};
});
};
var encodeOpts = function (dict) {
return dict.encodeOpts;
};
var encodeArgs = function (dict) {
return dict.encodeArgs;
};
var genericEncodeConstructor = function (dictIsSymbol) {
return function (dictGenericEncodeArgs) {
return new GenericEncode(function (opts) {
return function (v) {
var unwrapArguments = function (v1) {
if (v1.length === 0) {
return Data_Maybe.Nothing.value;
};
if (v1.length === 1 && opts.unwrapSingleArguments) {
return new Data_Maybe.Just(v1[0]);
};
return new Data_Maybe.Just(Foreign.unsafeToForeign(v1));
};
var encodeArgsArray = function ($148) {
return unwrapArguments(Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)(encodeArgs(dictGenericEncodeArgs)(opts)($148)));
};
var ctorName = Data_Symbol.reflectSymbol(dictIsSymbol)(Data_Symbol.SProxy.value);
if (opts.unwrapSingleConstructors) {
return Data_Maybe.maybe(Foreign.unsafeToForeign({}))(Foreign.unsafeToForeign)(encodeArgsArray(v));
};
return Foreign.unsafeToForeign(Foreign_Object.union(Foreign_Object.singleton(opts.sumEncoding.value0.tagFieldName)(Foreign.unsafeToForeign(opts.sumEncoding.value0.constructorTagTransform(ctorName))))(Data_Maybe.maybe(Foreign_Object.empty)(Foreign_Object.singleton(opts.sumEncoding.value0.contentsFieldName))(encodeArgsArray(v))));
};
});
};
};
var decode_Other = function (dictDecode) {
return new Decode_(function (v) {
return Foreign_Class.decode(dictDecode);
});
};
var decode_ = function (dict) {
return dict.decode_;
};
var genericDecodeArgsArgument = function (dictDecode_) {
return new GenericDecodeArgs(function (v) {
return function (v1) {
return function (v2) {
if (v2 instanceof Data_List_Types.Cons) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Control_Monad_Except.mapExcept(Data_Bifunctor.lmap(Data_Either.bifunctorEither)(Data_Functor.map(Data_List_Types.functorNonEmptyList)(Foreign.ErrorAtIndex.create(v1))))(decode_(dictDecode_)(v)(v2.value0)))(function (v3) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))({
result: v3,
rest: v2.value1,
next: v1 + 1 | 0
});
});
};
return Foreign.fail(new Foreign.ForeignError("Not enough constructor arguments"));
};
};
});
};
var decodeRecord_ = function (dict) {
return dict.decodeRecord_;
};
var decode_Record = function (dictRowToList) {
return function (dictDecodeRecord) {
return new Decode_(function (opts) {
return Data_Functor.map(Data_Functor.functorFn)(Data_Functor.map(Control_Monad_Except_Trans.functorExceptT(Data_Identity.functorIdentity))(Data_Function.flip(Record_Builder.build)({})))(decodeRecord_(dictDecodeRecord)(Type_Data_RowList.RLProxy.value)(opts));
});
};
};
var decodeRecordNil = new DecodeRecord(function (v) {
return function (v1) {
return function (v2) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(Control_Category.identity(Record_Builder.categoryBuilder));
};
};
});
var decodeRecordCons = function (dictCons) {
return function (dictDecodeRecord) {
return function (dictIsSymbol) {
return function (dictDecode_) {
return function (dictLacks) {
return new DecodeRecord(function (v) {
return function (opts) {
return function (f) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(decodeRecord_(dictDecodeRecord)(Type_Data_RowList.RLProxy.value)(opts)(f))(function (v1) {
var l = Data_Symbol.reflectSymbol(dictIsSymbol)(Data_Symbol.SProxy.value);
var l_transformed = opts.fieldTransform(l);
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Foreign_Index.index(Foreign_Index.indexString)(f)(l_transformed))(function (v2) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Control_Monad_Except.mapExcept(Data_Bifunctor.lmap(Data_Either.bifunctorEither)(Data_Functor.map(Data_List_Types.functorNonEmptyList)(Foreign.ErrorAtProperty.create(l_transformed))))(decode_(dictDecode_)(opts)(v2)))(function (v3) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(Control_Semigroupoid.composeFlipped(Record_Builder.semigroupoidBuilder)(v1)(Record_Builder.insert(dictCons)(dictLacks)(dictIsSymbol)(Data_Symbol.SProxy.value)(v3)));
});
});
});
};
};
});
};
};
};
};
};
var decodeOpts = function (dict) {
return dict.decodeOpts;
};
var genericDecodeSum = function (dictGenericDecode) {
return function (dictGenericDecode1) {
return new GenericDecode(function (opts) {
return function (f) {
var opts$prime = {
unwrapSingleConstructors: false,
fieldTransform: opts.fieldTransform,
sumEncoding: opts.sumEncoding,
unwrapSingleArguments: opts.unwrapSingleArguments
};
return Control_Alt.alt(Control_Monad_Except_Trans.altExceptT(Data_List_Types.semigroupNonEmptyList)(Data_Identity.monadIdentity))(Data_Functor.map(Control_Monad_Except_Trans.functorExceptT(Data_Identity.functorIdentity))(Data_Generic_Rep.Inl.create)(decodeOpts(dictGenericDecode)(opts$prime)(f)))(Data_Functor.map(Control_Monad_Except_Trans.functorExceptT(Data_Identity.functorIdentity))(Data_Generic_Rep.Inr.create)(decodeOpts(dictGenericDecode1)(opts$prime)(f)));
};
});
};
};
var decodeArgs = function (dict) {
return dict.decodeArgs;
};
var genericDecodeArgsProduct = function (dictGenericDecodeArgs) {
return function (dictGenericDecodeArgs1) {
return new GenericDecodeArgs(function (opts) {
return function (i) {
return function (xs) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(decodeArgs(dictGenericDecodeArgs)(opts)(i)(xs))(function (v) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(decodeArgs(dictGenericDecodeArgs1)(opts)(v.next)(v.rest))(function (v1) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))({
result: new Data_Generic_Rep.Product(v.result, v1.result),
rest: v1.rest,
next: v1.next
});
});
});
};
};
});
};
};
var countArgs = function (dict) {
return dict.countArgs;
};
var genericCountArgsProduct = function (dictGenericCountArgs) {
return function (dictGenericCountArgs1) {
return new GenericCountArgs(function (v) {
var v1 = countArgs(dictGenericCountArgs1)(Type_Proxy["Proxy"].value);
var v2 = countArgs(dictGenericCountArgs)(Type_Proxy["Proxy"].value);
if (v2 instanceof Data_Either.Left && v1 instanceof Data_Either.Left) {
return new Data_Either.Left(new Data_Generic_Rep.Product(v2.value0, v1.value0));
};
if (v2 instanceof Data_Either.Left && v1 instanceof Data_Either.Right) {
return new Data_Either.Right(v1.value0);
};
if (v2 instanceof Data_Either.Right && v1 instanceof Data_Either.Left) {
return new Data_Either.Right(v2.value0);
};
if (v2 instanceof Data_Either.Right && v1 instanceof Data_Either.Right) {
return new Data_Either.Right(v2.value0 + v1.value0 | 0);
};
throw new Error("Failed pattern match at Foreign.Generic.Class line 168, column 5 - line 172, column 40: " + [ v2.constructor.name, v1.constructor.name ]);
});
};
};
var genericDecodeConstructor = function (dictIsSymbol) {
return function (dictGenericDecodeArgs) {
return function (dictGenericCountArgs) {
return new GenericDecode(function (opts) {
return function (f) {
var numArgs = countArgs(dictGenericCountArgs)(Type_Proxy["Proxy"].value);
var readArguments = function (args) {
if (numArgs instanceof Data_Either.Left) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(numArgs.value0);
};
if (numArgs instanceof Data_Either.Right && (numArgs.value0 === 1 && opts.unwrapSingleArguments)) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(decodeArgs(dictGenericDecodeArgs)(opts)(0)(Data_List.singleton(args)))(function (v) {
return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Control_Applicative.unless(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(Data_List["null"](v.rest))(Foreign.fail(new Foreign.ForeignError("Expected a single argument"))))(function () {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(v.result);
});
});
};
if (numArgs instanceof Data_Either.Right) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Foreign.readArray(args))(function (v) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(decodeArgs(dictGenericDecodeArgs)(opts)(0)(Data_List.fromFoldable(Data_Foldable.foldableArray)(v)))(function (v1) {
return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Control_Applicative.unless(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(Data_List["null"](v1.rest))(Foreign.fail(new Foreign.ForeignError("Expected " + (Data_Show.show(Data_Show.showInt)(numArgs.value0) + " constructor arguments")))))(function () {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(v1.result);
});
});
});
};
throw new Error("Failed pattern match at Foreign.Generic.Class line 75, column 9 - line 87, column 24: " + [ numArgs.constructor.name ]);
};
var ctorName = Data_Symbol.reflectSymbol(dictIsSymbol)(Data_Symbol.SProxy.value);
if (opts.unwrapSingleConstructors) {
return Data_Functor.map(Control_Monad_Except_Trans.functorExceptT(Data_Identity.functorIdentity))(Data_Generic_Rep.Constructor)(readArguments(f));
};
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Control_Monad_Except.mapExcept(Data_Bifunctor.lmap(Data_Either.bifunctorEither)(Data_Functor.map(Data_List_Types.functorNonEmptyList)(Foreign.ErrorAtProperty.create(opts.sumEncoding.value0.tagFieldName))))(Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Foreign_Index.index(Foreign_Index.indexString)(f)(opts.sumEncoding.value0.tagFieldName))(Foreign.readString))(function (v) {
var expected = opts.sumEncoding.value0.constructorTagTransform(ctorName);
return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Control_Applicative.unless(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(v === expected)(Foreign.fail(new Foreign.ForeignError("Expected " + (Data_Show.show(Data_Show.showString)(expected) + " tag")))))(function () {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(v);
});
})))(function (v) {
return Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Control_Monad_Except.mapExcept(Data_Bifunctor.lmap(Data_Either.bifunctorEither)(Data_Functor.map(Data_List_Types.functorNonEmptyList)(Foreign.ErrorAtProperty.create(opts.sumEncoding.value0.contentsFieldName))))(Control_Bind.bind(Control_Monad_Except_Trans.bindExceptT(Data_Identity.monadIdentity))(Foreign_Index.index(Foreign_Index.indexString)(f)(opts.sumEncoding.value0.contentsFieldName))(readArguments)))(function (v1) {
return Control_Applicative.pure(Control_Monad_Except_Trans.applicativeExceptT(Data_Identity.monadIdentity))(v1);
});
});
};
});
};
};
};
exports["countArgs"] = countArgs;
exports["decodeArgs"] = decodeArgs;
exports["decodeOpts"] = decodeOpts;
exports["decodeRecord_"] = decodeRecord_;
exports["decode_"] = decode_;
exports["encodeArgs"] = encodeArgs;
exports["encodeOpts"] = encodeOpts;
exports["encode_"] = encode_;
exports["GenericDecode"] = GenericDecode;
exports["GenericEncode"] = GenericEncode;
exports["GenericDecodeArgs"] = GenericDecodeArgs;
exports["GenericEncodeArgs"] = GenericEncodeArgs;
exports["GenericCountArgs"] = GenericCountArgs;
exports["Decode_"] = Decode_;
exports["Encode_"] = Encode_;
exports["DecodeRecord"] = DecodeRecord;
exports["genericDecodeConstructor"] = genericDecodeConstructor;
exports["genericEncodeConstructor"] = genericEncodeConstructor;
exports["genericDecodeSum"] = genericDecodeSum;
exports["genericDecodeArgsNoArguments"] = genericDecodeArgsNoArguments;
exports["genericDecodeArgsArgument"] = genericDecodeArgsArgument;
exports["genericEncodeArgsArgument"] = genericEncodeArgsArgument;
exports["genericDecodeArgsProduct"] = genericDecodeArgsProduct;
exports["genericCountArgsNoArguments"] = genericCountArgsNoArguments;
exports["genericCountArgsArgument"] = genericCountArgsArgument;
exports["genericCountArgsProduct"] = genericCountArgsProduct;
exports["decode_Record"] = decode_Record;
exports["decode_Other"] = decode_Other;
exports["encode_Other"] = encode_Other;
exports["decodeRecordNil"] = decodeRecordNil;
exports["decodeRecordCons"] = decodeRecordCons;
})(PS["Foreign.Generic.Class"] = PS["Foreign.Generic.Class"] || {});
(function(exports) {
"use strict";
exports.parseJSONImpl = function (str) {
return JSON.parse(str);
};
})(PS["Foreign.JSON"] = PS["Foreign.JSON"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Foreign.JSON"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad_Except = PS["Control.Monad.Except"];
var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Bifunctor = PS["Data.Bifunctor"];
var Data_Either = PS["Data.Either"];
var Data_Identity = PS["Data.Identity"];
var Data_List_Types = PS["Data.List.Types"];
var Effect_Exception = PS["Effect.Exception"];
var Effect_Uncurried = PS["Effect.Uncurried"];
var Effect_Unsafe = PS["Effect.Unsafe"];
var Foreign = PS["Foreign"];
var Prelude = PS["Prelude"];
var parseJSON = function ($0) {
return Control_Monad_Except_Trans.ExceptT(Data_Identity.Identity(Data_Bifunctor.lmap(Data_Either.bifunctorEither)(function ($1) {
return Control_Applicative.pure(Data_List_Types.applicativeNonEmptyList)(Foreign.ForeignError.create(Effect_Exception.message($1)));
})(Effect_Unsafe.unsafePerformEffect(Effect_Exception["try"](function () {
return $foreign.parseJSONImpl($0);
})))));
};
exports["parseJSON"] = parseJSON;
})(PS["Foreign.JSON"] = PS["Foreign.JSON"] || {});
(function(exports) {
/* globals exports, JSON */
"use strict";
exports.unsafeStringify = function (x) {
return JSON.stringify(x);
};
})(PS["Global.Unsafe"] = PS["Global.Unsafe"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Global.Unsafe"];
exports["unsafeStringify"] = $foreign.unsafeStringify;
})(PS["Global.Unsafe"] = PS["Global.Unsafe"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Monad_Except_Trans = PS["Control.Monad.Except.Trans"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Functor = PS["Data.Functor"];
var Data_Generic_Rep = PS["Data.Generic.Rep"];
var Data_Identity = PS["Data.Identity"];
var Foreign = PS["Foreign"];
var Foreign_Class = PS["Foreign.Class"];
var Foreign_Generic_Class = PS["Foreign.Generic.Class"];
var Foreign_Generic_Types = PS["Foreign.Generic.Types"];
var Foreign_JSON = PS["Foreign.JSON"];
var Global_Unsafe = PS["Global.Unsafe"];
var Prelude = PS["Prelude"];
var genericEncode = function (dictGeneric) {
return function (dictGenericEncode) {
return function (opts) {
return function ($10) {
return Foreign_Generic_Class.encodeOpts(dictGenericEncode)(opts)(Data_Generic_Rep.from(dictGeneric)($10));
};
};
};
};
var genericDecode = function (dictGeneric) {
return function (dictGenericDecode) {
return function (opts) {
return function ($12) {
return Data_Functor.map(Control_Monad_Except_Trans.functorExceptT(Data_Identity.functorIdentity))(Data_Generic_Rep.to(dictGeneric))(Foreign_Generic_Class.decodeOpts(dictGenericDecode)(opts)($12));
};
};
};
};
var defaultOptions = {
sumEncoding: new Foreign_Generic_Types.TaggedObject({
tagFieldName: "tag",
contentsFieldName: "contents",
constructorTagTransform: Control_Category.identity(Control_Category.categoryFn)
}),
unwrapSingleConstructors: false,
unwrapSingleArguments: true,
fieldTransform: Control_Category.identity(Control_Category.categoryFn)
};
exports["defaultOptions"] = defaultOptions;
exports["genericDecode"] = genericDecode;
exports["genericEncode"] = genericEncode;
})(PS["Foreign.Generic"] = PS["Foreign.Generic"] || {});
(function(exports) {exports["showUI'"] = function(sc,screen) {
return function() {
var screenJSON = JSON.parse(screen);
var screenName = screenJSON.tag;
screenJSON.screen = screenName;
window.__duiShowScreen(sc, screenJSON);
}
};
})(PS["Main"] = PS["Main"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Category = PS["Control.Category"];
var Data_Generic_Rep = PS["Data.Generic.Rep"];
var Foreign = PS["Foreign"];
var Foreign_Generic = PS["Foreign.Generic"];
var Foreign_Generic_Class = PS["Foreign.Generic.Class"];
var Foreign_Generic_EnumEncoding = PS["Foreign.Generic.EnumEncoding"];
var Foreign_Generic_Types = PS["Foreign.Generic.Types"];
var Prelude = PS["Prelude"];
var options = {
sumEncoding: Foreign_Generic.defaultOptions.sumEncoding,
unwrapSingleConstructors: true,
unwrapSingleArguments: Foreign_Generic.defaultOptions.unwrapSingleArguments,
fieldTransform: Foreign_Generic.defaultOptions.fieldTransform
};
var defaultDecode = function (dictGeneric) {
return function (dictGenericDecode) {
return function (x) {
return Foreign_Generic.genericDecode(dictGeneric)(dictGenericDecode)(options)(x);
};
};
};
exports["defaultDecode"] = defaultDecode;
})(PS["Presto.Core.Utils.Encoding"] = PS["Presto.Core.Utils.Encoding"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Data_Generic_Rep = PS["Data.Generic.Rep"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Show = PS["Data.Show"];
var Data_Symbol = PS["Data.Symbol"];
var Foreign = PS["Foreign"];
var Foreign_Class = PS["Foreign.Class"];
var Foreign_Generic_Class = PS["Foreign.Generic.Class"];
var Prelude = PS["Prelude"];
var Presto_Core_Utils_Encoding = PS["Presto.Core.Utils.Encoding"];
var POST = (function () {
function POST() {
};
POST.value = new POST();
return POST;
})();
var GET = (function () {
function GET() {
};
GET.value = new GET();
return GET;
})();
var PUT = (function () {
function PUT() {
};
PUT.value = new PUT();
return PUT;
})();
var DELETE = (function () {
function DELETE() {
};
DELETE.value = new DELETE();
return DELETE;
})();
var Header = (function () {
function Header(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Header.create = function (value0) {
return function (value1) {
return new Header(value0, value1);
};
};
return Header;
})();
var genericRequest = new Data_Generic_Rep.Generic(function (x) {
return x;
}, function (x) {
return x;
});
var genericMethod = new Data_Generic_Rep.Generic(function (x) {
if (x instanceof POST) {
return new Data_Generic_Rep.Inl(Data_Generic_Rep.NoArguments.value);
};
if (x instanceof GET) {
return new Data_Generic_Rep.Inr(new Data_Generic_Rep.Inl(Data_Generic_Rep.NoArguments.value));
};
if (x instanceof PUT) {
return new Data_Generic_Rep.Inr(new Data_Generic_Rep.Inr(new Data_Generic_Rep.Inl(Data_Generic_Rep.NoArguments.value)));
};
if (x instanceof DELETE) {
return new Data_Generic_Rep.Inr(new Data_Generic_Rep.Inr(new Data_Generic_Rep.Inr(Data_Generic_Rep.NoArguments.value)));
};
throw new Error("Failed pattern match at Presto.Core.Types.API line 94, column 8 - line 94, column 50: " + [ x.constructor.name ]);
}, function (x) {
if (x instanceof Data_Generic_Rep.Inl) {
return POST.value;
};
if (x instanceof Data_Generic_Rep.Inr && x.value0 instanceof Data_Generic_Rep.Inl) {
return GET.value;
};
if (x instanceof Data_Generic_Rep.Inr && (x.value0 instanceof Data_Generic_Rep.Inr && x.value0.value0 instanceof Data_Generic_Rep.Inl)) {
return PUT.value;
};
if (x instanceof Data_Generic_Rep.Inr && (x.value0 instanceof Data_Generic_Rep.Inr && x.value0.value0 instanceof Data_Generic_Rep.Inr)) {
return DELETE.value;
};
throw new Error("Failed pattern match at Presto.Core.Types.API line 94, column 8 - line 94, column 50: " + [ x.constructor.name ]);
});
var genericHeaders = new Data_Generic_Rep.Generic(function (x) {
return x;
}, function (x) {
return x;
});
var genericHeader = new Data_Generic_Rep.Generic(function (x) {
return new Data_Generic_Rep.Product(x.value0, x.value1);
}, function (x) {
return new Header(x.value0, x.value1);
});
var decodeMethod = new Foreign_Class.Decode(Presto_Core_Utils_Encoding.defaultDecode(genericMethod)(Foreign_Generic_Class.genericDecodeSum(Foreign_Generic_Class.genericDecodeConstructor(new Data_Symbol.IsSymbol(function () {
return "POST";
}))(Foreign_Generic_Class.genericDecodeArgsNoArguments)(Foreign_Generic_Class.genericCountArgsNoArguments))(Foreign_Generic_Class.genericDecodeSum(Foreign_Generic_Class.genericDecodeConstructor(new Data_Symbol.IsSymbol(function () {
return "GET";
}))(Foreign_Generic_Class.genericDecodeArgsNoArguments)(Foreign_Generic_Class.genericCountArgsNoArguments))(Foreign_Generic_Class.genericDecodeSum(Foreign_Generic_Class.genericDecodeConstructor(new Data_Symbol.IsSymbol(function () {
return "PUT";
}))(Foreign_Generic_Class.genericDecodeArgsNoArguments)(Foreign_Generic_Class.genericCountArgsNoArguments))(Foreign_Generic_Class.genericDecodeConstructor(new Data_Symbol.IsSymbol(function () {
return "DELETE";
}))(Foreign_Generic_Class.genericDecodeArgsNoArguments)(Foreign_Generic_Class.genericCountArgsNoArguments))))));
var decodeHeaderG = new Foreign_Class.Decode(Presto_Core_Utils_Encoding.defaultDecode(genericHeader)(Foreign_Generic_Class.genericDecodeConstructor(new Data_Symbol.IsSymbol(function () {
return "Header";
}))(Foreign_Generic_Class.genericDecodeArgsProduct(Foreign_Generic_Class.genericDecodeArgsArgument(Foreign_Generic_Class.decode_Other(Foreign_Class.stringDecode)))(Foreign_Generic_Class.genericDecodeArgsArgument(Foreign_Generic_Class.decode_Other(Foreign_Class.stringDecode))))(Foreign_Generic_Class.genericCountArgsProduct(Foreign_Generic_Class.genericCountArgsArgument)(Foreign_Generic_Class.genericCountArgsArgument))));
var decodeHeadersG = new Foreign_Class.Decode(Presto_Core_Utils_Encoding.defaultDecode(genericHeaders)(Foreign_Generic_Class.genericDecodeConstructor(new Data_Symbol.IsSymbol(function () {
return "Headers";
}))(Foreign_Generic_Class.genericDecodeArgsArgument(Foreign_Generic_Class.decode_Other(Foreign_Class.arrayDecode(decodeHeaderG))))(Foreign_Generic_Class.genericCountArgsArgument)));
var decodeRequestG = new Foreign_Class.Decode(Presto_Core_Utils_Encoding.defaultDecode(genericRequest)(Foreign_Generic_Class.genericDecodeConstructor(new Data_Symbol.IsSymbol(function () {
return "Request";
}))(Foreign_Generic_Class.genericDecodeArgsArgument(Foreign_Generic_Class.decode_Record()(Foreign_Generic_Class.decodeRecordCons()(Foreign_Generic_Class.decodeRecordCons()(Foreign_Generic_Class.decodeRecordCons()(Foreign_Generic_Class.decodeRecordCons()(Foreign_Generic_Class.decodeRecordNil)(new Data_Symbol.IsSymbol(function () {
return "url";
}))(Foreign_Generic_Class.decode_Other(Foreign_Class.stringDecode))())(new Data_Symbol.IsSymbol(function () {
return "payload";
}))(Foreign_Generic_Class.decode_Other(Foreign_Class.stringDecode))())(new Data_Symbol.IsSymbol(function () {
return "method";
}))(Foreign_Generic_Class.decode_Other(decodeMethod))())(new Data_Symbol.IsSymbol(function () {
return "headers";
}))(Foreign_Generic_Class.decode_Other(decodeHeadersG))())))(Foreign_Generic_Class.genericCountArgsArgument)));
exports["POST"] = POST;
exports["GET"] = GET;
exports["PUT"] = PUT;
exports["DELETE"] = DELETE;
exports["Header"] = Header;
exports["genericMethod"] = genericMethod;
exports["decodeMethod"] = decodeMethod;
exports["genericHeader"] = genericHeader;
exports["decodeHeaderG"] = decodeHeaderG;
exports["genericHeaders"] = genericHeaders;
exports["decodeHeadersG"] = decodeHeadersG;
exports["genericRequest"] = genericRequest;
exports["decodeRequestG"] = decodeRequestG;
})(PS["Presto.Core.Types.API"] = PS["Presto.Core.Types.API"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Monad_Except = PS["Control.Monad.Except"];
var Control_Monad_Free = PS["Control.Monad.Free"];
var Data_Either = PS["Data.Either"];
var Data_Function = PS["Data.Function"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Show = PS["Data.Show"];
var Effect_Exception = PS["Effect.Exception"];
var Foreign = PS["Foreign"];
var Foreign_Class = PS["Foreign.Class"];
var Prelude = PS["Prelude"];
var ForeignOut = function (x) {
return x;
};
var Request = (function () {
function Request(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Request.create = function (value0) {
return function (value1) {
return new Request(value0, value1);
};
};
return Request;
})();
var Interact = function (Decode1, Encode0, interact) {
this.Decode1 = Decode1;
this.Encode0 = Encode0;
this.interact = interact;
};
var request = function (fgnIn) {
return Control_Bind.bind(Control_Monad_Free.freeBind)(Control_Monad_Free.liftF(new Request(fgnIn, Control_Category.identity(Control_Category.categoryFn))))(function (v) {
return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(v);
});
};
var interact = function (dict) {
return dict.interact;
};
var defaultInteract = function (dictEncode) {
return function (dictDecode) {
return function (a) {
return Control_Bind.bind(Control_Monad_Free.freeBind)(request(Foreign_Class.encode(dictEncode)(a)))(function (v) {
var v1 = Control_Monad_Except.runExcept(Foreign_Class.decode(dictDecode)(v));
if (v1 instanceof Data_Either.Right) {
return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(new Data_Either.Right(v1.value0));
};
if (v1 instanceof Data_Either.Left) {
return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(Data_Either.Left.create(Effect_Exception.error(Data_Show.show(Data_List_Types.showNonEmptyList(Foreign.showForeignError))(v1.value0))));
};
throw new Error("Failed pattern match at Presto.Core.Types.Language.Interaction line 51, column 3 - line 53, column 42: " + [ v1.constructor.name ]);
});
};
};
};
exports["Interact"] = Interact;
exports["interact"] = interact;
exports["request"] = request;
exports["defaultInteract"] = defaultInteract;
exports["Request"] = Request;
exports["ForeignOut"] = ForeignOut;
})(PS["Presto.Core.Types.Language.Interaction"] = PS["Presto.Core.Types.Language.Interaction"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
var Control_Monad_Except = PS["Control.Monad.Except"];
var Control_Monad_Free = PS["Control.Monad.Free"];
var Data_Either = PS["Data.Either"];
var Data_Function = PS["Data.Function"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Semigroup = PS["Data.Semigroup"];
var Data_Show = PS["Data.Show"];
var Effect_Aff = PS["Effect.Aff"];
var Effect_Exception = PS["Effect.Exception"];
var Foreign = PS["Foreign"];
var Foreign_Class = PS["Foreign.Class"];
var Prelude = PS["Prelude"];
var Presto_Core_Types_API = PS["Presto.Core.Types.API"];
var Presto_Core_Types_Language_Interaction = PS["Presto.Core.Types.Language.Interaction"];
var interpretAPI = function (apiRunner) {
return function (v) {
var v1 = Control_Monad_Except.runExcept(Foreign_Class.decode(Presto_Core_Types_API.decodeRequestG)(v.value0));
if (v1 instanceof Data_Either.Left) {
return Control_Monad_Error_Class.throwError(Effect_Aff.monadThrowAff)(Effect_Exception.error("apiInteract is broken: " + Data_Show.show(Data_List_Types.showNonEmptyList(Foreign.showForeignError))(v1.value0)));
};
if (v1 instanceof Data_Either.Right) {
return Control_Bind.bind(Effect_Aff.bindAff)(apiRunner(v1.value0))(function (v2) {
return Control_Applicative.pure(Effect_Aff.applicativeAff)(v.value1(Presto_Core_Types_Language_Interaction.ForeignOut(Foreign_Class.encode(Foreign_Class.stringEncode)(v2))));
});
};
throw new Error("Failed pattern match at Presto.Core.Language.Runtime.API line 22, column 3 - line 27, column 45: " + [ v1.constructor.name ]);
};
};
var runAPIInteraction = function (apiRunner) {
return Control_Monad_Free.foldFree(Effect_Aff.monadRecAff)(interpretAPI(apiRunner));
};
exports["runAPIInteraction"] = runAPIInteraction;
})(PS["Presto.Core.Language.Runtime.API"] = PS["Presto.Core.Language.Runtime.API"] || {});
(function(exports) {exports.getValueFromLocalStoreImpl = function(key) {
return JBridge.getFromSharedPrefs(key);
};
exports.setValueToLocalStoreImpl = function(key, value) {
return JBridge.setInSharedPrefs(key, value);
};
})(PS["Presto.Core.LocalStorage"] = PS["Presto.Core.LocalStorage"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var $foreign = PS["Presto.Core.LocalStorage"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Data_Eq = PS["Data.Eq"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Maybe = PS["Data.Maybe"];
var Effect_Aff = PS["Effect.Aff"];
var Effect_Class = PS["Effect.Class"];
var Effect_Uncurried = PS["Effect.Uncurried"];
var Prelude = PS["Prelude"];
var setValueToLocalStore = function (k) {
return function (v) {
return Effect_Class.liftEffect(Effect_Aff.monadEffectAff)(function () {
return $foreign.setValueToLocalStoreImpl(k, v);
});
};
};
var getValueFromLocalStore = function (k) {
var v = Effect_Class.liftEffect(Effect_Aff.monadEffectAff)(function () {
return $foreign.getValueFromLocalStoreImpl(k);
});
return Control_Bind.ifM(Effect_Aff.bindAff)(Data_Functor.map(Effect_Aff.functorAff)(Data_Eq.eq(Data_Eq.eqString)("__failed"))(v))(Control_Applicative.pure(Effect_Aff.applicativeAff)(Data_Maybe.Nothing.value))(Data_Functor.map(Effect_Aff.functorAff)(Data_Maybe.Just.create)(v));
};
exports["getValueFromLocalStore"] = getValueFromLocalStore;
exports["setValueToLocalStore"] = setValueToLocalStore;
})(PS["Presto.Core.LocalStorage"] = PS["Presto.Core.LocalStorage"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Data_Eq = PS["Data.Eq"];
var Data_Generic_Rep = PS["Data.Generic.Rep"];
var Data_Generic_Rep_Show = PS["Data.Generic.Rep.Show"];
var Data_Show = PS["Data.Show"];
var Data_Symbol = PS["Data.Symbol"];
var Data_Tuple = PS["Data.Tuple"];
var Foreign_Class = PS["Foreign.Class"];
var Foreign_Generic = PS["Foreign.Generic"];
var Foreign_Generic_Class = PS["Foreign.Generic.Class"];
var Prelude = PS["Prelude"];
var PermissionGranted = (function () {
function PermissionGranted() {
};
PermissionGranted.value = new PermissionGranted();
return PermissionGranted;
})();
exports["PermissionGranted"] = PermissionGranted;
})(PS["Presto.Core.Types.Permission"] = PS["Presto.Core.Types.Permission"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Bind = PS["Control.Bind"];
var Control_Category = PS["Control.Category"];
var Control_Monad_Free = PS["Control.Monad.Free"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Exists = PS["Data.Exists"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_Maybe = PS["Data.Maybe"];
var Data_Show = PS["Data.Show"];
var Data_Time_Duration = PS["Data.Time.Duration"];
var Data_Unit = PS["Data.Unit"];
var Effect_Aff = PS["Effect.Aff"];
var Effect_Aff_AVar = PS["Effect.Aff.AVar"];
var Effect_Exception = PS["Effect.Exception"];
var Foreign_Class = PS["Foreign.Class"];
var Prelude = PS["Prelude"];
var Presto_Core_Types_API = PS["Presto.Core.Types.API"];
var Presto_Core_Types_Language_APIInteract = PS["Presto.Core.Types.Language.APIInteract"];
var Presto_Core_Types_Language_Interaction = PS["Presto.Core.Types.Language.Interaction"];
var Presto_Core_Types_Language_Storage = PS["Presto.Core.Types.Language.Storage"];
var Presto_Core_Types_Permission = PS["Presto.Core.Types.Permission"];
var LocalStore = (function () {
function LocalStore() {
};
LocalStore.value = new LocalStore();
return LocalStore;
})();
var InMemoryStore = (function () {
function InMemoryStore() {
};
InMemoryStore.value = new InMemoryStore();
return InMemoryStore;
})();
var ThrowError = (function () {
function ThrowError(value0) {
this.value0 = value0;
};
ThrowError.create = function (value0) {
return new ThrowError(value0);
};
return ThrowError;
})();
var ReturnResult = (function () {
function ReturnResult(value0) {
this.value0 = value0;
};
ReturnResult.create = function (value0) {
return new ReturnResult(value0);
};
return ReturnResult;
})();
var RunUI = (function () {
function RunUI(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
RunUI.create = function (value0) {
return function (value1) {
return new RunUI(value0, value1);
};
};
return RunUI;
})();
var ForkUI = (function () {
function ForkUI(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
ForkUI.create = function (value0) {
return function (value1) {
return new ForkUI(value0, value1);
};
};
return ForkUI;
})();
var CallAPI = (function () {
function CallAPI(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
CallAPI.create = function (value0) {
return function (value1) {
return new CallAPI(value0, value1);
};
};
return CallAPI;
})();
var Get = (function () {
function Get(value0, value1, value2) {
this.value0 = value0;
this.value1 = value1;
this.value2 = value2;
};
Get.create = function (value0) {
return function (value1) {
return function (value2) {
return new Get(value0, value1, value2);
};
};
};
return Get;
})();
var $$Set = (function () {
function $$Set(value0, value1, value2, value3) {
this.value0 = value0;
this.value1 = value1;
this.value2 = value2;
this.value3 = value3;
};
$$Set.create = function (value0) {
return function (value1) {
return function (value2) {
return function (value3) {
return new $$Set(value0, value1, value2, value3);
};
};
};
};
return $$Set;
})();
var Fork = (function () {
function Fork(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Fork.create = function (value0) {
return function (value1) {
return new Fork(value0, value1);
};
};
return Fork;
})();
var DoAff = (function () {
function DoAff(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
DoAff.create = function (value0) {
return function (value1) {
return new DoAff(value0, value1);
};
};
return DoAff;
})();
var Await = (function () {
function Await(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Await.create = function (value0) {
return function (value1) {
return new Await(value0, value1);
};
};
return Await;
})();
var Delay = (function () {
function Delay(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Delay.create = function (value0) {
return function (value1) {
return new Delay(value0, value1);
};
};
return Delay;
})();
var OneOf = (function () {
function OneOf(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
OneOf.create = function (value0) {
return function (value1) {
return new OneOf(value0, value1);
};
};
return OneOf;
})();
var HandleError = (function () {
function HandleError(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
HandleError.create = function (value0) {
return function (value1) {
return new HandleError(value0, value1);
};
};
return HandleError;
})();
var CheckPermissions = (function () {
function CheckPermissions(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
CheckPermissions.create = function (value0) {
return function (value1) {
return new CheckPermissions(value0, value1);
};
};
return CheckPermissions;
})();
var TakePermissions = (function () {
function TakePermissions(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
TakePermissions.create = function (value0) {
return function (value1) {
return new TakePermissions(value0, value1);
};
};
return TakePermissions;
})();
var FlowWrapper = function (x) {
return x;
};
var wrap = function ($17) {
return Control_Monad_Free.liftF(FlowWrapper(Data_Exists.mkExists($17)));
};
var withError = function (toMsg) {
return function (flow) {
var flow$prime = Control_Bind.bind(Control_Monad_Free.freeBind)(flow)(Data_Either.either(function ($18) {
return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(ThrowError.create(toMsg($18)));
})(function ($19) {
return Control_Applicative.pure(Control_Monad_Free.freeApplicative)(ReturnResult.create($19));
}));
return wrap(new HandleError(flow$prime, Control_Category.identity(Control_Category.categoryFn)));
};
};
var runUI$prime = function (dictInteract) {
return function (a) {
return wrap(new RunUI(Presto_Core_Types_Language_Interaction.interact(dictInteract)(a), Control_Category.identity(Control_Category.categoryFn)));
};
};
var runUI = function (dictInteract) {
return function ($20) {
return withError(Data_Show.show(Effect_Exception.showError))(runUI$prime(dictInteract)($20));
};
};
exports["LocalStore"] = LocalStore;
exports["InMemoryStore"] = InMemoryStore;
exports["ThrowError"] = ThrowError;
exports["ReturnResult"] = ReturnResult;
exports["RunUI"] = RunUI;
exports["ForkUI"] = ForkUI;
exports["CallAPI"] = CallAPI;
exports["Get"] = Get;
exports["Set"] = $$Set;
exports["Fork"] = Fork;
exports["DoAff"] = DoAff;
exports["Await"] = Await;
exports["Delay"] = Delay;
exports["OneOf"] = OneOf;
exports["HandleError"] = HandleError;
exports["CheckPermissions"] = CheckPermissions;
exports["TakePermissions"] = TakePermissions;
exports["FlowWrapper"] = FlowWrapper;
exports["wrap"] = wrap;
exports["withError"] = withError;
exports["runUI"] = runUI;
})(PS["Presto.Core.Types.Language.Flow"] = PS["Presto.Core.Types.Language.Flow"] || {});
(function(exports) {
// Generated by purs version 0.12.0
"use strict";
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad_Error_Class = PS["Control.Monad.Error.Class"];
var Control_Monad_Except = PS["Control.Monad.Except"];
var Control_Monad_Free = PS["Control.Monad.Free"];
var Control_Monad_State_Class = PS["Control.Monad.State.Class"];
var Control_Monad_State_Trans = PS["Control.Monad.State.Trans"];
var Control_Monad_Trans_Class = PS["Control.Monad.Trans.Class"];
var Control_Parallel = PS["Control.Parallel"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Exists = PS["Data.Exists"];
var Data_Foldable = PS["Data.Foldable"];
var Data_Function = PS["Data.Function"];
var Data_Functor = PS["Data.Functor"];
var Data_List_Types = PS["Data.List.Types"];
var Data_Show = PS["Data.Show"];
var Data_Tuple = PS["Data.Tuple"];
var Effect = PS["Effect"];
var Effect_Aff = PS["Effect.Aff"];
var Effect_Aff_AVar = PS["Effect.Aff.AVar"];
var Effect_Exception = PS["Effect.Exception"];
var Foreign = PS["Foreign"];
var Foreign_JSON = PS["Foreign.JSON"];
var Foreign_Object = PS["Foreign.Object"];
var Global_Unsafe = PS["Global.Unsafe"];
var Prelude = PS["Prelude"];
var Presto_Core_Language_Runtime_API = PS["Presto.Core.Language.Runtime.API"];
var Presto_Core_LocalStorage = PS["Presto.Core.LocalStorage"];
var Presto_Core_Types_Language_Flow = PS["Presto.Core.Types.Language.Flow"];
var Presto_Core_Types_Language_Interaction = PS["Presto.Core.Types.Language.Interaction"];
var Presto_Core_Types_Language_Storage = PS["Presto.Core.Types.Language.Storage"];
var Presto_Core_Types_Permission = PS["Presto.Core.Types.Permission"];
var PermissionRunner = (function () {
function PermissionRunner(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
PermissionRunner.create = function (value0) {
return function (value1) {
return new PermissionRunner(value0, value1);
};
};
return PermissionRunner;
})();
var Runtime = (function () {
function Runtime(value0, value1, value2) {
this.value0 = value0;
this.value1 = value1;
this.value2 = value2;
};
Runtime.create = function (value0) {
return function (value1) {
return function (value2) {
return new Runtime(value0, value1, value2);
};
};
};
return Runtime;
})();
var updateState = function (key) {
return function (value) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_State_Class.get(Control_Monad_State_Trans.monadStateStateT(Effect_Aff.monadAff)))(function (v) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Effect_Aff_AVar.take(v)))(function (v1) {
var st$prime = Foreign_Object.insert(key)(value)(v1);
return Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Effect_Aff_AVar.put(st$prime)(v));
});
});
};
};
var runErrorHandler = function (v) {
if (v instanceof Presto_Core_Types_Language_Flow.ThrowError) {
return Control_Monad_Error_Class.throwError(Control_Monad_State_Trans.monadThrowStateT(Effect_Aff.monadThrowAff))(Effect_Exception.error(v.value0));
};
if (v instanceof Presto_Core_Types_Language_Flow.ReturnResult) {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v.value0);
};
throw new Error("Failed pattern match at Presto.Core.Language.Runtime.Interpreter line 79, column 1 - line 79, column 63: " + [ v.constructor.name ]);
};
var readState = Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_State_Class.get(Control_Monad_State_Trans.monadStateStateT(Effect_Aff.monadAff)))(function ($91) {
return Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Effect_Aff_AVar.read($91));
});
var interpretUI = function (uiRunner) {
return function (v) {
return Control_Bind.bind(Effect_Aff.bindAff)(uiRunner(Global_Unsafe.unsafeStringify(v.value0)))(function (v1) {
var v2 = Control_Monad_Except.runExcept(Foreign_JSON.parseJSON(v1));
if (v2 instanceof Data_Either.Right) {
return Control_Applicative.pure(Effect_Aff.applicativeAff)(v.value1(v2.value0));
};
if (v2 instanceof Data_Either.Left) {
return Control_Monad_Error_Class.throwError(Effect_Aff.monadThrowAff)(Effect_Exception.error(Data_Show.show(Data_List_Types.showNonEmptyList(Foreign.showForeignError))(v2.value0)));
};
throw new Error("Failed pattern match at Presto.Core.Language.Runtime.Interpreter line 63, column 3 - line 65, column 46: " + [ v2.constructor.name ]);
});
};
};
var runUIInteraction = function (uiRunner) {
return Control_Monad_Free.foldFree(Effect_Aff.monadRecAff)(interpretUI(uiRunner));
};
var run = function (runtime) {
return Control_Monad_Free.foldFree(Control_Monad_State_Trans.monadRecStateT(Effect_Aff.monadRecAff))(function (v) {
return Data_Exists.runExists(interpret(runtime))(v);
});
};
var interpret = function (v) {
return function (v1) {
if (v1 instanceof Presto_Core_Types_Language_Flow.CallAPI) {
return Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Control_Bind.bind(Effect_Aff.bindAff)(Presto_Core_Language_Runtime_API.runAPIInteraction(v.value2)(v1.value0))(function ($92) {
return Control_Applicative.pure(Effect_Aff.applicativeAff)(v1.value1($92));
}));
};
if (v1 instanceof Presto_Core_Types_Language_Flow.RunUI) {
return Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Control_Bind.bind(Effect_Aff.bindAff)(runUIInteraction(v.value0)(v1.value0))(function ($93) {
return Control_Applicative.pure(Effect_Aff.applicativeAff)(v1.value1($93));
}));
};
if (v1 instanceof Presto_Core_Types_Language_Flow.ForkUI) {
return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Data_Functor["void"](Control_Monad_State_Trans.functorStateT(Effect_Aff.functorAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Effect_Aff.forkAff(runUIInteraction(v.value0)(v1.value0)))))(function () {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value1);
});
};
if (v1 instanceof Presto_Core_Types_Language_Flow.Get && v1.value0 instanceof Presto_Core_Types_Language_Flow.LocalStore) {
return Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Control_Bind.bind(Effect_Aff.bindAff)(Presto_Core_LocalStorage.getValueFromLocalStore(v1.value1))(function ($94) {
return Control_Applicative.pure(Effect_Aff.applicativeAff)(v1.value2($94));
}));
};
if (v1 instanceof Presto_Core_Types_Language_Flow.Get && v1.value0 instanceof Presto_Core_Types_Language_Flow.InMemoryStore) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(readState)(function ($95) {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value2(Foreign_Object.lookup(v1.value1)($95)));
});
};
if (v1 instanceof Presto_Core_Types_Language_Flow["Set"] && v1.value0 instanceof Presto_Core_Types_Language_Flow.LocalStore) {
return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Presto_Core_LocalStorage.setValueToLocalStore(v1.value1)(v1.value2)))(function () {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value3);
});
};
if (v1 instanceof Presto_Core_Types_Language_Flow["Set"] && v1.value0 instanceof Presto_Core_Types_Language_Flow.InMemoryStore) {
return Control_Apply.applySecond(Control_Monad_State_Trans.applyStateT(Effect_Aff.monadAff))(updateState(v1.value1)(v1.value2))(Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value3));
};
if (v1 instanceof Presto_Core_Types_Language_Flow.Fork) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(forkFlow(v)(v1.value0))(function ($96) {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value1($96));
});
};
if (v1 instanceof Presto_Core_Types_Language_Flow.DoAff) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(v1.value0))(function ($97) {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value1($97));
});
};
if (v1 instanceof Presto_Core_Types_Language_Flow.Await) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Effect_Aff_AVar.read(v1.value0)))(function ($98) {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value1($98));
});
};
if (v1 instanceof Presto_Core_Types_Language_Flow.Delay) {
return Control_Apply.applySecond(Control_Monad_State_Trans.applyStateT(Effect_Aff.monadAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Effect_Aff.delay(v1.value0)))(Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value1));
};
if (v1 instanceof Presto_Core_Types_Language_Flow.OneOf) {
var parFlow = function (st) {
return function (flow) {
return Control_Monad_State_Trans.runStateT(run(v)(flow))(st);
};
};
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_State_Class.get(Control_Monad_State_Trans.monadStateStateT(Effect_Aff.monadAff)))(function (v2) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Control_Parallel.parOneOf(Effect_Aff.parallelAff)(Effect_Aff.alternativeParAff)(Data_Foldable.foldableArray)(Data_Functor.functorArray)(Data_Functor.map(Data_Functor.functorArray)(parFlow(v2))(v1.value0))))(function (v3) {
return Control_Bind.discard(Control_Bind.discardUnit)(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_State_Class.put(Control_Monad_State_Trans.monadStateStateT(Effect_Aff.monadAff))(v3.value1))(function () {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value1(v3.value0));
});
});
});
};
if (v1 instanceof Presto_Core_Types_Language_Flow.HandleError) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(run(v)(v1.value0))(runErrorHandler))(function ($99) {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1.value1($99));
});
};
if (v1 instanceof Presto_Core_Types_Language_Flow.CheckPermissions) {
return Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Control_Bind.bind(Effect_Aff.bindAff)(v.value1.value0(v1.value0))(function ($100) {
return Control_Applicative.pure(Effect_Aff.applicativeAff)(v1.value1($100));
}));
};
if (v1 instanceof Presto_Core_Types_Language_Flow.TakePermissions) {
return Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Control_Bind.bind(Effect_Aff.bindAff)(v.value1.value1(v1.value0))(function ($101) {
return Control_Applicative.pure(Effect_Aff.applicativeAff)(v1.value1($101));
}));
};
throw new Error("Failed pattern match at Presto.Core.Language.Runtime.Interpreter line 83, column 1 - line 83, column 64: " + [ v.constructor.name, v1.constructor.name ]);
};
};
var forkFlow = function (rt) {
return function (flow) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_State_Class.get(Control_Monad_State_Trans.monadStateStateT(Effect_Aff.monadAff)))(function (v) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Effect_Aff_AVar.empty))(function (v1) {
var m = Control_Monad_State_Trans.evalStateT(Effect_Aff.functorAff)(run(rt)(flow))(v);
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Effect_Aff.monadAff))(Control_Monad_Trans_Class.lift(Control_Monad_State_Trans.monadTransStateT)(Effect_Aff.monadAff)(Effect_Aff.forkAff(Control_Bind.bind(Effect_Aff.bindAff)(m)(Data_Function.flip(Effect_Aff_AVar.put)(v1)))))(function (v2) {
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Effect_Aff.monadAff))(v1);
});
});
});
};
};
exports["Runtime"] = Runtime;
exports["PermissionRunner"] = PermissionRunner;
exports["run"] = run;
})(PS["Presto.Core.Language.Runtime.Interpreter"] = PS["Presto.Core.Language.Runtime.Interpreter"] || {});
(function(exports) {
"use strict";
var $foreign = PS["Main"];
var Control_Applicative = PS["Control.Applicative"];
var Control_Apply = PS["Control.Apply"];
var Control_Bind = PS["Control.Bind"];
var Control_Monad_Free = PS["Control.Monad.Free"];
var Control_Monad_State_Trans = PS["Control.Monad.State.Trans"];
var Control_Semigroupoid = PS["Control.Semigroupoid"];
var Data_Either = PS["Data.Either"];
var Data_Function = PS["Data.Function"];
var Data_Function_Uncurried = PS["Data.Function.Uncurried"];
var Data_Generic_Rep = PS["Data.Generic.Rep"];
var Data_Semiring = PS["Data.Semiring"];
var Data_Symbol = PS["Data.Symbol"];
var Data_Unit = PS["Data.Unit"];
var Effect = PS["Effect"];
var Effect_Aff = PS["Effect.Aff"];
var Effect_Aff_AVar = PS["Effect.Aff.AVar"];
var Effect_Exception = PS["Effect.Exception"];
var Foreign_Class = PS["Foreign.Class"];
var Foreign_Generic = PS["Foreign.Generic"];
var Foreign_Generic_Class = PS["Foreign.Generic.Class"];
var Foreign_Object = PS["Foreign.Object"];
var Prelude = PS["Prelude"];
var Presto_Core_Flow = PS["Presto.Core.Flow"];
var Presto_Core_Language_Runtime_Interpreter = PS["Presto.Core.Language.Runtime.Interpreter"];
var Presto_Core_Types_Language_Flow = PS["Presto.Core.Types.Language.Flow"];
var Presto_Core_Types_Language_Interaction = PS["Presto.Core.Types.Language.Interaction"];
var Presto_Core_Types_Permission = PS["Presto.Core.Types.Permission"];
var Increment = (function () {
function Increment() {
};
Increment.value = new Increment();
return Increment;
})();
// Creating Screen
var CounterScreen = (function () {
function CounterScreen(value0) {
this.value0 = value0;
};
CounterScreen.create = function (value0) {
return new CounterScreen(value0);
};
return CounterScreen;
})();
var genericCounterScreenAction = new Data_Generic_Rep.Generic(function (x) {
return Data_Generic_Rep.NoArguments.value;
}, function (x) {
return Increment.value;
});
var genericCounterScreen = new Data_Generic_Rep.Generic(function (x) {
return x.value0;
}, function (x) {
return new CounterScreen(x);
});
var encodeCounterScreen = new Foreign_Class.Encode(Foreign_Generic.genericEncode(genericCounterScreen)(Foreign_Generic_Class.genericEncodeConstructor(new Data_Symbol.IsSymbol(function () {
return "CounterScreen";
}))(Foreign_Generic_Class.genericEncodeArgsArgument(Foreign_Generic_Class.encode_Other(Foreign_Class.intEncode))))({
sumEncoding: Foreign_Generic.defaultOptions.sumEncoding,
unwrapSingleConstructors: false,
unwrapSingleArguments: Foreign_Generic.defaultOptions.unwrapSingleArguments,
fieldTransform: Foreign_Generic.defaultOptions.fieldTransform
}));
var defaultPermissionStatus = function (permissions) {
return Effect_Aff.makeAff(function (callback) {
return Control_Apply.applySecond(Effect.applyEffect)(callback(Data_Either.Right.create(Presto_Core_Types_Permission.PermissionGranted.value)))(Control_Applicative.pure(Effect.applicativeEffect)(Effect_Aff.nonCanceler));
});
};
var defaultPermissionRequest = function (permissions) {
return Effect_Aff.makeAff(function (callback) {
return Control_Apply.applySecond(Effect.applyEffect)(callback(Data_Either.Right.create([ ])))(Control_Applicative.pure(Effect.applicativeEffect)(Effect_Aff.nonCanceler));
});
};
var decodeCounterScreenAction = new Foreign_Class.Decode(Foreign_Generic.genericDecode(genericCounterScreenAction)(Foreign_Generic_Class.genericDecodeConstructor(new Data_Symbol.IsSymbol(function () {
return "Increment";
}))(Foreign_Generic_Class.genericDecodeArgsNoArguments)(Foreign_Generic_Class.genericCountArgsNoArguments))({
sumEncoding: Foreign_Generic.defaultOptions.sumEncoding,
unwrapSingleConstructors: true,
unwrapSingleArguments: Foreign_Generic.defaultOptions.unwrapSingleArguments,
fieldTransform: Foreign_Generic.defaultOptions.fieldTransform
}));
var counterScreenInteract = new Presto_Core_Types_Language_Interaction.Interact(function () {
return decodeCounterScreenAction;
}, function () {
return encodeCounterScreen;
}, function (x) {
return Presto_Core_Types_Language_Interaction.defaultInteract(encodeCounterScreen)(decodeCounterScreenAction)(x);
});
// Presents UI to user, waits to action and recurse.
var count = function (val) {
return Control_Bind.bind(Control_Monad_Free.freeBind)(Presto_Core_Types_Language_Flow.runUI(counterScreenInteract)(new CounterScreen(val)))(function (v) {
return count(val + 1 | 0);
});
};
var appFlow = Control_Apply.applySecond(Control_Monad_Free.freeApply)(count(0))(Control_Applicative.pure(Control_Monad_Free.freeApplicative)(Data_Unit.unit));
var launchApp = (function () {
var uiRunner = function (a) {
return Effect_Aff.makeAff(function (callback) {
return Control_Apply.applySecond(Effect.applyEffect)($foreign["showUI'"](function ($12) {
return callback(Data_Either.Right.create($12));
}, a))(Control_Applicative.pure(Effect.applicativeEffect)(Effect_Aff.nonCanceler));
});
};
var permissionRunner = new Presto_Core_Language_Runtime_Interpreter.PermissionRunner(defaultPermissionStatus, defaultPermissionRequest);
var apiRunner = function (request) {
return Effect_Aff.makeAff(function (callback) {
return Control_Apply.applySecond(Effect.applyEffect)(callback(Data_Either.Right.create("Test")))(Control_Applicative.pure(Effect.applicativeEffect)(Effect_Aff.nonCanceler));
});
};
var runtime = new Presto_Core_Language_Runtime_Interpreter.Runtime(uiRunner, permissionRunner, apiRunner);
var freeFlow = Control_Monad_State_Trans.evalStateT(Effect_Aff.functorAff)(Presto_Core_Language_Runtime_Interpreter.run(runtime)(appFlow));
return Effect_Aff.launchAff_(Control_Bind.bind(Effect_Aff.bindAff)(Effect_Aff_AVar["new"](Foreign_Object.empty))(freeFlow));
})();
var main = launchApp;
exports["count"] = count;
exports["appFlow"] = appFlow;
exports["launchApp"] = launchApp;
exports["main"] = main;
exports["CounterScreen"] = CounterScreen;
exports["Increment"] = Increment;
exports["defaultPermissionStatus"] = defaultPermissionStatus;
exports["defaultPermissionRequest"] = defaultPermissionRequest;
exports["counterScreenInteract"] = counterScreenInteract;
exports["genericCounterScreen"] = genericCounterScreen;
exports["encodeCounterScreen"] = encodeCounterScreen;
exports["genericCounterScreenAction"] = genericCounterScreenAction;
exports["decodeCounterScreenAction"] = decodeCounterScreenAction;
exports["showUI'"] = $foreign["showUI'"];
})(PS["Main"] = PS["Main"] || {});
PS["Main"].main();