File: Desugar.hs

package info (click to toggle)
uuagc 0.9.56-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,764 kB
  • sloc: haskell: 84,340; makefile: 11
file content (4468 lines) | stat: -rw-r--r-- 245,940 bytes parent folder | download
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
{-# LANGUAGE Rank2Types, GADTs #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Desugar where
{-# LINE 2 "src-ag/HsToken.ag" #-}

import CommonTypes
import UU.Scanner.Position(Pos)
{-# LINE 11 "src-generated/Desugar.hs" #-}

{-# LINE 2 "src-ag/Expression.ag" #-}

import UU.Scanner.Position(Pos)
import HsToken
{-# LINE 17 "src-generated/Desugar.hs" #-}

{-# LINE 2 "src-ag/Patterns.ag" #-}

-- Patterns.ag imports
import UU.Scanner.Position(Pos)
import CommonTypes (ConstructorIdent,Identifier)
{-# LINE 24 "src-generated/Desugar.hs" #-}

{-# LINE 2 "src-ag/AbstractSyntax.ag" #-}

-- AbstractSyntax.ag imports
import Data.Set(Set)
import Data.Map(Map)
import Patterns    (Pattern(..),Patterns)
import Expression  (Expression(..))
import Macro --marcos
import CommonTypes
import ErrorMessages
{-# LINE 36 "src-generated/Desugar.hs" #-}

{-# LINE 14 "src-ag/Desugar.ag" #-}

import qualified Data.Set as Set
import qualified Data.Map as Map
import Data.Map(Map)
import qualified Data.Sequence as Seq
import Data.Sequence(Seq,(><))
import UU.Scanner.Position(Pos(..))
import Data.Maybe
import Data.List(intersperse)

import AbstractSyntax
import ErrorMessages
import Options
import HsToken
import HsTokenScanner
import TokenDef
import CommonTypes
{-# LINE 56 "src-generated/Desugar.hs" #-}
import Control.Monad.Identity (Identity)
import qualified Control.Monad.Identity
{-# LINE 98 "src-ag/Desugar.ag" #-}

addl :: Int -> Pos -> Pos
addl n (Pos l c f) = Pos (l+n) c f
{-# LINE 63 "src-generated/Desugar.hs" #-}

{-# LINE 133 "src-ag/Desugar.ag" #-}

maybeError :: a -> Error -> Maybe a -> (a, Seq Error)
maybeError def err mb
  = maybe (def, Seq.singleton err) (\r -> (r, Seq.empty)) mb

findField :: Identifier -> Identifier -> [(Identifier,Identifier)] -> Maybe Identifier
findField fld attr list
  | fld == _FIRST = f list
  | fld == _LAST  = f (reverse list)
  | otherwise     = Just fld
  where
    f = lookup attr
{-# LINE 78 "src-generated/Desugar.hs" #-}

{-# LINE 204 "src-ag/Desugar.ag" #-}

mergeAttributes :: AttrMap -> AttrMap -> AttrMap
mergeAttributes = Map.unionWith $ Map.unionWith $ Set.union
{-# LINE 84 "src-generated/Desugar.hs" #-}

{-# LINE 251 "src-ag/Desugar.ag" #-}

desugarExprs :: Options -> NontermIdent -> ConstructorIdent ->
                [(Identifier, Identifier)] -> [(Identifier, Identifier)] ->
                Seq Error -> [Expression] -> (Seq Error, [Expression])
desugarExprs options nt con childInhs childSyns
  = mapAccum (desugarExpr options nt con childInhs childSyns)
  where mapAccum f e = foldr (\x (e0,xs) -> let (e1,x') = f e0 x in (e1, x:xs)) (e, [])

desugarExpr :: Options -> NontermIdent -> ConstructorIdent ->
               [(Identifier, Identifier)] -> [(Identifier, Identifier)] ->
               Seq Error -> Expression -> (Seq Error, Expression)
desugarExpr options nt con childInhs childSyns errs expr
  = (errs Seq.>< errors_Syn_Expression syn, output_Syn_Expression syn)
  where
    inh = Inh_Expression { childInhs_Inh_Expression = childInhs
                         , childSyns_Inh_Expression = childSyns
                         , con_Inh_Expression       = con
                         , nt_Inh_Expression        = nt
                         , options_Inh_Expression   = options
                         , ruleDescr_Inh_Expression = "augment-rule"
                         }
    sem = sem_Expression expr
    syn = wrap_Expression sem inh
{-# LINE 110 "src-generated/Desugar.hs" #-}

{-# LINE 294 "src-ag/Desugar.ag" #-}

addLateAttr :: Options -> String -> Attributes
addLateAttr options mainName
  | kennedyWarren options && lateHigherOrderBinding options =
      let tp = lateBindingType mainName
      in Map.singleton idLateBindingAttr tp
  | otherwise = Map.empty
{-# LINE 120 "src-generated/Desugar.hs" #-}
-- Child -------------------------------------------------------
-- wrapper
data Inh_Child  = Inh_Child { inhMap_Inh_Child :: !(Map Identifier Attributes), mainName_Inh_Child :: !(String), options_Inh_Child :: !(Options), synMap_Inh_Child :: !(Map Identifier Attributes) }
data Syn_Child  = Syn_Child { childInhs_Syn_Child :: !([(Identifier, Identifier)]), childSyns_Syn_Child :: !([(Identifier, Identifier)]), output_Syn_Child :: !(Child) }
{-# INLINABLE wrap_Child #-}
wrap_Child :: T_Child  -> Inh_Child  -> (Syn_Child )
wrap_Child !(T_Child act) !(Inh_Child _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg0 = T_Child_vIn0 _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap
        !(T_Child_vOut0 _lhsOchildInhs _lhsOchildSyns _lhsOoutput) <- return (inv_Child_s0 sem K_Child_v0 arg0)
        return (Syn_Child _lhsOchildInhs _lhsOchildSyns _lhsOoutput)
   )

-- cata
{-# INLINE sem_Child #-}
sem_Child :: Child  -> T_Child 
sem_Child ( Child !name_ !tp_ !kind_ ) = sem_Child_Child name_ tp_ kind_

-- semantic domain
newtype T_Child  = T_Child {
                           attach_T_Child :: Identity (T_Child_s0 )
                           }
data T_Child_s0  where C_Child_s0 :: {
                                     inv_Child_s0 :: !(forall t. K_Child_s0  t -> t)
                                     } -> T_Child_s0 
data T_Child_s1  = C_Child_s1
data T_Child_s34  = C_Child_s34
data K_Child_s0 k  where
   K_Child_v0 :: K_Child_s0  (T_Child_v0 )
   K_Child_v17 :: K_Child_s0  (T_Child_v17 )
type T_Child_v0  = (T_Child_vIn0 ) -> (T_Child_vOut0 )
data T_Child_vIn0  = T_Child_vIn0 !(Map Identifier Attributes) !(String) !(Options) !(Map Identifier Attributes)
data T_Child_vOut0  = T_Child_vOut0 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(Child)
type T_Child_v17  = (T_Child_vIn17 ) -> (T_Child_vOut17 )
data T_Child_vIn17  = T_Child_vIn17 !(Map Identifier Attributes) !(Map Identifier Attributes)
data T_Child_vOut17  = T_Child_vOut17 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(Child)
{-# NOINLINE sem_Child_Child #-}
sem_Child_Child :: (Identifier) -> (Type) -> (ChildKind) -> T_Child 
sem_Child_Child !arg_name_ !arg_tp_ !arg_kind_ = T_Child (return st0) where
   {-# NOINLINE st0 #-}
   !st0 = let
      k0 :: K_Child_s0  t -> t
      k0 K_Child_v0 = v0
      k0 K_Child_v17 = v17
      v0 :: T_Child_v0 
      v0 = \ !(T_Child_vIn0 _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let !_chnt = rule0 arg_name_ arg_tp_ in
         let !_inh = rule1 _chnt _lhsIinhMap in
         let _lhsOchildInhs :: [(Identifier, Identifier)]
             !_lhsOchildInhs = rule3 _inh arg_name_ in
         let !_syn = rule2 _chnt _lhsIsynMap in
         let _lhsOchildSyns :: [(Identifier, Identifier)]
             !_lhsOchildSyns = rule4 _syn arg_name_ in
         let _lhsOoutput :: Child
             !_lhsOoutput = rule5 arg_kind_ arg_name_ arg_tp_ in
         let !__result_ = T_Child_vOut0 _lhsOchildInhs _lhsOchildSyns _lhsOoutput
          in __result_ )
      v17 :: T_Child_v17 
      v17 = \ !(T_Child_vIn17 _lhsIinhMap _lhsIsynMap) -> (
         let !_chnt = rule0 arg_name_ arg_tp_ in
         let !_inh = rule1 _chnt _lhsIinhMap in
         let _lhsOchildInhs :: [(Identifier, Identifier)]
             !_lhsOchildInhs = rule3 _inh arg_name_ in
         let !_syn = rule2 _chnt _lhsIsynMap in
         let _lhsOchildSyns :: [(Identifier, Identifier)]
             !_lhsOchildSyns = rule4 _syn arg_name_ in
         let _lhsOoutput :: Child
             !_lhsOoutput = rule5 arg_kind_ arg_name_ arg_tp_ in
         let !__result_ = T_Child_vOut17 _lhsOchildInhs _lhsOchildSyns _lhsOoutput
          in __result_ )
     in C_Child_s0 k0
   {-# NOINLINE[1] rule0 #-}
   {-# LINE 19 "src-ag/DistChildAttr.ag" #-}
   rule0 = \ !name_ !tp_ ->
                       {-# LINE 19 "src-ag/DistChildAttr.ag" #-}
                       case tp_ of
                         NT nt _ _ -> nt
                         Self      -> error ("The type of child " ++ show name_ ++ " should not be a Self type.")
                         Haskell t -> identifier ""
                       {-# LINE 201 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule1 #-}
   {-# LINE 23 "src-ag/DistChildAttr.ag" #-}
   rule1 = \ !_chnt ((!_lhsIinhMap) :: Map Identifier Attributes) ->
                      {-# LINE 23 "src-ag/DistChildAttr.ag" #-}
                      Map.findWithDefault Map.empty _chnt     _lhsIinhMap
                      {-# LINE 207 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule2 #-}
   {-# LINE 24 "src-ag/DistChildAttr.ag" #-}
   rule2 = \ !_chnt ((!_lhsIsynMap) :: Map Identifier Attributes) ->
                      {-# LINE 24 "src-ag/DistChildAttr.ag" #-}
                      Map.findWithDefault Map.empty _chnt     _lhsIsynMap
                      {-# LINE 213 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule3 #-}
   {-# LINE 130 "src-ag/Desugar.ag" #-}
   rule3 = \ !_inh !name_ ->
                        {-# LINE 130 "src-ag/Desugar.ag" #-}
                        [(i, name_) | i <- Map.keys _inh     ]
                        {-# LINE 219 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule4 #-}
   {-# LINE 131 "src-ag/Desugar.ag" #-}
   rule4 = \ !_syn !name_ ->
                        {-# LINE 131 "src-ag/Desugar.ag" #-}
                        [(s, name_) | s <- Map.keys _syn     ]
                        {-# LINE 225 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule5 #-}
   {-# LINE 315 "src-ag/Desugar.ag" #-}
   rule5 = \ !kind_ !name_ !tp_ ->
                 {-# LINE 315 "src-ag/Desugar.ag" #-}
                 Child name_ tp_ kind_
                 {-# LINE 231 "src-generated/Desugar.hs" #-}

-- Children ----------------------------------------------------
-- wrapper
data Inh_Children  = Inh_Children { inhMap_Inh_Children :: !(Map Identifier Attributes), mainName_Inh_Children :: !(String), options_Inh_Children :: !(Options), synMap_Inh_Children :: !(Map Identifier Attributes) }
data Syn_Children  = Syn_Children { childInhs_Syn_Children :: !([(Identifier, Identifier)]), childSyns_Syn_Children :: !([(Identifier, Identifier)]), output_Syn_Children :: !(Children) }
{-# INLINABLE wrap_Children #-}
wrap_Children :: T_Children  -> Inh_Children  -> (Syn_Children )
wrap_Children !(T_Children act) !(Inh_Children _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg1 = T_Children_vIn1 _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap
        !(T_Children_vOut1 _lhsOchildInhs _lhsOchildSyns _lhsOoutput) <- return (inv_Children_s2 sem K_Children_v1 arg1)
        return (Syn_Children _lhsOchildInhs _lhsOchildSyns _lhsOoutput)
   )

-- cata
{-# NOINLINE sem_Children #-}
sem_Children :: Children  -> T_Children 
sem_Children list = Prelude.foldr sem_Children_Cons sem_Children_Nil (Prelude.map sem_Child list)

-- semantic domain
newtype T_Children  = T_Children {
                                 attach_T_Children :: Identity (T_Children_s2 )
                                 }
data T_Children_s2  where C_Children_s2 :: {
                                           inv_Children_s2 :: !(forall t. K_Children_s2  t -> t)
                                           } -> T_Children_s2 
data T_Children_s3  = C_Children_s3
data T_Children_s35  = C_Children_s35
data K_Children_s2 k  where
   K_Children_v1 :: K_Children_s2  (T_Children_v1 )
   K_Children_v18 :: K_Children_s2  (T_Children_v18 )
type T_Children_v1  = (T_Children_vIn1 ) -> (T_Children_vOut1 )
data T_Children_vIn1  = T_Children_vIn1 !(Map Identifier Attributes) !(String) !(Options) !(Map Identifier Attributes)
data T_Children_vOut1  = T_Children_vOut1 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(Children)
type T_Children_v18  = (T_Children_vIn18 ) -> (T_Children_vOut18 )
data T_Children_vIn18  = T_Children_vIn18 !(Map Identifier Attributes) !(Map Identifier Attributes)
data T_Children_vOut18  = T_Children_vOut18 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(Children)
{-# NOINLINE sem_Children_Cons #-}
sem_Children_Cons :: T_Child  -> T_Children  -> T_Children 
sem_Children_Cons arg_hd_ arg_tl_ = T_Children (return st2) where
   {-# NOINLINE st2 #-}
   !st2 = let
      k2 :: K_Children_s2  t -> t
      k2 K_Children_v1 = v1
      k2 K_Children_v18 = v18
      v1 :: T_Children_v1 
      v1 = \ !(T_Children_vIn1 _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let !_hdX0 = Control.Monad.Identity.runIdentity (attach_T_Child (arg_hd_)) in
         let !_tlX2 = Control.Monad.Identity.runIdentity (attach_T_Children (arg_tl_)) in
         let !_hdOinhMap = rule11 _lhsIinhMap in
         let !_tlOinhMap = rule15 _lhsIinhMap in
         let !_hdOsynMap = rule14 _lhsIsynMap in
         let !_tlOsynMap = rule18 _lhsIsynMap in
         let !(T_Child_vOut17 _hdIchildInhs _hdIchildSyns _hdIoutput) = inv_Child_s0 _hdX0 K_Child_v17 (T_Child_vIn17 _hdOinhMap _hdOsynMap) in
         let !(T_Children_vOut18 _tlIchildInhs _tlIchildSyns _tlIoutput) = inv_Children_s2 _tlX2 K_Children_v18 (T_Children_vIn18 _tlOinhMap _tlOsynMap) in
         let _lhsOchildInhs :: [(Identifier, Identifier)]
             !_lhsOchildInhs = rule7 _hdIchildInhs _tlIchildInhs in
         let _lhsOchildSyns :: [(Identifier, Identifier)]
             !_lhsOchildSyns = rule8 _hdIchildSyns _tlIchildSyns in
         let !_output = rule9 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Children
             !_lhsOoutput = rule10 _output in
         let !__result_ = T_Children_vOut1 _lhsOchildInhs _lhsOchildSyns _lhsOoutput
          in __result_ )
      v18 :: T_Children_v18 
      v18 = \ !(T_Children_vIn18 _lhsIinhMap _lhsIsynMap) -> (
         let !_hdX0 = Control.Monad.Identity.runIdentity (attach_T_Child (arg_hd_)) in
         let !_tlX2 = Control.Monad.Identity.runIdentity (attach_T_Children (arg_tl_)) in
         let !_hdOinhMap = rule11 _lhsIinhMap in
         let !_tlOinhMap = rule15 _lhsIinhMap in
         let !_hdOsynMap = rule14 _lhsIsynMap in
         let !_tlOsynMap = rule18 _lhsIsynMap in
         let !(T_Child_vOut17 _hdIchildInhs _hdIchildSyns _hdIoutput) = inv_Child_s0 _hdX0 K_Child_v17 (T_Child_vIn17 _hdOinhMap _hdOsynMap) in
         let !(T_Children_vOut18 _tlIchildInhs _tlIchildSyns _tlIoutput) = inv_Children_s2 _tlX2 K_Children_v18 (T_Children_vIn18 _tlOinhMap _tlOsynMap) in
         let _lhsOchildInhs :: [(Identifier, Identifier)]
             !_lhsOchildInhs = rule7 _hdIchildInhs _tlIchildInhs in
         let _lhsOchildSyns :: [(Identifier, Identifier)]
             !_lhsOchildSyns = rule8 _hdIchildSyns _tlIchildSyns in
         let !_output = rule9 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Children
             !_lhsOoutput = rule10 _output in
         let !__result_ = T_Children_vOut18 _lhsOchildInhs _lhsOchildSyns _lhsOoutput
          in __result_ )
     in C_Children_s2 k2
   {-# NOINLINE[1] rule7 #-}
   rule7 = \ ((!_hdIchildInhs) :: [(Identifier, Identifier)]) ((!_tlIchildInhs) :: [(Identifier, Identifier)]) ->
     _hdIchildInhs ++ _tlIchildInhs
   {-# NOINLINE[1] rule8 #-}
   rule8 = \ ((!_hdIchildSyns) :: [(Identifier, Identifier)]) ((!_tlIchildSyns) :: [(Identifier, Identifier)]) ->
     _hdIchildSyns ++ _tlIchildSyns
   {-# NOINLINE[1] rule9 #-}
   rule9 = \ ((!_hdIoutput) :: Child) ((!_tlIoutput) :: Children) ->
     (:) _hdIoutput _tlIoutput
   {-# NOINLINE[1] rule10 #-}
   rule10 = \ !_output ->
     _output
   {-# NOINLINE[1] rule11 #-}
   rule11 = \ ((!_lhsIinhMap) :: Map Identifier Attributes) ->
     _lhsIinhMap
   {-# NOINLINE[1] rule14 #-}
   rule14 = \ ((!_lhsIsynMap) :: Map Identifier Attributes) ->
     _lhsIsynMap
   {-# NOINLINE[1] rule15 #-}
   rule15 = \ ((!_lhsIinhMap) :: Map Identifier Attributes) ->
     _lhsIinhMap
   {-# NOINLINE[1] rule18 #-}
   rule18 = \ ((!_lhsIsynMap) :: Map Identifier Attributes) ->
     _lhsIsynMap
{-# NOINLINE sem_Children_Nil #-}
sem_Children_Nil ::  T_Children 
sem_Children_Nil  = T_Children (return st2) where
   {-# NOINLINE st2 #-}
   !st2 = let
      k2 :: K_Children_s2  t -> t
      k2 K_Children_v1 = v1
      k2 K_Children_v18 = v18
      v1 :: T_Children_v1 
      v1 = \ !(T_Children_vIn1 _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let _lhsOchildInhs :: [(Identifier, Identifier)]
             !_lhsOchildInhs = rule19  () in
         let _lhsOchildSyns :: [(Identifier, Identifier)]
             !_lhsOchildSyns = rule20  () in
         let !_output = rule21  () in
         let _lhsOoutput :: Children
             !_lhsOoutput = rule22 _output in
         let !__result_ = T_Children_vOut1 _lhsOchildInhs _lhsOchildSyns _lhsOoutput
          in __result_ )
      v18 :: T_Children_v18 
      v18 = \ !(T_Children_vIn18 _lhsIinhMap _lhsIsynMap) -> (
         let _lhsOchildInhs :: [(Identifier, Identifier)]
             !_lhsOchildInhs = rule19  () in
         let _lhsOchildSyns :: [(Identifier, Identifier)]
             !_lhsOchildSyns = rule20  () in
         let !_output = rule21  () in
         let _lhsOoutput :: Children
             !_lhsOoutput = rule22 _output in
         let !__result_ = T_Children_vOut18 _lhsOchildInhs _lhsOchildSyns _lhsOoutput
          in __result_ )
     in C_Children_s2 k2
   {-# NOINLINE[1] rule19 #-}
   rule19 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule20 #-}
   rule20 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule21 #-}
   rule21 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule22 #-}
   rule22 = \ !_output ->
     _output

-- Expression --------------------------------------------------
-- wrapper
data Inh_Expression  = Inh_Expression { childInhs_Inh_Expression :: !([(Identifier, Identifier)]), childSyns_Inh_Expression :: !([(Identifier, Identifier)]), con_Inh_Expression :: !(ConstructorIdent), nt_Inh_Expression :: !(NontermIdent), options_Inh_Expression :: !(Options), ruleDescr_Inh_Expression :: !(String) }
data Syn_Expression  = Syn_Expression { errors_Syn_Expression :: !(Seq Error), output_Syn_Expression :: !(Expression) }
{-# INLINABLE wrap_Expression #-}
wrap_Expression :: T_Expression  -> Inh_Expression  -> (Syn_Expression )
wrap_Expression !(T_Expression act) !(Inh_Expression _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIoptions _lhsIruleDescr) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg2 = T_Expression_vIn2 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIoptions _lhsIruleDescr
        !(T_Expression_vOut2 _lhsOerrors _lhsOoutput) <- return (inv_Expression_s4 sem arg2)
        return (Syn_Expression _lhsOerrors _lhsOoutput)
   )

-- cata
{-# INLINE sem_Expression #-}
sem_Expression :: Expression  -> T_Expression 
sem_Expression ( Expression !pos_ !tks_ ) = sem_Expression_Expression pos_ tks_

-- semantic domain
newtype T_Expression  = T_Expression {
                                     attach_T_Expression :: Identity (T_Expression_s4 )
                                     }
newtype T_Expression_s4  = C_Expression_s4 {
                                           inv_Expression_s4 :: (T_Expression_v2 )
                                           }
data T_Expression_s5  = C_Expression_s5
type T_Expression_v2  = (T_Expression_vIn2 ) -> (T_Expression_vOut2 )
data T_Expression_vIn2  = T_Expression_vIn2 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(ConstructorIdent) !(NontermIdent) !(Options) !(String)
data T_Expression_vOut2  = T_Expression_vOut2 !(Seq Error) !(Expression)
{-# NOINLINE sem_Expression_Expression #-}
sem_Expression_Expression :: (Pos) -> ([HsToken]) -> T_Expression 
sem_Expression_Expression !arg_pos_ !arg_tks_ = T_Expression (return st4) where
   {-# NOINLINE st4 #-}
   !st4 = let
      v2 :: T_Expression_v2 
      v2 = \ !(T_Expression_vIn2 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIoptions _lhsIruleDescr) -> (
         let _lhsOerrors :: Seq Error
             !(!_tks',!_lhsOerrors) = rule23 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIoptions _lhsIruleDescr arg_tks_ in
         let _lhsOoutput :: Expression
             !_lhsOoutput = rule24 _tks' arg_pos_ in
         let !__result_ = T_Expression_vOut2 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Expression_s4 v2
   {-# INLINE rule23 #-}
   {-# LINE 49 "src-ag/Desugar.ag" #-}
   rule23 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ((!_lhsIchildSyns) :: [(Identifier, Identifier)]) ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) ((!_lhsIoptions) :: Options) ((!_lhsIruleDescr) :: String) !tks_ ->
                                 {-# LINE 49 "src-ag/Desugar.ag" #-}
                                 let inh = Inh_HsTokensRoot { childInhs_Inh_HsTokensRoot     = _lhsIchildInhs
                                                            , childSyns_Inh_HsTokensRoot     = _lhsIchildSyns
                                                            , nt_Inh_HsTokensRoot            = _lhsInt
                                                            , con_Inh_HsTokensRoot           = _lhsIcon
                                                            , ruleDescr_Inh_HsTokensRoot     = _lhsIruleDescr
                                                            , useFieldIdent_Inh_HsTokensRoot = genUseTraces _lhsIoptions
                                                            }
                                     sem = sem_HsTokensRoot (HsTokensRoot tks_)
                                     syn = wrap_HsTokensRoot sem inh
                                 in (tks_Syn_HsTokensRoot syn, errors_Syn_HsTokensRoot syn)
                                 {-# LINE 443 "src-generated/Desugar.hs" #-}
   {-# INLINE rule24 #-}
   {-# LINE 59 "src-ag/Desugar.ag" #-}
   rule24 = \ !_tks' !pos_ ->
                     {-# LINE 59 "src-ag/Desugar.ag" #-}
                     Expression pos_ _tks'
                     {-# LINE 449 "src-generated/Desugar.hs" #-}

-- Grammar -----------------------------------------------------
-- wrapper
data Inh_Grammar  = Inh_Grammar { forcedIrrefutables_Inh_Grammar :: !(AttrMap), mainName_Inh_Grammar :: !(String), options_Inh_Grammar :: !(Options) }
data Syn_Grammar  = Syn_Grammar { allAttributes_Syn_Grammar :: !(AttrMap), errors_Syn_Grammar :: !(Seq Error), output_Syn_Grammar :: !(Grammar) }
{-# INLINABLE wrap_Grammar #-}
wrap_Grammar :: T_Grammar  -> Inh_Grammar  -> (Syn_Grammar )
wrap_Grammar !(T_Grammar act) !(Inh_Grammar _lhsIforcedIrrefutables _lhsImainName _lhsIoptions) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg3 = T_Grammar_vIn3 _lhsIforcedIrrefutables _lhsImainName _lhsIoptions
        !(T_Grammar_vOut3 _lhsOallAttributes _lhsOerrors _lhsOoutput) <- return (inv_Grammar_s6 sem arg3)
        return (Syn_Grammar _lhsOallAttributes _lhsOerrors _lhsOoutput)
   )

-- cata
{-# INLINE sem_Grammar #-}
sem_Grammar :: Grammar  -> T_Grammar 
sem_Grammar ( Grammar !typeSyns_ !useMap_ !derivings_ !wrappers_ nonts_ !pragmas_ !manualAttrOrderMap_ !paramMap_ !contextMap_ !quantMap_ !uniqueMap_ !augmentsMap_ !aroundsMap_ !mergeMap_ ) = sem_Grammar_Grammar typeSyns_ useMap_ derivings_ wrappers_ ( sem_Nonterminals nonts_ ) pragmas_ manualAttrOrderMap_ paramMap_ contextMap_ quantMap_ uniqueMap_ augmentsMap_ aroundsMap_ mergeMap_

-- semantic domain
newtype T_Grammar  = T_Grammar {
                               attach_T_Grammar :: Identity (T_Grammar_s6 )
                               }
newtype T_Grammar_s6  = C_Grammar_s6 {
                                     inv_Grammar_s6 :: (T_Grammar_v3 )
                                     }
data T_Grammar_s7  = C_Grammar_s7
type T_Grammar_v3  = (T_Grammar_vIn3 ) -> (T_Grammar_vOut3 )
data T_Grammar_vIn3  = T_Grammar_vIn3 !(AttrMap) !(String) !(Options)
data T_Grammar_vOut3  = T_Grammar_vOut3 !(AttrMap) !(Seq Error) !(Grammar)
{-# NOINLINE sem_Grammar_Grammar #-}
sem_Grammar_Grammar :: (TypeSyns) -> (UseMap) -> (Derivings) -> (Set NontermIdent) -> T_Nonterminals  -> (PragmaMap) -> (AttrOrderMap) -> (ParamMap) -> (ContextMap) -> (QuantMap) -> (UniqueMap) -> (Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) -> (Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) -> (Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))) -> T_Grammar 
sem_Grammar_Grammar !arg_typeSyns_ !arg_useMap_ !arg_derivings_ !arg_wrappers_ arg_nonts_ !arg_pragmas_ !arg_manualAttrOrderMap_ !arg_paramMap_ !arg_contextMap_ !arg_quantMap_ !arg_uniqueMap_ !arg_augmentsMap_ !arg_aroundsMap_ !arg_mergeMap_ = T_Grammar (return st6) where
   {-# NOINLINE st6 #-}
   !st6 = let
      v3 :: T_Grammar_v3 
      v3 = \ !(T_Grammar_vIn3 _lhsIforcedIrrefutables _lhsImainName _lhsIoptions) -> (
         let !_nontsX16 = Control.Monad.Identity.runIdentity (attach_T_Nonterminals (arg_nonts_)) in
         let !_nontsOaugmentsIn = rule28 arg_augmentsMap_ in
         let !_nontsOoptions = rule35 _lhsIoptions in
         let !_nontsOforcedIrrefutables = rule33 _lhsIforcedIrrefutables in
         let !_nontsOmainName = rule34 _lhsImainName in
         let !(T_Nonterminals_vOut19 _nontsIallAttributes _nontsIinhMap' _nontsIsynMap' _nontsX36) = inv_Nonterminals_s16 _nontsX16 K_Nonterminals_v19 (T_Nonterminals_vIn19 ) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule30 _nontsIallAttributes in
         let !_nontsOinhMap = rule26 _nontsIinhMap' in
         let !_nontsOsynMap = rule27 _nontsIsynMap' in
         let !(T_Nonterminals_vOut20 _nontsIaugmentsOut _nontsIerrors _nontsIoutput) = inv_Nonterminals_s36 _nontsX36 (T_Nonterminals_vIn20 _nontsOaugmentsIn _nontsOforcedIrrefutables _nontsOinhMap _nontsOmainName _nontsOoptions _nontsOsynMap) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule31 _nontsIerrors in
         let _lhsOoutput :: Grammar
             !_lhsOoutput = rule29 _nontsIaugmentsOut _nontsIoutput arg_aroundsMap_ arg_contextMap_ arg_derivings_ arg_manualAttrOrderMap_ arg_mergeMap_ arg_paramMap_ arg_pragmas_ arg_quantMap_ arg_typeSyns_ arg_uniqueMap_ arg_useMap_ arg_wrappers_ in
         let !__result_ = T_Grammar_vOut3 _lhsOallAttributes _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Grammar_s6 v3
   {-# INLINE rule26 #-}
   {-# LINE 15 "src-ag/DistChildAttr.ag" #-}
   rule26 = \ ((!_nontsIinhMap') :: Map Identifier Attributes) ->
                             {-# LINE 15 "src-ag/DistChildAttr.ag" #-}
                             _nontsIinhMap'
                             {-# LINE 511 "src-generated/Desugar.hs" #-}
   {-# INLINE rule27 #-}
   {-# LINE 16 "src-ag/DistChildAttr.ag" #-}
   rule27 = \ ((!_nontsIsynMap') :: Map Identifier Attributes) ->
                             {-# LINE 16 "src-ag/DistChildAttr.ag" #-}
                             _nontsIsynMap'
                             {-# LINE 517 "src-generated/Desugar.hs" #-}
   {-# INLINE rule28 #-}
   {-# LINE 235 "src-ag/Desugar.ag" #-}
   rule28 = \ !augmentsMap_ ->
                           {-# LINE 235 "src-ag/Desugar.ag" #-}
                           augmentsMap_
                           {-# LINE 523 "src-generated/Desugar.hs" #-}
   {-# INLINE rule29 #-}
   {-# LINE 319 "src-ag/Desugar.ag" #-}
   rule29 = \ ((!_nontsIaugmentsOut) :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ((!_nontsIoutput) :: Nonterminals) !aroundsMap_ !contextMap_ !derivings_ !manualAttrOrderMap_ !mergeMap_ !paramMap_ !pragmas_ !quantMap_ !typeSyns_ !uniqueMap_ !useMap_ !wrappers_ ->
                     {-# LINE 319 "src-ag/Desugar.ag" #-}
                     Grammar typeSyns_
                             useMap_
                             derivings_
                             wrappers_
                             _nontsIoutput
                             pragmas_
                             manualAttrOrderMap_
                             paramMap_
                             contextMap_
                             quantMap_
                             uniqueMap_
                             _nontsIaugmentsOut
                             aroundsMap_
                             mergeMap_
                     {-# LINE 542 "src-generated/Desugar.hs" #-}
   {-# INLINE rule30 #-}
   rule30 = \ ((!_nontsIallAttributes) :: AttrMap) ->
     _nontsIallAttributes
   {-# INLINE rule31 #-}
   rule31 = \ ((!_nontsIerrors) :: Seq Error) ->
     _nontsIerrors
   {-# INLINE rule33 #-}
   rule33 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# INLINE rule34 #-}
   rule34 = \ ((!_lhsImainName) :: String) ->
     _lhsImainName
   {-# INLINE rule35 #-}
   rule35 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions

-- HsToken -----------------------------------------------------
-- wrapper
data Inh_HsToken  = Inh_HsToken { addLines_Inh_HsToken :: !(Int), childInhs_Inh_HsToken :: !([(Identifier, Identifier)]), childSyns_Inh_HsToken :: !([(Identifier, Identifier)]), con_Inh_HsToken :: !(ConstructorIdent), nt_Inh_HsToken :: !(NontermIdent), ruleDescr_Inh_HsToken :: !(String), useFieldIdent_Inh_HsToken :: !(Bool) }
data Syn_HsToken  = Syn_HsToken { addLines_Syn_HsToken :: !(Int), errors_Syn_HsToken :: !(Seq Error), tks_Syn_HsToken :: !(HsToken) }
{-# INLINABLE wrap_HsToken #-}
wrap_HsToken :: T_HsToken  -> Inh_HsToken  -> (Syn_HsToken )
wrap_HsToken !(T_HsToken act) !(Inh_HsToken _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg4 = T_HsToken_vIn4 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent
        !(T_HsToken_vOut4 _lhsOaddLines _lhsOerrors _lhsOtks) <- return (inv_HsToken_s8 sem K_HsToken_v4 arg4)
        return (Syn_HsToken _lhsOaddLines _lhsOerrors _lhsOtks)
   )

-- cata
{-# NOINLINE sem_HsToken #-}
sem_HsToken :: HsToken  -> T_HsToken 
sem_HsToken ( AGLocal !var_ !pos_ !rdesc_ ) = sem_HsToken_AGLocal var_ pos_ rdesc_
sem_HsToken ( AGField !field_ !attr_ !pos_ !rdesc_ ) = sem_HsToken_AGField field_ attr_ pos_ rdesc_
sem_HsToken ( HsToken !value_ !pos_ ) = sem_HsToken_HsToken value_ pos_
sem_HsToken ( CharToken !value_ !pos_ ) = sem_HsToken_CharToken value_ pos_
sem_HsToken ( StrToken !value_ !pos_ ) = sem_HsToken_StrToken value_ pos_
sem_HsToken ( Err !mesg_ !pos_ ) = sem_HsToken_Err mesg_ pos_

-- semantic domain
newtype T_HsToken  = T_HsToken {
                               attach_T_HsToken :: Identity (T_HsToken_s8 )
                               }
data T_HsToken_s8  where C_HsToken_s8 :: {
                                         inv_HsToken_s8 :: !(forall t. K_HsToken_s8  t -> t)
                                         } -> T_HsToken_s8 
data T_HsToken_s9  = C_HsToken_s9
data T_HsToken_s37  = C_HsToken_s37
newtype T_HsToken_s47  = C_HsToken_s47 {
                                       inv_HsToken_s47 :: (T_HsToken_v35 )
                                       }
data K_HsToken_s8 k  where
   K_HsToken_v4 :: K_HsToken_s8  (T_HsToken_v4 )
   K_HsToken_v21 :: K_HsToken_s8  (T_HsToken_v21 )
   K_HsToken_v34 :: K_HsToken_s8  (T_HsToken_v34 )
type T_HsToken_v4  = (T_HsToken_vIn4 ) -> (T_HsToken_vOut4 )
data T_HsToken_vIn4  = T_HsToken_vIn4 !(Int) !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(ConstructorIdent) !(NontermIdent) !(String) !(Bool)
data T_HsToken_vOut4  = T_HsToken_vOut4 !(Int) !(Seq Error) !(HsToken)
type T_HsToken_v21  = (T_HsToken_vIn21 ) -> (T_HsToken_vOut21 )
data T_HsToken_vIn21  = T_HsToken_vIn21 !(Int) !([(Identifier, Identifier)]) !(ConstructorIdent) !(NontermIdent) !(String) !(Bool)
data T_HsToken_vOut21  = T_HsToken_vOut21 !(Int) !(Seq Error) !(HsToken)
type T_HsToken_v34  = (T_HsToken_vIn34 ) -> (T_HsToken_vOut34 )
data T_HsToken_vIn34  = T_HsToken_vIn34 !([(Identifier, Identifier)]) !(ConstructorIdent) !(NontermIdent)
data T_HsToken_vOut34  = T_HsToken_vOut34 !(Seq Error) !(T_HsToken_s47 )
type T_HsToken_v35  = (T_HsToken_vIn35 ) -> (T_HsToken_vOut35 )
data T_HsToken_vIn35  = T_HsToken_vIn35 !(Int) !(String) !(Bool)
data T_HsToken_vOut35  = T_HsToken_vOut35 !(Int) !(HsToken)
{-# NOINLINE sem_HsToken_AGLocal #-}
sem_HsToken_AGLocal :: (Identifier) -> (Pos) -> (Maybe String) -> T_HsToken 
sem_HsToken_AGLocal !arg_var_ !arg_pos_ _ = T_HsToken (return st8) where
   {-# NOINLINE st8 #-}
   !st8 = let
      k8 :: K_HsToken_s8  t -> t
      k8 K_HsToken_v4 = v4
      k8 K_HsToken_v21 = v21
      k8 K_HsToken_v34 = v34
      v4 :: T_HsToken_v4 
      v4 = \ !(T_HsToken_vIn4 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule38  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule36 _lhsIaddLines _lhsIuseFieldIdent in
         let !_tks = rule37 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent arg_pos_ arg_var_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule39 _tks in
         let !__result_ = T_HsToken_vOut4 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v21 :: T_HsToken_v21 
      v21 = \ !(T_HsToken_vIn21 _lhsIaddLines _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule38  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule36 _lhsIaddLines _lhsIuseFieldIdent in
         let !_tks = rule37 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent arg_pos_ arg_var_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule39 _tks in
         let !__result_ = T_HsToken_vOut21 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v34 :: T_HsToken_v34 
      v34 = \ !(T_HsToken_vIn34 _lhsIchildSyns _lhsIcon _lhsInt) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule38  () in
         let !__st_ = st47  ()
             !__result_ = T_HsToken_vOut34 _lhsOerrors __st_
          in __result_ )
     in C_HsToken_s8 k8
   {-# NOINLINE st47 #-}
   st47 = \  (_ :: ()) -> let
      v35 :: T_HsToken_v35 
      v35 = \ !(T_HsToken_vIn35 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule36 _lhsIaddLines _lhsIuseFieldIdent in
         let !_tks = rule37 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent arg_pos_ arg_var_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule39 _tks in
         let !__result_ = T_HsToken_vOut35 _lhsOaddLines _lhsOtks
          in __result_ )
     in C_HsToken_s47 v35
   {-# NOINLINE[1] rule36 #-}
   {-# LINE 74 "src-ag/Desugar.ag" #-}
   rule36 = \ ((!_lhsIaddLines) :: Int) ((!_lhsIuseFieldIdent) :: Bool) ->
                       {-# LINE 74 "src-ag/Desugar.ag" #-}
                       if _lhsIuseFieldIdent
                       then _lhsIaddLines + 1
                       else _lhsIaddLines
                       {-# LINE 669 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule37 #-}
   {-# LINE 77 "src-ag/Desugar.ag" #-}
   rule37 = \ ((!_lhsIaddLines) :: Int) ((!_lhsIruleDescr) :: String) ((!_lhsIuseFieldIdent) :: Bool) !pos_ !var_ ->
                  {-# LINE 77 "src-ag/Desugar.ag" #-}
                  AGLocal var_ (addl _lhsIaddLines pos_) (if _lhsIuseFieldIdent then Just _lhsIruleDescr else Nothing)
                  {-# LINE 675 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule38 #-}
   rule38 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule39 #-}
   rule39 = \ !_tks ->
     _tks
{-# NOINLINE sem_HsToken_AGField #-}
sem_HsToken_AGField :: (Identifier) -> (Identifier) -> (Pos) -> (Maybe String) -> T_HsToken 
sem_HsToken_AGField !arg_field_ !arg_attr_ !arg_pos_ _ = T_HsToken (return st8) where
   {-# NOINLINE st8 #-}
   !st8 = let
      k8 :: K_HsToken_s8  t -> t
      k8 K_HsToken_v4 = v4
      k8 K_HsToken_v21 = v21
      k8 K_HsToken_v34 = v34
      v4 :: T_HsToken_v4 
      v4 = \ !(T_HsToken_vIn4 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let !_mField = rule40 _lhsIchildSyns arg_attr_ arg_field_ in
         let !_field' = rule41 _mField arg_field_ in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule43 _field' _lhsIaddLines _lhsIuseFieldIdent arg_field_ in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule42 _lhsIcon _lhsInt _mField arg_field_ in
         let !_tks = rule44 _field' _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent arg_attr_ arg_pos_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule45 _tks in
         let !__result_ = T_HsToken_vOut4 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v21 :: T_HsToken_v21 
      v21 = \ !(T_HsToken_vIn21 _lhsIaddLines _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let !_mField = rule40 _lhsIchildSyns arg_attr_ arg_field_ in
         let !_field' = rule41 _mField arg_field_ in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule43 _field' _lhsIaddLines _lhsIuseFieldIdent arg_field_ in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule42 _lhsIcon _lhsInt _mField arg_field_ in
         let !_tks = rule44 _field' _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent arg_attr_ arg_pos_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule45 _tks in
         let !__result_ = T_HsToken_vOut21 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v34 :: T_HsToken_v34 
      v34 = \ !(T_HsToken_vIn34 _lhsIchildSyns _lhsIcon _lhsInt) -> (
         let !_mField = rule40 _lhsIchildSyns arg_attr_ arg_field_ in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule42 _lhsIcon _lhsInt _mField arg_field_ in
         let !__st_ = st47 _mField
             !__result_ = T_HsToken_vOut34 _lhsOerrors __st_
          in __result_ )
     in C_HsToken_s8 k8
   {-# NOINLINE st47 #-}
   st47 = \ !_mField -> let
      v35 :: T_HsToken_v35 
      v35 = \ !(T_HsToken_vIn35 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let !_field' = rule41 _mField arg_field_ in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule43 _field' _lhsIaddLines _lhsIuseFieldIdent arg_field_ in
         let !_tks = rule44 _field' _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent arg_attr_ arg_pos_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule45 _tks in
         let !__result_ = T_HsToken_vOut35 _lhsOaddLines _lhsOtks
          in __result_ )
     in C_HsToken_s47 v35
   {-# NOINLINE[1] rule40 #-}
   {-# LINE 79 "src-ag/Desugar.ag" #-}
   rule40 = \ ((!_lhsIchildSyns) :: [(Identifier, Identifier)]) !attr_ !field_ ->
                     {-# LINE 79 "src-ag/Desugar.ag" #-}
                     findField field_ attr_ _lhsIchildSyns
                     {-# LINE 744 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule41 #-}
   {-# LINE 81 "src-ag/Desugar.ag" #-}
   rule41 = \ !_mField !field_ ->
                     {-# LINE 81 "src-ag/Desugar.ag" #-}
                     maybe field_ id _mField
                     {-# LINE 750 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule42 #-}
   {-# LINE 82 "src-ag/Desugar.ag" #-}
   rule42 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) !_mField !field_ ->
                     {-# LINE 82 "src-ag/Desugar.ag" #-}
                     maybe (Seq.singleton (UndefAttr _lhsInt _lhsIcon field_ (Ident "<ANY>" (getPos field_)) False)) (const Seq.empty) _mField
                     {-# LINE 756 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule43 #-}
   {-# LINE 84 "src-ag/Desugar.ag" #-}
   rule43 = \ !_field' ((!_lhsIaddLines) :: Int) ((!_lhsIuseFieldIdent) :: Bool) !field_ ->
                       {-# LINE 84 "src-ag/Desugar.ag" #-}
                       if _lhsIuseFieldIdent || length (getName field_) < length (getName _field'    )
                       then _lhsIaddLines + 1
                       else _lhsIaddLines
                       {-# LINE 764 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule44 #-}
   {-# LINE 88 "src-ag/Desugar.ag" #-}
   rule44 = \ !_field' ((!_lhsIaddLines) :: Int) ((!_lhsIruleDescr) :: String) ((!_lhsIuseFieldIdent) :: Bool) !attr_ !pos_ ->
                  {-# LINE 88 "src-ag/Desugar.ag" #-}
                  AGField _field'     attr_ (addl _lhsIaddLines pos_) (if _lhsIuseFieldIdent then Just _lhsIruleDescr else Nothing)
                  {-# LINE 770 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule45 #-}
   rule45 = \ !_tks ->
     _tks
{-# NOINLINE sem_HsToken_HsToken #-}
sem_HsToken_HsToken :: (String) -> (Pos) -> T_HsToken 
sem_HsToken_HsToken !arg_value_ !arg_pos_ = T_HsToken (return st8) where
   {-# NOINLINE st8 #-}
   !st8 = let
      k8 :: K_HsToken_s8  t -> t
      k8 K_HsToken_v4 = v4
      k8 K_HsToken_v21 = v21
      k8 K_HsToken_v34 = v34
      v4 :: T_HsToken_v4 
      v4 = \ !(T_HsToken_vIn4 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule47  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule49 _lhsIaddLines in
         let !_tks = rule46 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule48 _tks in
         let !__result_ = T_HsToken_vOut4 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v21 :: T_HsToken_v21 
      v21 = \ !(T_HsToken_vIn21 _lhsIaddLines _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule47  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule49 _lhsIaddLines in
         let !_tks = rule46 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule48 _tks in
         let !__result_ = T_HsToken_vOut21 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v34 :: T_HsToken_v34 
      v34 = \ !(T_HsToken_vIn34 _lhsIchildSyns _lhsIcon _lhsInt) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule47  () in
         let !__st_ = st47  ()
             !__result_ = T_HsToken_vOut34 _lhsOerrors __st_
          in __result_ )
     in C_HsToken_s8 k8
   {-# NOINLINE st47 #-}
   st47 = \  (_ :: ()) -> let
      v35 :: T_HsToken_v35 
      v35 = \ !(T_HsToken_vIn35 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule49 _lhsIaddLines in
         let !_tks = rule46 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule48 _tks in
         let !__result_ = T_HsToken_vOut35 _lhsOaddLines _lhsOtks
          in __result_ )
     in C_HsToken_s47 v35
   {-# NOINLINE[1] rule46 #-}
   {-# LINE 90 "src-ag/Desugar.ag" #-}
   rule46 = \ ((!_lhsIaddLines) :: Int) !pos_ !value_ ->
                  {-# LINE 90 "src-ag/Desugar.ag" #-}
                  HsToken value_ (addl _lhsIaddLines pos_)
                  {-# LINE 830 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule47 #-}
   rule47 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule48 #-}
   rule48 = \ !_tks ->
     _tks
   {-# NOINLINE[1] rule49 #-}
   rule49 = \ ((!_lhsIaddLines) :: Int) ->
     _lhsIaddLines
{-# NOINLINE sem_HsToken_CharToken #-}
sem_HsToken_CharToken :: (String) -> (Pos) -> T_HsToken 
sem_HsToken_CharToken !arg_value_ !arg_pos_ = T_HsToken (return st8) where
   {-# NOINLINE st8 #-}
   !st8 = let
      k8 :: K_HsToken_s8  t -> t
      k8 K_HsToken_v4 = v4
      k8 K_HsToken_v21 = v21
      k8 K_HsToken_v34 = v34
      v4 :: T_HsToken_v4 
      v4 = \ !(T_HsToken_vIn4 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule51  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule53 _lhsIaddLines in
         let !_tks = rule50 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule52 _tks in
         let !__result_ = T_HsToken_vOut4 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v21 :: T_HsToken_v21 
      v21 = \ !(T_HsToken_vIn21 _lhsIaddLines _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule51  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule53 _lhsIaddLines in
         let !_tks = rule50 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule52 _tks in
         let !__result_ = T_HsToken_vOut21 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v34 :: T_HsToken_v34 
      v34 = \ !(T_HsToken_vIn34 _lhsIchildSyns _lhsIcon _lhsInt) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule51  () in
         let !__st_ = st47  ()
             !__result_ = T_HsToken_vOut34 _lhsOerrors __st_
          in __result_ )
     in C_HsToken_s8 k8
   {-# NOINLINE st47 #-}
   st47 = \  (_ :: ()) -> let
      v35 :: T_HsToken_v35 
      v35 = \ !(T_HsToken_vIn35 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule53 _lhsIaddLines in
         let !_tks = rule50 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule52 _tks in
         let !__result_ = T_HsToken_vOut35 _lhsOaddLines _lhsOtks
          in __result_ )
     in C_HsToken_s47 v35
   {-# NOINLINE[1] rule50 #-}
   {-# LINE 92 "src-ag/Desugar.ag" #-}
   rule50 = \ ((!_lhsIaddLines) :: Int) !pos_ !value_ ->
                  {-# LINE 92 "src-ag/Desugar.ag" #-}
                  CharToken value_ (addl _lhsIaddLines pos_)
                  {-# LINE 896 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule51 #-}
   rule51 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule52 #-}
   rule52 = \ !_tks ->
     _tks
   {-# NOINLINE[1] rule53 #-}
   rule53 = \ ((!_lhsIaddLines) :: Int) ->
     _lhsIaddLines
{-# NOINLINE sem_HsToken_StrToken #-}
sem_HsToken_StrToken :: (String) -> (Pos) -> T_HsToken 
sem_HsToken_StrToken !arg_value_ !arg_pos_ = T_HsToken (return st8) where
   {-# NOINLINE st8 #-}
   !st8 = let
      k8 :: K_HsToken_s8  t -> t
      k8 K_HsToken_v4 = v4
      k8 K_HsToken_v21 = v21
      k8 K_HsToken_v34 = v34
      v4 :: T_HsToken_v4 
      v4 = \ !(T_HsToken_vIn4 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule55  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule57 _lhsIaddLines in
         let !_tks = rule54 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule56 _tks in
         let !__result_ = T_HsToken_vOut4 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v21 :: T_HsToken_v21 
      v21 = \ !(T_HsToken_vIn21 _lhsIaddLines _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule55  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule57 _lhsIaddLines in
         let !_tks = rule54 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule56 _tks in
         let !__result_ = T_HsToken_vOut21 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v34 :: T_HsToken_v34 
      v34 = \ !(T_HsToken_vIn34 _lhsIchildSyns _lhsIcon _lhsInt) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule55  () in
         let !__st_ = st47  ()
             !__result_ = T_HsToken_vOut34 _lhsOerrors __st_
          in __result_ )
     in C_HsToken_s8 k8
   {-# NOINLINE st47 #-}
   st47 = \  (_ :: ()) -> let
      v35 :: T_HsToken_v35 
      v35 = \ !(T_HsToken_vIn35 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule57 _lhsIaddLines in
         let !_tks = rule54 _lhsIaddLines arg_pos_ arg_value_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule56 _tks in
         let !__result_ = T_HsToken_vOut35 _lhsOaddLines _lhsOtks
          in __result_ )
     in C_HsToken_s47 v35
   {-# NOINLINE[1] rule54 #-}
   {-# LINE 94 "src-ag/Desugar.ag" #-}
   rule54 = \ ((!_lhsIaddLines) :: Int) !pos_ !value_ ->
                  {-# LINE 94 "src-ag/Desugar.ag" #-}
                  StrToken value_ (addl _lhsIaddLines pos_)
                  {-# LINE 962 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule55 #-}
   rule55 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule56 #-}
   rule56 = \ !_tks ->
     _tks
   {-# NOINLINE[1] rule57 #-}
   rule57 = \ ((!_lhsIaddLines) :: Int) ->
     _lhsIaddLines
{-# NOINLINE sem_HsToken_Err #-}
sem_HsToken_Err :: (String) -> (Pos) -> T_HsToken 
sem_HsToken_Err !arg_mesg_ !arg_pos_ = T_HsToken (return st8) where
   {-# NOINLINE st8 #-}
   !st8 = let
      k8 :: K_HsToken_s8  t -> t
      k8 K_HsToken_v4 = v4
      k8 K_HsToken_v21 = v21
      k8 K_HsToken_v34 = v34
      v4 :: T_HsToken_v4 
      v4 = \ !(T_HsToken_vIn4 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule59  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule61 _lhsIaddLines in
         let !_tks = rule58 _lhsIaddLines arg_mesg_ arg_pos_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule60 _tks in
         let !__result_ = T_HsToken_vOut4 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v21 :: T_HsToken_v21 
      v21 = \ !(T_HsToken_vIn21 _lhsIaddLines _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule59  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule61 _lhsIaddLines in
         let !_tks = rule58 _lhsIaddLines arg_mesg_ arg_pos_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule60 _tks in
         let !__result_ = T_HsToken_vOut21 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v34 :: T_HsToken_v34 
      v34 = \ !(T_HsToken_vIn34 _lhsIchildSyns _lhsIcon _lhsInt) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule59  () in
         let !__st_ = st47  ()
             !__result_ = T_HsToken_vOut34 _lhsOerrors __st_
          in __result_ )
     in C_HsToken_s8 k8
   {-# NOINLINE st47 #-}
   st47 = \  (_ :: ()) -> let
      v35 :: T_HsToken_v35 
      v35 = \ !(T_HsToken_vIn35 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule61 _lhsIaddLines in
         let !_tks = rule58 _lhsIaddLines arg_mesg_ arg_pos_ in
         let _lhsOtks :: HsToken
             !_lhsOtks = rule60 _tks in
         let !__result_ = T_HsToken_vOut35 _lhsOaddLines _lhsOtks
          in __result_ )
     in C_HsToken_s47 v35
   {-# NOINLINE[1] rule58 #-}
   {-# LINE 96 "src-ag/Desugar.ag" #-}
   rule58 = \ ((!_lhsIaddLines) :: Int) !mesg_ !pos_ ->
                  {-# LINE 96 "src-ag/Desugar.ag" #-}
                  Err mesg_ (addl _lhsIaddLines pos_)
                  {-# LINE 1028 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule59 #-}
   rule59 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule60 #-}
   rule60 = \ !_tks ->
     _tks
   {-# NOINLINE[1] rule61 #-}
   rule61 = \ ((!_lhsIaddLines) :: Int) ->
     _lhsIaddLines

-- HsTokens ----------------------------------------------------
-- wrapper
data Inh_HsTokens  = Inh_HsTokens { addLines_Inh_HsTokens :: !(Int), childInhs_Inh_HsTokens :: !([(Identifier, Identifier)]), childSyns_Inh_HsTokens :: !([(Identifier, Identifier)]), con_Inh_HsTokens :: !(ConstructorIdent), nt_Inh_HsTokens :: !(NontermIdent), ruleDescr_Inh_HsTokens :: !(String), useFieldIdent_Inh_HsTokens :: !(Bool) }
data Syn_HsTokens  = Syn_HsTokens { addLines_Syn_HsTokens :: !(Int), errors_Syn_HsTokens :: !(Seq Error), tks_Syn_HsTokens :: !(HsTokens) }
{-# INLINABLE wrap_HsTokens #-}
wrap_HsTokens :: T_HsTokens  -> Inh_HsTokens  -> (Syn_HsTokens )
wrap_HsTokens !(T_HsTokens act) !(Inh_HsTokens _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg5 = T_HsTokens_vIn5 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent
        !(T_HsTokens_vOut5 _lhsOaddLines _lhsOerrors _lhsOtks) <- return (inv_HsTokens_s10 sem K_HsTokens_v5 arg5)
        return (Syn_HsTokens _lhsOaddLines _lhsOerrors _lhsOtks)
   )

-- cata
{-# NOINLINE sem_HsTokens #-}
sem_HsTokens :: HsTokens  -> T_HsTokens 
sem_HsTokens list = Prelude.foldr sem_HsTokens_Cons sem_HsTokens_Nil (Prelude.map sem_HsToken list)

-- semantic domain
newtype T_HsTokens  = T_HsTokens {
                                 attach_T_HsTokens :: Identity (T_HsTokens_s10 )
                                 }
data T_HsTokens_s10  where C_HsTokens_s10 :: {
                                             inv_HsTokens_s10 :: !(forall t. K_HsTokens_s10  t -> t)
                                             } -> T_HsTokens_s10 
data T_HsTokens_s11  = C_HsTokens_s11
newtype T_HsTokens_s38  = C_HsTokens_s38 {
                                         inv_HsTokens_s38 :: (T_HsTokens_v23 )
                                         }
data T_HsTokens_s39  = C_HsTokens_s39
data K_HsTokens_s10 k  where
   K_HsTokens_v5 :: K_HsTokens_s10  (T_HsTokens_v5 )
   K_HsTokens_v22 :: K_HsTokens_s10  (T_HsTokens_v22 )
   K_HsTokens_v24 :: K_HsTokens_s10  (T_HsTokens_v24 )
type T_HsTokens_v5  = (T_HsTokens_vIn5 ) -> (T_HsTokens_vOut5 )
data T_HsTokens_vIn5  = T_HsTokens_vIn5 !(Int) !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(ConstructorIdent) !(NontermIdent) !(String) !(Bool)
data T_HsTokens_vOut5  = T_HsTokens_vOut5 !(Int) !(Seq Error) !(HsTokens)
type T_HsTokens_v22  = (T_HsTokens_vIn22 ) -> (T_HsTokens_vOut22 )
data T_HsTokens_vIn22  = T_HsTokens_vIn22 !([(Identifier, Identifier)]) !(ConstructorIdent) !(NontermIdent)
data T_HsTokens_vOut22  = T_HsTokens_vOut22 !(Seq Error) !(T_HsTokens_s38 )
type T_HsTokens_v23  = (T_HsTokens_vIn23 ) -> (T_HsTokens_vOut23 )
data T_HsTokens_vIn23  = T_HsTokens_vIn23 !(Int) !(String) !(Bool)
data T_HsTokens_vOut23  = T_HsTokens_vOut23 !(Int) !(HsTokens)
type T_HsTokens_v24  = (T_HsTokens_vIn24 ) -> (T_HsTokens_vOut24 )
data T_HsTokens_vIn24  = T_HsTokens_vIn24 !(Int) !([(Identifier, Identifier)]) !(ConstructorIdent) !(NontermIdent) !(String) !(Bool)
data T_HsTokens_vOut24  = T_HsTokens_vOut24 !(Int) !(Seq Error) !(HsTokens)
{-# NOINLINE sem_HsTokens_Cons #-}
sem_HsTokens_Cons :: T_HsToken  -> T_HsTokens  -> T_HsTokens 
sem_HsTokens_Cons arg_hd_ arg_tl_ = T_HsTokens (return st10) where
   {-# NOINLINE st10 #-}
   !st10 = let
      k10 :: K_HsTokens_s10  t -> t
      k10 K_HsTokens_v5 = v5
      k10 K_HsTokens_v22 = v22
      k10 K_HsTokens_v24 = v24
      v5 :: T_HsTokens_v5 
      v5 = \ !(T_HsTokens_vIn5 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let !_hdX8 = Control.Monad.Identity.runIdentity (attach_T_HsToken (arg_hd_)) in
         let !_tlX10 = Control.Monad.Identity.runIdentity (attach_T_HsTokens (arg_tl_)) in
         let !_hdOaddLines = rule66 _lhsIaddLines in
         let !_hdOchildSyns = rule68 _lhsIchildSyns in
         let !_hdOuseFieldIdent = rule72 _lhsIuseFieldIdent in
         let !_tlOchildSyns = rule75 _lhsIchildSyns in
         let !_tlOuseFieldIdent = rule79 _lhsIuseFieldIdent in
         let !_hdOcon = rule69 _lhsIcon in
         let !_hdOnt = rule70 _lhsInt in
         let !_tlOcon = rule76 _lhsIcon in
         let !_tlOnt = rule77 _lhsInt in
         let !_hdOruleDescr = rule71 _lhsIruleDescr in
         let !_tlOruleDescr = rule78 _lhsIruleDescr in
         let !(T_HsToken_vOut21 _hdIaddLines _hdIerrors _hdItks) = inv_HsToken_s8 _hdX8 K_HsToken_v21 (T_HsToken_vIn21 _hdOaddLines _hdOchildSyns _hdOcon _hdOnt _hdOruleDescr _hdOuseFieldIdent) in
         let !(T_HsTokens_vOut22 _tlIerrors _tlX38) = inv_HsTokens_s10 _tlX10 K_HsTokens_v22 (T_HsTokens_vIn22 _tlOchildSyns _tlOcon _tlOnt) in
         let !_tlOaddLines = rule73 _hdIaddLines in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule62 _hdIerrors _tlIerrors in
         let !(T_HsTokens_vOut23 _tlIaddLines _tlItks) = inv_HsTokens_s38 _tlX38 (T_HsTokens_vIn23 _tlOaddLines _tlOruleDescr _tlOuseFieldIdent) in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule65 _tlIaddLines in
         let !_tks = rule63 _hdItks _tlItks in
         let _lhsOtks :: HsTokens
             !_lhsOtks = rule64 _tks in
         let !__result_ = T_HsTokens_vOut5 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v22 :: T_HsTokens_v22 
      v22 = \ !(T_HsTokens_vIn22 _lhsIchildSyns _lhsIcon _lhsInt) -> (
         let !_hdX8 = Control.Monad.Identity.runIdentity (attach_T_HsToken (arg_hd_)) in
         let !_tlX10 = Control.Monad.Identity.runIdentity (attach_T_HsTokens (arg_tl_)) in
         let !_hdOchildSyns = rule68 _lhsIchildSyns in
         let !_hdOcon = rule69 _lhsIcon in
         let !_hdOnt = rule70 _lhsInt in
         let !_tlOchildSyns = rule75 _lhsIchildSyns in
         let !_tlOcon = rule76 _lhsIcon in
         let !_tlOnt = rule77 _lhsInt in
         let !(T_HsToken_vOut34 _hdIerrors _hdX47) = inv_HsToken_s8 _hdX8 K_HsToken_v34 (T_HsToken_vIn34 _hdOchildSyns _hdOcon _hdOnt) in
         let !(T_HsTokens_vOut22 _tlIerrors _tlX38) = inv_HsTokens_s10 _tlX10 K_HsTokens_v22 (T_HsTokens_vIn22 _tlOchildSyns _tlOcon _tlOnt) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule62 _hdIerrors _tlIerrors in
         let !__st_ = st38 _hdX47 _tlX38
             !__result_ = T_HsTokens_vOut22 _lhsOerrors __st_
          in __result_ )
      v24 :: T_HsTokens_v24 
      v24 = \ !(T_HsTokens_vIn24 _lhsIaddLines _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let !_hdX8 = Control.Monad.Identity.runIdentity (attach_T_HsToken (arg_hd_)) in
         let !_tlX10 = Control.Monad.Identity.runIdentity (attach_T_HsTokens (arg_tl_)) in
         let !_hdOaddLines = rule66 _lhsIaddLines in
         let !_hdOchildSyns = rule68 _lhsIchildSyns in
         let !_hdOuseFieldIdent = rule72 _lhsIuseFieldIdent in
         let !_tlOchildSyns = rule75 _lhsIchildSyns in
         let !_tlOuseFieldIdent = rule79 _lhsIuseFieldIdent in
         let !_hdOcon = rule69 _lhsIcon in
         let !_hdOnt = rule70 _lhsInt in
         let !_tlOcon = rule76 _lhsIcon in
         let !_tlOnt = rule77 _lhsInt in
         let !_hdOruleDescr = rule71 _lhsIruleDescr in
         let !_tlOruleDescr = rule78 _lhsIruleDescr in
         let !(T_HsToken_vOut21 _hdIaddLines _hdIerrors _hdItks) = inv_HsToken_s8 _hdX8 K_HsToken_v21 (T_HsToken_vIn21 _hdOaddLines _hdOchildSyns _hdOcon _hdOnt _hdOruleDescr _hdOuseFieldIdent) in
         let !(T_HsTokens_vOut22 _tlIerrors _tlX38) = inv_HsTokens_s10 _tlX10 K_HsTokens_v22 (T_HsTokens_vIn22 _tlOchildSyns _tlOcon _tlOnt) in
         let !_tlOaddLines = rule73 _hdIaddLines in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule62 _hdIerrors _tlIerrors in
         let !(T_HsTokens_vOut23 _tlIaddLines _tlItks) = inv_HsTokens_s38 _tlX38 (T_HsTokens_vIn23 _tlOaddLines _tlOruleDescr _tlOuseFieldIdent) in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule65 _tlIaddLines in
         let !_tks = rule63 _hdItks _tlItks in
         let _lhsOtks :: HsTokens
             !_lhsOtks = rule64 _tks in
         let !__result_ = T_HsTokens_vOut24 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
     in C_HsTokens_s10 k10
   {-# NOINLINE st38 #-}
   st38 = \ !_hdX47 !_tlX38 -> let
      v23 :: T_HsTokens_v23 
      v23 = \ !(T_HsTokens_vIn23 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let !_hdOaddLines = rule66 _lhsIaddLines in
         let !_hdOuseFieldIdent = rule72 _lhsIuseFieldIdent in
         let !_tlOuseFieldIdent = rule79 _lhsIuseFieldIdent in
         let !_hdOruleDescr = rule71 _lhsIruleDescr in
         let !_tlOruleDescr = rule78 _lhsIruleDescr in
         let !(T_HsToken_vOut35 _hdIaddLines _hdItks) = inv_HsToken_s47 _hdX47 (T_HsToken_vIn35 _hdOaddLines _hdOruleDescr _hdOuseFieldIdent) in
         let !_tlOaddLines = rule73 _hdIaddLines in
         let !(T_HsTokens_vOut23 _tlIaddLines _tlItks) = inv_HsTokens_s38 _tlX38 (T_HsTokens_vIn23 _tlOaddLines _tlOruleDescr _tlOuseFieldIdent) in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule65 _tlIaddLines in
         let !_tks = rule63 _hdItks _tlItks in
         let _lhsOtks :: HsTokens
             !_lhsOtks = rule64 _tks in
         let !__result_ = T_HsTokens_vOut23 _lhsOaddLines _lhsOtks
          in __result_ )
     in C_HsTokens_s38 v23
   {-# NOINLINE[1] rule62 #-}
   rule62 = \ ((!_hdIerrors) :: Seq Error) ((!_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# NOINLINE[1] rule63 #-}
   rule63 = \ ((!_hdItks) :: HsToken) ((!_tlItks) :: HsTokens) ->
     (:) _hdItks _tlItks
   {-# NOINLINE[1] rule64 #-}
   rule64 = \ !_tks ->
     _tks
   {-# NOINLINE[1] rule65 #-}
   rule65 = \ ((!_tlIaddLines) :: Int) ->
     _tlIaddLines
   {-# NOINLINE[1] rule66 #-}
   rule66 = \ ((!_lhsIaddLines) :: Int) ->
     _lhsIaddLines
   {-# NOINLINE[1] rule68 #-}
   rule68 = \ ((!_lhsIchildSyns) :: [(Identifier, Identifier)]) ->
     _lhsIchildSyns
   {-# NOINLINE[1] rule69 #-}
   rule69 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule70 #-}
   rule70 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule71 #-}
   rule71 = \ ((!_lhsIruleDescr) :: String) ->
     _lhsIruleDescr
   {-# NOINLINE[1] rule72 #-}
   rule72 = \ ((!_lhsIuseFieldIdent) :: Bool) ->
     _lhsIuseFieldIdent
   {-# NOINLINE[1] rule73 #-}
   rule73 = \ ((!_hdIaddLines) :: Int) ->
     _hdIaddLines
   {-# NOINLINE[1] rule75 #-}
   rule75 = \ ((!_lhsIchildSyns) :: [(Identifier, Identifier)]) ->
     _lhsIchildSyns
   {-# NOINLINE[1] rule76 #-}
   rule76 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule77 #-}
   rule77 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule78 #-}
   rule78 = \ ((!_lhsIruleDescr) :: String) ->
     _lhsIruleDescr
   {-# NOINLINE[1] rule79 #-}
   rule79 = \ ((!_lhsIuseFieldIdent) :: Bool) ->
     _lhsIuseFieldIdent
{-# NOINLINE sem_HsTokens_Nil #-}
sem_HsTokens_Nil ::  T_HsTokens 
sem_HsTokens_Nil  = T_HsTokens (return st10) where
   {-# NOINLINE st10 #-}
   !st10 = let
      k10 :: K_HsTokens_s10  t -> t
      k10 K_HsTokens_v5 = v5
      k10 K_HsTokens_v22 = v22
      k10 K_HsTokens_v24 = v24
      v5 :: T_HsTokens_v5 
      v5 = \ !(T_HsTokens_vIn5 _lhsIaddLines _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule80  () in
         let !_tks = rule81  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule83 _lhsIaddLines in
         let _lhsOtks :: HsTokens
             !_lhsOtks = rule82 _tks in
         let !__result_ = T_HsTokens_vOut5 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
      v22 :: T_HsTokens_v22 
      v22 = \ !(T_HsTokens_vIn22 _lhsIchildSyns _lhsIcon _lhsInt) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule80  () in
         let !__st_ = st38  ()
             !__result_ = T_HsTokens_vOut22 _lhsOerrors __st_
          in __result_ )
      v24 :: T_HsTokens_v24 
      v24 = \ !(T_HsTokens_vIn24 _lhsIaddLines _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule80  () in
         let !_tks = rule81  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule83 _lhsIaddLines in
         let _lhsOtks :: HsTokens
             !_lhsOtks = rule82 _tks in
         let !__result_ = T_HsTokens_vOut24 _lhsOaddLines _lhsOerrors _lhsOtks
          in __result_ )
     in C_HsTokens_s10 k10
   {-# NOINLINE st38 #-}
   st38 = \  (_ :: ()) -> let
      v23 :: T_HsTokens_v23 
      v23 = \ !(T_HsTokens_vIn23 _lhsIaddLines _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let !_tks = rule81  () in
         let _lhsOaddLines :: Int
             !_lhsOaddLines = rule83 _lhsIaddLines in
         let _lhsOtks :: HsTokens
             !_lhsOtks = rule82 _tks in
         let !__result_ = T_HsTokens_vOut23 _lhsOaddLines _lhsOtks
          in __result_ )
     in C_HsTokens_s38 v23
   {-# NOINLINE[1] rule80 #-}
   rule80 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule81 #-}
   rule81 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule82 #-}
   rule82 = \ !_tks ->
     _tks
   {-# NOINLINE[1] rule83 #-}
   rule83 = \ ((!_lhsIaddLines) :: Int) ->
     _lhsIaddLines

-- HsTokensRoot ------------------------------------------------
-- wrapper
data Inh_HsTokensRoot  = Inh_HsTokensRoot { childInhs_Inh_HsTokensRoot :: !([(Identifier, Identifier)]), childSyns_Inh_HsTokensRoot :: !([(Identifier, Identifier)]), con_Inh_HsTokensRoot :: !(ConstructorIdent), nt_Inh_HsTokensRoot :: !(NontermIdent), ruleDescr_Inh_HsTokensRoot :: !(String), useFieldIdent_Inh_HsTokensRoot :: !(Bool) }
data Syn_HsTokensRoot  = Syn_HsTokensRoot { errors_Syn_HsTokensRoot :: !(Seq Error), tks_Syn_HsTokensRoot :: !([HsToken]) }
{-# INLINABLE wrap_HsTokensRoot #-}
wrap_HsTokensRoot :: T_HsTokensRoot  -> Inh_HsTokensRoot  -> (Syn_HsTokensRoot )
wrap_HsTokensRoot !(T_HsTokensRoot act) !(Inh_HsTokensRoot _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg6 = T_HsTokensRoot_vIn6 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent
        !(T_HsTokensRoot_vOut6 _lhsOerrors _lhsOtks) <- return (inv_HsTokensRoot_s12 sem arg6)
        return (Syn_HsTokensRoot _lhsOerrors _lhsOtks)
   )

-- cata
{-# INLINE sem_HsTokensRoot #-}
sem_HsTokensRoot :: HsTokensRoot  -> T_HsTokensRoot 
sem_HsTokensRoot ( HsTokensRoot tokens_ ) = sem_HsTokensRoot_HsTokensRoot ( sem_HsTokens tokens_ )

-- semantic domain
newtype T_HsTokensRoot  = T_HsTokensRoot {
                                         attach_T_HsTokensRoot :: Identity (T_HsTokensRoot_s12 )
                                         }
newtype T_HsTokensRoot_s12  = C_HsTokensRoot_s12 {
                                                 inv_HsTokensRoot_s12 :: (T_HsTokensRoot_v6 )
                                                 }
data T_HsTokensRoot_s13  = C_HsTokensRoot_s13
type T_HsTokensRoot_v6  = (T_HsTokensRoot_vIn6 ) -> (T_HsTokensRoot_vOut6 )
data T_HsTokensRoot_vIn6  = T_HsTokensRoot_vIn6 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(ConstructorIdent) !(NontermIdent) !(String) !(Bool)
data T_HsTokensRoot_vOut6  = T_HsTokensRoot_vOut6 !(Seq Error) !([HsToken])
{-# NOINLINE sem_HsTokensRoot_HsTokensRoot #-}
sem_HsTokensRoot_HsTokensRoot :: T_HsTokens  -> T_HsTokensRoot 
sem_HsTokensRoot_HsTokensRoot arg_tokens_ = T_HsTokensRoot (return st12) where
   {-# NOINLINE st12 #-}
   !st12 = let
      v6 :: T_HsTokensRoot_v6 
      v6 = \ !(T_HsTokensRoot_vIn6 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsInt _lhsIruleDescr _lhsIuseFieldIdent) -> (
         let !_tokensX10 = Control.Monad.Identity.runIdentity (attach_T_HsTokens (arg_tokens_)) in
         let !_tokensOaddLines = rule84  () in
         let !_tokensOchildSyns = rule88 _lhsIchildSyns in
         let !_tokensOcon = rule89 _lhsIcon in
         let !_tokensOnt = rule90 _lhsInt in
         let !_tokensOruleDescr = rule91 _lhsIruleDescr in
         let !_tokensOuseFieldIdent = rule92 _lhsIuseFieldIdent in
         let !(T_HsTokens_vOut24 _tokensIaddLines _tokensIerrors _tokensItks) = inv_HsTokens_s10 _tokensX10 K_HsTokens_v24 (T_HsTokens_vIn24 _tokensOaddLines _tokensOchildSyns _tokensOcon _tokensOnt _tokensOruleDescr _tokensOuseFieldIdent) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule85 _tokensIerrors in
         let _lhsOtks :: [HsToken]
             !_lhsOtks = rule86 _tokensItks in
         let !__result_ = T_HsTokensRoot_vOut6 _lhsOerrors _lhsOtks
          in __result_ )
     in C_HsTokensRoot_s12 v6
   {-# INLINE rule84 #-}
   {-# LINE 67 "src-ag/Desugar.ag" #-}
   rule84 = \  (_ :: ()) ->
                          {-# LINE 67 "src-ag/Desugar.ag" #-}
                          0
                          {-# LINE 1358 "src-generated/Desugar.hs" #-}
   {-# INLINE rule85 #-}
   rule85 = \ ((!_tokensIerrors) :: Seq Error) ->
     _tokensIerrors
   {-# INLINE rule86 #-}
   rule86 = \ ((!_tokensItks) :: HsTokens) ->
     _tokensItks
   {-# INLINE rule88 #-}
   rule88 = \ ((!_lhsIchildSyns) :: [(Identifier, Identifier)]) ->
     _lhsIchildSyns
   {-# INLINE rule89 #-}
   rule89 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# INLINE rule90 #-}
   rule90 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# INLINE rule91 #-}
   rule91 = \ ((!_lhsIruleDescr) :: String) ->
     _lhsIruleDescr
   {-# INLINE rule92 #-}
   rule92 = \ ((!_lhsIuseFieldIdent) :: Bool) ->
     _lhsIuseFieldIdent

-- Nonterminal -------------------------------------------------
-- wrapper
data Inh_Nonterminal  = Inh_Nonterminal { augmentsIn_Inh_Nonterminal :: !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))), forcedIrrefutables_Inh_Nonterminal :: !(AttrMap), inhMap_Inh_Nonterminal :: !(Map Identifier Attributes), mainName_Inh_Nonterminal :: !(String), options_Inh_Nonterminal :: !(Options), synMap_Inh_Nonterminal :: !(Map Identifier Attributes) }
data Syn_Nonterminal  = Syn_Nonterminal { allAttributes_Syn_Nonterminal :: !(AttrMap), augmentsOut_Syn_Nonterminal :: !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))), errors_Syn_Nonterminal :: !(Seq Error), inhMap'_Syn_Nonterminal :: !(Map Identifier Attributes), output_Syn_Nonterminal :: !(Nonterminal), synMap'_Syn_Nonterminal :: !(Map Identifier Attributes) }
{-# INLINABLE wrap_Nonterminal #-}
wrap_Nonterminal :: T_Nonterminal  -> Inh_Nonterminal  -> (Syn_Nonterminal )
wrap_Nonterminal !(T_Nonterminal act) !(Inh_Nonterminal _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg7 = T_Nonterminal_vIn7 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap
        !(T_Nonterminal_vOut7 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOinhMap' _lhsOoutput _lhsOsynMap') <- return (inv_Nonterminal_s14 sem K_Nonterminal_v7 arg7)
        return (Syn_Nonterminal _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOinhMap' _lhsOoutput _lhsOsynMap')
   )

-- cata
{-# INLINE sem_Nonterminal #-}
sem_Nonterminal :: Nonterminal  -> T_Nonterminal 
sem_Nonterminal ( Nonterminal !nt_ !params_ !inh_ !syn_ prods_ ) = sem_Nonterminal_Nonterminal nt_ params_ inh_ syn_ ( sem_Productions prods_ )

-- semantic domain
newtype T_Nonterminal  = T_Nonterminal {
                                       attach_T_Nonterminal :: Identity (T_Nonterminal_s14 )
                                       }
data T_Nonterminal_s14  where C_Nonterminal_s14 :: {
                                                   inv_Nonterminal_s14 :: !(forall t. K_Nonterminal_s14  t -> t)
                                                   } -> T_Nonterminal_s14 
data T_Nonterminal_s15  = C_Nonterminal_s15
newtype T_Nonterminal_s46  = C_Nonterminal_s46 {
                                               inv_Nonterminal_s46 :: (T_Nonterminal_v33 )
                                               }
data K_Nonterminal_s14 k  where
   K_Nonterminal_v7 :: K_Nonterminal_s14  (T_Nonterminal_v7 )
   K_Nonterminal_v32 :: K_Nonterminal_s14  (T_Nonterminal_v32 )
type T_Nonterminal_v7  = (T_Nonterminal_vIn7 ) -> (T_Nonterminal_vOut7 )
data T_Nonterminal_vIn7  = T_Nonterminal_vIn7 !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !(AttrMap) !(Map Identifier Attributes) !(String) !(Options) !(Map Identifier Attributes)
data T_Nonterminal_vOut7  = T_Nonterminal_vOut7 !(AttrMap) !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !(Seq Error) !(Map Identifier Attributes) !(Nonterminal) !(Map Identifier Attributes)
type T_Nonterminal_v32  = (T_Nonterminal_vIn32 ) -> (T_Nonterminal_vOut32 )
data T_Nonterminal_vIn32  = T_Nonterminal_vIn32 
data T_Nonterminal_vOut32  = T_Nonterminal_vOut32 !(AttrMap) !(Map Identifier Attributes) !(Map Identifier Attributes) !(T_Nonterminal_s46 )
type T_Nonterminal_v33  = (T_Nonterminal_vIn33 ) -> (T_Nonterminal_vOut33 )
data T_Nonterminal_vIn33  = T_Nonterminal_vIn33 !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !(AttrMap) !(Map Identifier Attributes) !(String) !(Options) !(Map Identifier Attributes)
data T_Nonterminal_vOut33  = T_Nonterminal_vOut33 !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !(Seq Error) !(Nonterminal)
{-# NOINLINE sem_Nonterminal_Nonterminal #-}
sem_Nonterminal_Nonterminal :: (NontermIdent) -> ([Identifier]) -> (Attributes) -> (Attributes) -> T_Productions  -> T_Nonterminal 
sem_Nonterminal_Nonterminal !arg_nt_ !arg_params_ !arg_inh_ !arg_syn_ arg_prods_ = T_Nonterminal (return st14) where
   {-# NOINLINE st14 #-}
   !st14 = let
      k14 :: K_Nonterminal_s14  t -> t
      k14 K_Nonterminal_v7 = v7
      k14 K_Nonterminal_v32 = v32
      v7 :: T_Nonterminal_v7 
      v7 = \ !(T_Nonterminal_vIn7 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let !_prodsX24 = Control.Monad.Identity.runIdentity (attach_T_Productions (arg_prods_)) in
         let !_prodsOnt = rule95 arg_nt_ in
         let !_augmentsIn = rule96 _lhsIaugmentsIn arg_nt_ in
         let !_prodsOaugmentsIn = rule104 _augmentsIn in
         let !_prodsOinhMap = rule106 _lhsIinhMap in
         let !_prodsOoptions = rule108 _lhsIoptions in
         let !_prodsOsynMap = rule109 _lhsIsynMap in
         let _lhsOinhMap' :: Map Identifier Attributes
             !_lhsOinhMap' = rule93 arg_inh_ arg_nt_ in
         let !_prodsOforcedIrrefutables = rule105 _lhsIforcedIrrefutables in
         let !_extraInh = rule98 _lhsImainName _lhsIoptions in
         let _lhsOsynMap' :: Map Identifier Attributes
             !_lhsOsynMap' = rule94 arg_nt_ arg_syn_ in
         let !(T_Productions_vOut25 _prodsIallAttributes _prodsIaugmentsOut _prodsIerrors _prodsIoutput) = inv_Productions_s24 _prodsX24 K_Productions_v25 (T_Productions_vIn25 _prodsOaugmentsIn _prodsOforcedIrrefutables _prodsOinhMap _prodsOnt _prodsOoptions _prodsOsynMap) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule100 _prodsIallAttributes in
         let !_augmentsOut = rule97 _prodsIaugmentsOut arg_nt_ in
         let _lhsOaugmentsOut :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))
             !_lhsOaugmentsOut = rule101 _augmentsOut in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule102 _prodsIerrors in
         let _lhsOoutput :: Nonterminal
             !_lhsOoutput = rule99 _extraInh _prodsIoutput arg_inh_ arg_nt_ arg_params_ arg_syn_ in
         let !__result_ = T_Nonterminal_vOut7 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOinhMap' _lhsOoutput _lhsOsynMap'
          in __result_ )
      v32 :: T_Nonterminal_v32 
      v32 = \ !(T_Nonterminal_vIn32 ) -> (
         let !_prodsX24 = Control.Monad.Identity.runIdentity (attach_T_Productions (arg_prods_)) in
         let !_prodsOnt = rule95 arg_nt_ in
         let _lhsOinhMap' :: Map Identifier Attributes
             !_lhsOinhMap' = rule93 arg_inh_ arg_nt_ in
         let _lhsOsynMap' :: Map Identifier Attributes
             !_lhsOsynMap' = rule94 arg_nt_ arg_syn_ in
         let !(T_Productions_vOut39 _prodsIallAttributes _prodsX50) = inv_Productions_s24 _prodsX24 K_Productions_v39 (T_Productions_vIn39 _prodsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule100 _prodsIallAttributes in
         let !__st_ = st46 _prodsX50
             !__result_ = T_Nonterminal_vOut32 _lhsOallAttributes _lhsOinhMap' _lhsOsynMap' __st_
          in __result_ )
     in C_Nonterminal_s14 k14
   {-# NOINLINE st46 #-}
   st46 = \ !_prodsX50 -> let
      v33 :: T_Nonterminal_v33 
      v33 = \ !(T_Nonterminal_vIn33 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let !_augmentsIn = rule96 _lhsIaugmentsIn arg_nt_ in
         let !_prodsOaugmentsIn = rule104 _augmentsIn in
         let !_prodsOinhMap = rule106 _lhsIinhMap in
         let !_prodsOoptions = rule108 _lhsIoptions in
         let !_prodsOsynMap = rule109 _lhsIsynMap in
         let !_prodsOforcedIrrefutables = rule105 _lhsIforcedIrrefutables in
         let !_extraInh = rule98 _lhsImainName _lhsIoptions in
         let !(T_Productions_vOut40 _prodsIaugmentsOut _prodsIerrors _prodsIoutput) = inv_Productions_s50 _prodsX50 (T_Productions_vIn40 _prodsOaugmentsIn _prodsOforcedIrrefutables _prodsOinhMap _prodsOoptions _prodsOsynMap) in
         let !_augmentsOut = rule97 _prodsIaugmentsOut arg_nt_ in
         let _lhsOaugmentsOut :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))
             !_lhsOaugmentsOut = rule101 _augmentsOut in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule102 _prodsIerrors in
         let _lhsOoutput :: Nonterminal
             !_lhsOoutput = rule99 _extraInh _prodsIoutput arg_inh_ arg_nt_ arg_params_ arg_syn_ in
         let !__result_ = T_Nonterminal_vOut33 _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Nonterminal_s46 v33
   {-# NOINLINE[1] rule93 #-}
   {-# LINE 7 "src-ag/DistChildAttr.ag" #-}
   rule93 = \ !inh_ !nt_ ->
                                 {-# LINE 7 "src-ag/DistChildAttr.ag" #-}
                                 Map.singleton nt_ inh_
                                 {-# LINE 1500 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule94 #-}
   {-# LINE 8 "src-ag/DistChildAttr.ag" #-}
   rule94 = \ !nt_ !syn_ ->
                                 {-# LINE 8 "src-ag/DistChildAttr.ag" #-}
                                 Map.singleton nt_ syn_
                                 {-# LINE 1506 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule95 #-}
   {-# LINE 157 "src-ag/Desugar.ag" #-}
   rule95 = \ !nt_ ->
                   {-# LINE 157 "src-ag/Desugar.ag" #-}
                   nt_
                   {-# LINE 1512 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule96 #-}
   {-# LINE 239 "src-ag/Desugar.ag" #-}
   rule96 = \ ((!_lhsIaugmentsIn) :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !nt_ ->
                         {-# LINE 239 "src-ag/Desugar.ag" #-}
                         Map.findWithDefault Map.empty nt_ _lhsIaugmentsIn
                         {-# LINE 1518 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule97 #-}
   {-# LINE 240 "src-ag/Desugar.ag" #-}
   rule97 = \ ((!_prodsIaugmentsOut) :: Map ConstructorIdent (Map Identifier [Expression])) !nt_ ->
                          {-# LINE 240 "src-ag/Desugar.ag" #-}
                          Map.singleton nt_ _prodsIaugmentsOut
                          {-# LINE 1524 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule98 #-}
   {-# LINE 292 "src-ag/Desugar.ag" #-}
   rule98 = \ ((!_lhsImainName) :: String) ((!_lhsIoptions) :: Options) ->
                   {-# LINE 292 "src-ag/Desugar.ag" #-}
                   addLateAttr _lhsIoptions _lhsImainName
                   {-# LINE 1530 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule99 #-}
   {-# LINE 308 "src-ag/Desugar.ag" #-}
   rule99 = \ !_extraInh ((!_prodsIoutput) :: Productions) !inh_ !nt_ !params_ !syn_ ->
                 {-# LINE 308 "src-ag/Desugar.ag" #-}
                 Nonterminal
                   nt_ params_
                   (_extraInh     `Map.union` inh_)
                   syn_
                   _prodsIoutput
                 {-# LINE 1540 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule100 #-}
   rule100 = \ ((!_prodsIallAttributes) :: AttrMap) ->
     _prodsIallAttributes
   {-# NOINLINE[1] rule101 #-}
   rule101 = \ !_augmentsOut ->
     _augmentsOut
   {-# NOINLINE[1] rule102 #-}
   rule102 = \ ((!_prodsIerrors) :: Seq Error) ->
     _prodsIerrors
   {-# NOINLINE[1] rule104 #-}
   rule104 = \ !_augmentsIn ->
     _augmentsIn
   {-# NOINLINE[1] rule105 #-}
   rule105 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule106 #-}
   rule106 = \ ((!_lhsIinhMap) :: Map Identifier Attributes) ->
     _lhsIinhMap
   {-# NOINLINE[1] rule108 #-}
   rule108 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# NOINLINE[1] rule109 #-}
   rule109 = \ ((!_lhsIsynMap) :: Map Identifier Attributes) ->
     _lhsIsynMap

-- Nonterminals ------------------------------------------------
-- wrapper
data Inh_Nonterminals  = Inh_Nonterminals { augmentsIn_Inh_Nonterminals :: !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))), forcedIrrefutables_Inh_Nonterminals :: !(AttrMap), inhMap_Inh_Nonterminals :: !(Map Identifier Attributes), mainName_Inh_Nonterminals :: !(String), options_Inh_Nonterminals :: !(Options), synMap_Inh_Nonterminals :: !(Map Identifier Attributes) }
data Syn_Nonterminals  = Syn_Nonterminals { allAttributes_Syn_Nonterminals :: !(AttrMap), augmentsOut_Syn_Nonterminals :: !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))), errors_Syn_Nonterminals :: !(Seq Error), inhMap'_Syn_Nonterminals :: !(Map Identifier Attributes), output_Syn_Nonterminals :: !(Nonterminals), synMap'_Syn_Nonterminals :: !(Map Identifier Attributes) }
{-# INLINABLE wrap_Nonterminals #-}
wrap_Nonterminals :: T_Nonterminals  -> Inh_Nonterminals  -> (Syn_Nonterminals )
wrap_Nonterminals !(T_Nonterminals act) !(Inh_Nonterminals _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg8 = T_Nonterminals_vIn8 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap
        !(T_Nonterminals_vOut8 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOinhMap' _lhsOoutput _lhsOsynMap') <- return (inv_Nonterminals_s16 sem K_Nonterminals_v8 arg8)
        return (Syn_Nonterminals _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOinhMap' _lhsOoutput _lhsOsynMap')
   )

-- cata
{-# NOINLINE sem_Nonterminals #-}
sem_Nonterminals :: Nonterminals  -> T_Nonterminals 
sem_Nonterminals list = Prelude.foldr sem_Nonterminals_Cons sem_Nonterminals_Nil (Prelude.map sem_Nonterminal list)

-- semantic domain
newtype T_Nonterminals  = T_Nonterminals {
                                         attach_T_Nonterminals :: Identity (T_Nonterminals_s16 )
                                         }
data T_Nonterminals_s16  where C_Nonterminals_s16 :: {
                                                     inv_Nonterminals_s16 :: !(forall t. K_Nonterminals_s16  t -> t)
                                                     } -> T_Nonterminals_s16 
data T_Nonterminals_s17  = C_Nonterminals_s17
newtype T_Nonterminals_s36  = C_Nonterminals_s36 {
                                                 inv_Nonterminals_s36 :: (T_Nonterminals_v20 )
                                                 }
data K_Nonterminals_s16 k  where
   K_Nonterminals_v8 :: K_Nonterminals_s16  (T_Nonterminals_v8 )
   K_Nonterminals_v19 :: K_Nonterminals_s16  (T_Nonterminals_v19 )
type T_Nonterminals_v8  = (T_Nonterminals_vIn8 ) -> (T_Nonterminals_vOut8 )
data T_Nonterminals_vIn8  = T_Nonterminals_vIn8 !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !(AttrMap) !(Map Identifier Attributes) !(String) !(Options) !(Map Identifier Attributes)
data T_Nonterminals_vOut8  = T_Nonterminals_vOut8 !(AttrMap) !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !(Seq Error) !(Map Identifier Attributes) !(Nonterminals) !(Map Identifier Attributes)
type T_Nonterminals_v19  = (T_Nonterminals_vIn19 ) -> (T_Nonterminals_vOut19 )
data T_Nonterminals_vIn19  = T_Nonterminals_vIn19 
data T_Nonterminals_vOut19  = T_Nonterminals_vOut19 !(AttrMap) !(Map Identifier Attributes) !(Map Identifier Attributes) !(T_Nonterminals_s36 )
type T_Nonterminals_v20  = (T_Nonterminals_vIn20 ) -> (T_Nonterminals_vOut20 )
data T_Nonterminals_vIn20  = T_Nonterminals_vIn20 !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !(AttrMap) !(Map Identifier Attributes) !(String) !(Options) !(Map Identifier Attributes)
data T_Nonterminals_vOut20  = T_Nonterminals_vOut20 !(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) !(Seq Error) !(Nonterminals)
{-# NOINLINE sem_Nonterminals_Cons #-}
sem_Nonterminals_Cons :: T_Nonterminal  -> T_Nonterminals  -> T_Nonterminals 
sem_Nonterminals_Cons arg_hd_ arg_tl_ = T_Nonterminals (return st16) where
   {-# NOINLINE st16 #-}
   !st16 = let
      k16 :: K_Nonterminals_s16  t -> t
      k16 K_Nonterminals_v8 = v8
      k16 K_Nonterminals_v19 = v19
      v8 :: T_Nonterminals_v8 
      v8 = \ !(T_Nonterminals_vIn8 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let !_hdX14 = Control.Monad.Identity.runIdentity (attach_T_Nonterminal (arg_hd_)) in
         let !_tlX16 = Control.Monad.Identity.runIdentity (attach_T_Nonterminals (arg_tl_)) in
         let !_hdOaugmentsIn = rule117 _lhsIaugmentsIn in
         let !_hdOinhMap = rule119 _lhsIinhMap in
         let !_hdOoptions = rule121 _lhsIoptions in
         let !_hdOsynMap = rule122 _lhsIsynMap in
         let !_tlOaugmentsIn = rule123 _lhsIaugmentsIn in
         let !_tlOinhMap = rule125 _lhsIinhMap in
         let !_tlOoptions = rule127 _lhsIoptions in
         let !_tlOsynMap = rule128 _lhsIsynMap in
         let !_hdOforcedIrrefutables = rule118 _lhsIforcedIrrefutables in
         let !_hdOmainName = rule120 _lhsImainName in
         let !_tlOforcedIrrefutables = rule124 _lhsIforcedIrrefutables in
         let !_tlOmainName = rule126 _lhsImainName in
         let !(T_Nonterminal_vOut7 _hdIallAttributes _hdIaugmentsOut _hdIerrors _hdIinhMap' _hdIoutput _hdIsynMap') = inv_Nonterminal_s14 _hdX14 K_Nonterminal_v7 (T_Nonterminal_vIn7 _hdOaugmentsIn _hdOforcedIrrefutables _hdOinhMap _hdOmainName _hdOoptions _hdOsynMap) in
         let !(T_Nonterminals_vOut8 _tlIallAttributes _tlIaugmentsOut _tlIerrors _tlIinhMap' _tlIoutput _tlIsynMap') = inv_Nonterminals_s16 _tlX16 K_Nonterminals_v8 (T_Nonterminals_vIn8 _tlOaugmentsIn _tlOforcedIrrefutables _tlOinhMap _tlOmainName _tlOoptions _tlOsynMap) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule110 _hdIallAttributes _tlIallAttributes in
         let _lhsOaugmentsOut :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))
             !_lhsOaugmentsOut = rule111 _hdIaugmentsOut _tlIaugmentsOut in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule112 _hdIerrors _tlIerrors in
         let _lhsOinhMap' :: Map Identifier Attributes
             !_lhsOinhMap' = rule113 _hdIinhMap' _tlIinhMap' in
         let !_output = rule115 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Nonterminals
             !_lhsOoutput = rule116 _output in
         let _lhsOsynMap' :: Map Identifier Attributes
             !_lhsOsynMap' = rule114 _hdIsynMap' _tlIsynMap' in
         let !__result_ = T_Nonterminals_vOut8 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOinhMap' _lhsOoutput _lhsOsynMap'
          in __result_ )
      v19 :: T_Nonterminals_v19 
      v19 = \ !(T_Nonterminals_vIn19 ) -> (
         let !_hdX14 = Control.Monad.Identity.runIdentity (attach_T_Nonterminal (arg_hd_)) in
         let !_tlX16 = Control.Monad.Identity.runIdentity (attach_T_Nonterminals (arg_tl_)) in
         let !(T_Nonterminal_vOut32 _hdIallAttributes _hdIinhMap' _hdIsynMap' _hdX46) = inv_Nonterminal_s14 _hdX14 K_Nonterminal_v32 (T_Nonterminal_vIn32 ) in
         let !(T_Nonterminals_vOut19 _tlIallAttributes _tlIinhMap' _tlIsynMap' _tlX36) = inv_Nonterminals_s16 _tlX16 K_Nonterminals_v19 (T_Nonterminals_vIn19 ) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule110 _hdIallAttributes _tlIallAttributes in
         let _lhsOinhMap' :: Map Identifier Attributes
             !_lhsOinhMap' = rule113 _hdIinhMap' _tlIinhMap' in
         let _lhsOsynMap' :: Map Identifier Attributes
             !_lhsOsynMap' = rule114 _hdIsynMap' _tlIsynMap' in
         let !__st_ = st36 _hdX46 _tlX36
             !__result_ = T_Nonterminals_vOut19 _lhsOallAttributes _lhsOinhMap' _lhsOsynMap' __st_
          in __result_ )
     in C_Nonterminals_s16 k16
   {-# NOINLINE st36 #-}
   st36 = \ !_hdX46 !_tlX36 -> let
      v20 :: T_Nonterminals_v20 
      v20 = \ !(T_Nonterminals_vIn20 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let !_hdOaugmentsIn = rule117 _lhsIaugmentsIn in
         let !_hdOinhMap = rule119 _lhsIinhMap in
         let !_hdOoptions = rule121 _lhsIoptions in
         let !_hdOsynMap = rule122 _lhsIsynMap in
         let !_tlOaugmentsIn = rule123 _lhsIaugmentsIn in
         let !_tlOinhMap = rule125 _lhsIinhMap in
         let !_tlOoptions = rule127 _lhsIoptions in
         let !_tlOsynMap = rule128 _lhsIsynMap in
         let !_hdOforcedIrrefutables = rule118 _lhsIforcedIrrefutables in
         let !_hdOmainName = rule120 _lhsImainName in
         let !_tlOforcedIrrefutables = rule124 _lhsIforcedIrrefutables in
         let !_tlOmainName = rule126 _lhsImainName in
         let !(T_Nonterminal_vOut33 _hdIaugmentsOut _hdIerrors _hdIoutput) = inv_Nonterminal_s46 _hdX46 (T_Nonterminal_vIn33 _hdOaugmentsIn _hdOforcedIrrefutables _hdOinhMap _hdOmainName _hdOoptions _hdOsynMap) in
         let !(T_Nonterminals_vOut20 _tlIaugmentsOut _tlIerrors _tlIoutput) = inv_Nonterminals_s36 _tlX36 (T_Nonterminals_vIn20 _tlOaugmentsIn _tlOforcedIrrefutables _tlOinhMap _tlOmainName _tlOoptions _tlOsynMap) in
         let _lhsOaugmentsOut :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))
             !_lhsOaugmentsOut = rule111 _hdIaugmentsOut _tlIaugmentsOut in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule112 _hdIerrors _tlIerrors in
         let !_output = rule115 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Nonterminals
             !_lhsOoutput = rule116 _output in
         let !__result_ = T_Nonterminals_vOut20 _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Nonterminals_s36 v20
   {-# NOINLINE[1] rule110 #-}
   rule110 = \ ((!_hdIallAttributes) :: AttrMap) ((!_tlIallAttributes) :: AttrMap) ->
     _hdIallAttributes `mergeAttributes` _tlIallAttributes
   {-# NOINLINE[1] rule111 #-}
   rule111 = \ ((!_hdIaugmentsOut) :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ((!_tlIaugmentsOut) :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ->
     _hdIaugmentsOut `Map.union` _tlIaugmentsOut
   {-# NOINLINE[1] rule112 #-}
   rule112 = \ ((!_hdIerrors) :: Seq Error) ((!_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# NOINLINE[1] rule113 #-}
   rule113 = \ ((!_hdIinhMap') :: Map Identifier Attributes) ((!_tlIinhMap') :: Map Identifier Attributes) ->
     _hdIinhMap' `Map.union` _tlIinhMap'
   {-# NOINLINE[1] rule114 #-}
   rule114 = \ ((!_hdIsynMap') :: Map Identifier Attributes) ((!_tlIsynMap') :: Map Identifier Attributes) ->
     _hdIsynMap' `Map.union` _tlIsynMap'
   {-# NOINLINE[1] rule115 #-}
   rule115 = \ ((!_hdIoutput) :: Nonterminal) ((!_tlIoutput) :: Nonterminals) ->
     (:) _hdIoutput _tlIoutput
   {-# NOINLINE[1] rule116 #-}
   rule116 = \ !_output ->
     _output
   {-# NOINLINE[1] rule117 #-}
   rule117 = \ ((!_lhsIaugmentsIn) :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ->
     _lhsIaugmentsIn
   {-# NOINLINE[1] rule118 #-}
   rule118 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule119 #-}
   rule119 = \ ((!_lhsIinhMap) :: Map Identifier Attributes) ->
     _lhsIinhMap
   {-# NOINLINE[1] rule120 #-}
   rule120 = \ ((!_lhsImainName) :: String) ->
     _lhsImainName
   {-# NOINLINE[1] rule121 #-}
   rule121 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# NOINLINE[1] rule122 #-}
   rule122 = \ ((!_lhsIsynMap) :: Map Identifier Attributes) ->
     _lhsIsynMap
   {-# NOINLINE[1] rule123 #-}
   rule123 = \ ((!_lhsIaugmentsIn) :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ->
     _lhsIaugmentsIn
   {-# NOINLINE[1] rule124 #-}
   rule124 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule125 #-}
   rule125 = \ ((!_lhsIinhMap) :: Map Identifier Attributes) ->
     _lhsIinhMap
   {-# NOINLINE[1] rule126 #-}
   rule126 = \ ((!_lhsImainName) :: String) ->
     _lhsImainName
   {-# NOINLINE[1] rule127 #-}
   rule127 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# NOINLINE[1] rule128 #-}
   rule128 = \ ((!_lhsIsynMap) :: Map Identifier Attributes) ->
     _lhsIsynMap
{-# NOINLINE sem_Nonterminals_Nil #-}
sem_Nonterminals_Nil ::  T_Nonterminals 
sem_Nonterminals_Nil  = T_Nonterminals (return st16) where
   {-# NOINLINE st16 #-}
   !st16 = let
      k16 :: K_Nonterminals_s16  t -> t
      k16 K_Nonterminals_v8 = v8
      k16 K_Nonterminals_v19 = v19
      v8 :: T_Nonterminals_v8 
      v8 = \ !(T_Nonterminals_vIn8 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule129  () in
         let _lhsOaugmentsOut :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))
             !_lhsOaugmentsOut = rule130  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule131  () in
         let _lhsOinhMap' :: Map Identifier Attributes
             !_lhsOinhMap' = rule132  () in
         let !_output = rule134  () in
         let _lhsOsynMap' :: Map Identifier Attributes
             !_lhsOsynMap' = rule133  () in
         let _lhsOoutput :: Nonterminals
             !_lhsOoutput = rule135 _output in
         let !__result_ = T_Nonterminals_vOut8 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOinhMap' _lhsOoutput _lhsOsynMap'
          in __result_ )
      v19 :: T_Nonterminals_v19 
      v19 = \ !(T_Nonterminals_vIn19 ) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule129  () in
         let _lhsOinhMap' :: Map Identifier Attributes
             !_lhsOinhMap' = rule132  () in
         let _lhsOsynMap' :: Map Identifier Attributes
             !_lhsOsynMap' = rule133  () in
         let !__st_ = st36  ()
             !__result_ = T_Nonterminals_vOut19 _lhsOallAttributes _lhsOinhMap' _lhsOsynMap' __st_
          in __result_ )
     in C_Nonterminals_s16 k16
   {-# NOINLINE st36 #-}
   st36 = \  (_ :: ()) -> let
      v20 :: T_Nonterminals_v20 
      v20 = \ !(T_Nonterminals_vIn20 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsIoptions _lhsIsynMap) -> (
         let _lhsOaugmentsOut :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))
             !_lhsOaugmentsOut = rule130  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule131  () in
         let !_output = rule134  () in
         let _lhsOoutput :: Nonterminals
             !_lhsOoutput = rule135 _output in
         let !__result_ = T_Nonterminals_vOut20 _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Nonterminals_s36 v20
   {-# NOINLINE[1] rule129 #-}
   rule129 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule130 #-}
   rule130 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule131 #-}
   rule131 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule132 #-}
   rule132 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule133 #-}
   rule133 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule134 #-}
   rule134 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule135 #-}
   rule135 = \ !_output ->
     _output

-- Pattern -----------------------------------------------------
-- wrapper
data Inh_Pattern  = Inh_Pattern { childInhs_Inh_Pattern :: !([(Identifier, Identifier)]), childSyns_Inh_Pattern :: !([(Identifier, Identifier)]), con_Inh_Pattern :: !(ConstructorIdent), defs_Inh_Pattern :: !(Set (Identifier, Identifier)), forcedIrrefutables_Inh_Pattern :: !(AttrMap), nt_Inh_Pattern :: !(NontermIdent) }
data Syn_Pattern  = Syn_Pattern { allAttributes_Syn_Pattern :: !(AttrMap), copy_Syn_Pattern :: !(Pattern), defsCollect_Syn_Pattern :: !(Set (Identifier, Identifier)), errors_Syn_Pattern :: !(Seq Error), output_Syn_Pattern :: !(Pattern) }
{-# INLINABLE wrap_Pattern #-}
wrap_Pattern :: T_Pattern  -> Inh_Pattern  -> (Syn_Pattern )
wrap_Pattern !(T_Pattern act) !(Inh_Pattern _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg9 = T_Pattern_vIn9 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt
        !(T_Pattern_vOut9 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput) <- return (inv_Pattern_s18 sem K_Pattern_v9 arg9)
        return (Syn_Pattern _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput)
   )

-- cata
{-# NOINLINE sem_Pattern #-}
sem_Pattern :: Pattern  -> T_Pattern 
sem_Pattern ( Constr !name_ pats_ ) = sem_Pattern_Constr name_ ( sem_Patterns pats_ )
sem_Pattern ( Product !pos_ pats_ ) = sem_Pattern_Product pos_ ( sem_Patterns pats_ )
sem_Pattern ( Alias !field_ !attr_ pat_ ) = sem_Pattern_Alias field_ attr_ ( sem_Pattern pat_ )
sem_Pattern ( Irrefutable pat_ ) = sem_Pattern_Irrefutable ( sem_Pattern pat_ )
sem_Pattern ( Underscore !pos_ ) = sem_Pattern_Underscore pos_

-- semantic domain
newtype T_Pattern  = T_Pattern {
                               attach_T_Pattern :: Identity (T_Pattern_s18 )
                               }
data T_Pattern_s18  where C_Pattern_s18 :: {
                                           inv_Pattern_s18 :: !(forall t. K_Pattern_s18  t -> t)
                                           } -> T_Pattern_s18 
data T_Pattern_s19  = C_Pattern_s19
data T_Pattern_s42  = C_Pattern_s42
data T_Pattern_s45  = C_Pattern_s45
newtype T_Pattern_s51  = C_Pattern_s51 {
                                       inv_Pattern_s51 :: (T_Pattern_v42 )
                                       }
newtype T_Pattern_s54  = C_Pattern_s54 {
                                       inv_Pattern_s54 :: (T_Pattern_v48 )
                                       }
newtype T_Pattern_s58  = C_Pattern_s58 {
                                       inv_Pattern_s58 :: (T_Pattern_v56 )
                                       }
data K_Pattern_s18 k  where
   K_Pattern_v9 :: K_Pattern_s18  (T_Pattern_v9 )
   K_Pattern_v27 :: K_Pattern_s18  (T_Pattern_v27 )
   K_Pattern_v31 :: K_Pattern_s18  (T_Pattern_v31 )
   K_Pattern_v41 :: K_Pattern_s18  (T_Pattern_v41 )
   K_Pattern_v46 :: K_Pattern_s18  (T_Pattern_v46 )
   K_Pattern_v55 :: K_Pattern_s18  (T_Pattern_v55 )
type T_Pattern_v9  = (T_Pattern_vIn9 ) -> (T_Pattern_vOut9 )
data T_Pattern_vIn9  = T_Pattern_vIn9 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent)
data T_Pattern_vOut9  = T_Pattern_vOut9 !(AttrMap) !(Pattern) !(Set (Identifier, Identifier)) !(Seq Error) !(Pattern)
type T_Pattern_v27  = (T_Pattern_vIn27 ) -> (T_Pattern_vOut27 )
data T_Pattern_vIn27  = T_Pattern_vIn27 !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent)
data T_Pattern_vOut27  = T_Pattern_vOut27 !(AttrMap) !(Pattern) !(Set (Identifier, Identifier)) !(Seq Error) !(Pattern)
type T_Pattern_v31  = (T_Pattern_vIn31 ) -> (T_Pattern_vOut31 )
data T_Pattern_vIn31  = T_Pattern_vIn31 !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent)
data T_Pattern_vOut31  = T_Pattern_vOut31 !(AttrMap) !(Set (Identifier, Identifier)) !(Seq Error) !(Pattern)
type T_Pattern_v41  = (T_Pattern_vIn41 ) -> (T_Pattern_vOut41 )
data T_Pattern_vIn41  = T_Pattern_vIn41 !(ConstructorIdent) !(NontermIdent)
data T_Pattern_vOut41  = T_Pattern_vOut41 !(AttrMap) !(Set (Identifier, Identifier)) !(T_Pattern_s51 )
type T_Pattern_v42  = (T_Pattern_vIn42 ) -> (T_Pattern_vOut42 )
data T_Pattern_vIn42  = T_Pattern_vIn42 !([(Identifier, Identifier)]) !(Set (Identifier, Identifier)) !(AttrMap)
data T_Pattern_vOut42  = T_Pattern_vOut42 !(Seq Error) !(Pattern)
type T_Pattern_v46  = (T_Pattern_vIn46 ) -> (T_Pattern_vOut46 )
data T_Pattern_vIn46  = T_Pattern_vIn46 
data T_Pattern_vOut46  = T_Pattern_vOut46 !(Set (Identifier, Identifier)) !(T_Pattern_s54 )
type T_Pattern_v48  = (T_Pattern_vIn48 ) -> (T_Pattern_vOut48 )
data T_Pattern_vIn48  = T_Pattern_vIn48 !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent)
data T_Pattern_vOut48  = T_Pattern_vOut48 !(AttrMap) !(Seq Error) !(Pattern)
type T_Pattern_v55  = (T_Pattern_vIn55 ) -> (T_Pattern_vOut55 )
data T_Pattern_vIn55  = T_Pattern_vIn55 !(ConstructorIdent) !(NontermIdent)
data T_Pattern_vOut55  = T_Pattern_vOut55 !(AttrMap) !(T_Pattern_s58 )
type T_Pattern_v56  = (T_Pattern_vIn56 ) -> (T_Pattern_vOut56 )
data T_Pattern_vIn56  = T_Pattern_vIn56 
data T_Pattern_vOut56  = T_Pattern_vOut56 !(Set (Identifier, Identifier)) !(T_Pattern_s51 )
{-# NOINLINE sem_Pattern_Constr #-}
sem_Pattern_Constr :: (ConstructorIdent) -> T_Patterns  -> T_Pattern 
sem_Pattern_Constr !arg_name_ arg_pats_ = T_Pattern (return st18) where
   {-# NOINLINE st18 #-}
   !st18 = let
      k18 :: K_Pattern_s18  t -> t
      k18 K_Pattern_v9 = v9
      k18 K_Pattern_v27 = v27
      k18 K_Pattern_v31 = v31
      k18 K_Pattern_v41 = v41
      k18 K_Pattern_v46 = v46
      k18 K_Pattern_v55 = v55
      v9 :: T_Pattern_v9 
      v9 = \ !(T_Pattern_vIn9 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule145 _lhsIcon in
         let !_patsOnt = rule148 _lhsInt in
         let !_patsOchildInhs = rule143 _lhsIchildInhs in
         let !_patsOdefs = rule146 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule147 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut26 _patsIallAttributes _patsIcopy _patsIdefsCollect _patsIerrors _patsIoutput) = inv_Patterns_s20 _patsX20 K_Patterns_v26 (T_Patterns_vIn26 _patsOchildInhs _patsOcon _patsOdefs _patsOforcedIrrefutables _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule136 _patsIallAttributes in
         let !_copy = rule139 _patsIcopy arg_name_ in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule141 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule137 _patsIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule138 _patsIerrors in
         let !_output = rule140 _patsIoutput arg_name_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule142 _output in
         let !__result_ = T_Pattern_vOut9 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v27 :: T_Pattern_v27 
      v27 = \ !(T_Pattern_vIn27 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule145 _lhsIcon in
         let !_patsOnt = rule148 _lhsInt in
         let !_patsOchildInhs = rule143 _lhsIchildInhs in
         let !_patsOdefs = rule146 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule147 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut26 _patsIallAttributes _patsIcopy _patsIdefsCollect _patsIerrors _patsIoutput) = inv_Patterns_s20 _patsX20 K_Patterns_v26 (T_Patterns_vIn26 _patsOchildInhs _patsOcon _patsOdefs _patsOforcedIrrefutables _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule136 _patsIallAttributes in
         let !_copy = rule139 _patsIcopy arg_name_ in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule141 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule137 _patsIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule138 _patsIerrors in
         let !_output = rule140 _patsIoutput arg_name_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule142 _output in
         let !__result_ = T_Pattern_vOut27 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v31 :: T_Pattern_v31 
      v31 = \ !(T_Pattern_vIn31 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule145 _lhsIcon in
         let !_patsOnt = rule148 _lhsInt in
         let !_patsOchildInhs = rule143 _lhsIchildInhs in
         let !_patsOdefs = rule146 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule147 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut38 _patsIallAttributes _patsIdefsCollect _patsIerrors _patsIoutput) = inv_Patterns_s20 _patsX20 K_Patterns_v38 (T_Patterns_vIn38 _patsOchildInhs _patsOcon _patsOdefs _patsOforcedIrrefutables _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule136 _patsIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule137 _patsIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule138 _patsIerrors in
         let !_output = rule140 _patsIoutput arg_name_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule142 _output in
         let !__result_ = T_Pattern_vOut31 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v41 :: T_Pattern_v41 
      v41 = \ !(T_Pattern_vIn41 _lhsIcon _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule145 _lhsIcon in
         let !_patsOnt = rule148 _lhsInt in
         let !(T_Patterns_vOut45 _patsIallAttributes _patsIdefsCollect _patsX53) = inv_Patterns_s20 _patsX20 K_Patterns_v45 (T_Patterns_vIn45 _patsOcon _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule136 _patsIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule137 _patsIdefsCollect in
         let !__st_ = st51 _patsX53
             !__result_ = T_Pattern_vOut41 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v46 :: T_Pattern_v46 
      v46 = \ !(T_Pattern_vIn46 ) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !(T_Patterns_vOut51 _patsIdefsCollect _patsX56) = inv_Patterns_s20 _patsX20 K_Patterns_v51 (T_Patterns_vIn51 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule137 _patsIdefsCollect in
         let !__st_ = st54 _patsX56
             !__result_ = T_Pattern_vOut46 _lhsOdefsCollect __st_
          in __result_ )
      v55 :: T_Pattern_v55 
      v55 = \ !(T_Pattern_vIn55 _lhsIcon _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule145 _lhsIcon in
         let !_patsOnt = rule148 _lhsInt in
         let !(T_Patterns_vOut57 _patsIallAttributes _patsX59) = inv_Patterns_s20 _patsX20 K_Patterns_v57 (T_Patterns_vIn57 _patsOcon _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule136 _patsIallAttributes in
         let !__st_ = st58 _patsX59
             !__result_ = T_Pattern_vOut55 _lhsOallAttributes __st_
          in __result_ )
     in C_Pattern_s18 k18
   {-# NOINLINE st51 #-}
   st51 = \ !_patsX53 -> let
      v42 :: T_Pattern_v42 
      v42 = \ !(T_Pattern_vIn42 _lhsIchildInhs _lhsIdefs _lhsIforcedIrrefutables) -> (
         let !_patsOchildInhs = rule143 _lhsIchildInhs in
         let !_patsOdefs = rule146 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule147 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut47 _patsIerrors _patsIoutput) = inv_Patterns_s53 _patsX53 (T_Patterns_vIn47 _patsOchildInhs _patsOdefs _patsOforcedIrrefutables) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule138 _patsIerrors in
         let !_output = rule140 _patsIoutput arg_name_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule142 _output in
         let !__result_ = T_Pattern_vOut42 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s51 v42
   {-# NOINLINE st54 #-}
   st54 = \ !_patsX56 -> let
      v48 :: T_Pattern_v48 
      v48 = \ !(T_Pattern_vIn48 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patsOcon = rule145 _lhsIcon in
         let !_patsOnt = rule148 _lhsInt in
         let !_patsOchildInhs = rule143 _lhsIchildInhs in
         let !_patsOdefs = rule146 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule147 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut52 _patsIallAttributes _patsIerrors _patsIoutput) = inv_Patterns_s56 _patsX56 (T_Patterns_vIn52 _patsOchildInhs _patsOcon _patsOdefs _patsOforcedIrrefutables _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule136 _patsIallAttributes in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule138 _patsIerrors in
         let !_output = rule140 _patsIoutput arg_name_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule142 _output in
         let !__result_ = T_Pattern_vOut48 _lhsOallAttributes _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s54 v48
   {-# NOINLINE st58 #-}
   st58 = \ !_patsX59 -> let
      v56 :: T_Pattern_v56 
      v56 = \ !(T_Pattern_vIn56 ) -> (
         let !(T_Patterns_vOut58 _patsIdefsCollect _patsX53) = inv_Patterns_s59 _patsX59 (T_Patterns_vIn58 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule137 _patsIdefsCollect in
         let !__st_ = st51 _patsX53
             !__result_ = T_Pattern_vOut56 _lhsOdefsCollect __st_
          in __result_ )
     in C_Pattern_s58 v56
   {-# NOINLINE[1] rule136 #-}
   rule136 = \ ((!_patsIallAttributes) :: AttrMap) ->
     _patsIallAttributes
   {-# NOINLINE[1] rule137 #-}
   rule137 = \ ((!_patsIdefsCollect) :: Set (Identifier, Identifier)) ->
     _patsIdefsCollect
   {-# NOINLINE[1] rule138 #-}
   rule138 = \ ((!_patsIerrors) :: Seq Error) ->
     _patsIerrors
   {-# NOINLINE[1] rule139 #-}
   rule139 = \ ((!_patsIcopy) :: Patterns) !name_ ->
     Constr name_ _patsIcopy
   {-# NOINLINE[1] rule140 #-}
   rule140 = \ ((!_patsIoutput) :: Patterns) !name_ ->
     Constr name_ _patsIoutput
   {-# NOINLINE[1] rule141 #-}
   rule141 = \ !_copy ->
     _copy
   {-# NOINLINE[1] rule142 #-}
   rule142 = \ !_output ->
     _output
   {-# NOINLINE[1] rule143 #-}
   rule143 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule145 #-}
   rule145 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule146 #-}
   rule146 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule147 #-}
   rule147 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule148 #-}
   rule148 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
{-# NOINLINE sem_Pattern_Product #-}
sem_Pattern_Product :: (Pos) -> T_Patterns  -> T_Pattern 
sem_Pattern_Product !arg_pos_ arg_pats_ = T_Pattern (return st18) where
   {-# NOINLINE st18 #-}
   !st18 = let
      k18 :: K_Pattern_s18  t -> t
      k18 K_Pattern_v9 = v9
      k18 K_Pattern_v27 = v27
      k18 K_Pattern_v31 = v31
      k18 K_Pattern_v41 = v41
      k18 K_Pattern_v46 = v46
      k18 K_Pattern_v55 = v55
      v9 :: T_Pattern_v9 
      v9 = \ !(T_Pattern_vIn9 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule158 _lhsIcon in
         let !_patsOnt = rule161 _lhsInt in
         let !_patsOchildInhs = rule156 _lhsIchildInhs in
         let !_patsOdefs = rule159 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule160 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut26 _patsIallAttributes _patsIcopy _patsIdefsCollect _patsIerrors _patsIoutput) = inv_Patterns_s20 _patsX20 K_Patterns_v26 (T_Patterns_vIn26 _patsOchildInhs _patsOcon _patsOdefs _patsOforcedIrrefutables _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule149 _patsIallAttributes in
         let !_copy = rule152 _patsIcopy arg_pos_ in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule154 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule150 _patsIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule151 _patsIerrors in
         let !_output = rule153 _patsIoutput arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule155 _output in
         let !__result_ = T_Pattern_vOut9 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v27 :: T_Pattern_v27 
      v27 = \ !(T_Pattern_vIn27 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule158 _lhsIcon in
         let !_patsOnt = rule161 _lhsInt in
         let !_patsOchildInhs = rule156 _lhsIchildInhs in
         let !_patsOdefs = rule159 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule160 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut26 _patsIallAttributes _patsIcopy _patsIdefsCollect _patsIerrors _patsIoutput) = inv_Patterns_s20 _patsX20 K_Patterns_v26 (T_Patterns_vIn26 _patsOchildInhs _patsOcon _patsOdefs _patsOforcedIrrefutables _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule149 _patsIallAttributes in
         let !_copy = rule152 _patsIcopy arg_pos_ in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule154 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule150 _patsIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule151 _patsIerrors in
         let !_output = rule153 _patsIoutput arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule155 _output in
         let !__result_ = T_Pattern_vOut27 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v31 :: T_Pattern_v31 
      v31 = \ !(T_Pattern_vIn31 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule158 _lhsIcon in
         let !_patsOnt = rule161 _lhsInt in
         let !_patsOchildInhs = rule156 _lhsIchildInhs in
         let !_patsOdefs = rule159 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule160 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut38 _patsIallAttributes _patsIdefsCollect _patsIerrors _patsIoutput) = inv_Patterns_s20 _patsX20 K_Patterns_v38 (T_Patterns_vIn38 _patsOchildInhs _patsOcon _patsOdefs _patsOforcedIrrefutables _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule149 _patsIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule150 _patsIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule151 _patsIerrors in
         let !_output = rule153 _patsIoutput arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule155 _output in
         let !__result_ = T_Pattern_vOut31 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v41 :: T_Pattern_v41 
      v41 = \ !(T_Pattern_vIn41 _lhsIcon _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule158 _lhsIcon in
         let !_patsOnt = rule161 _lhsInt in
         let !(T_Patterns_vOut45 _patsIallAttributes _patsIdefsCollect _patsX53) = inv_Patterns_s20 _patsX20 K_Patterns_v45 (T_Patterns_vIn45 _patsOcon _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule149 _patsIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule150 _patsIdefsCollect in
         let !__st_ = st51 _patsX53
             !__result_ = T_Pattern_vOut41 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v46 :: T_Pattern_v46 
      v46 = \ !(T_Pattern_vIn46 ) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !(T_Patterns_vOut51 _patsIdefsCollect _patsX56) = inv_Patterns_s20 _patsX20 K_Patterns_v51 (T_Patterns_vIn51 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule150 _patsIdefsCollect in
         let !__st_ = st54 _patsX56
             !__result_ = T_Pattern_vOut46 _lhsOdefsCollect __st_
          in __result_ )
      v55 :: T_Pattern_v55 
      v55 = \ !(T_Pattern_vIn55 _lhsIcon _lhsInt) -> (
         let !_patsX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_pats_)) in
         let !_patsOcon = rule158 _lhsIcon in
         let !_patsOnt = rule161 _lhsInt in
         let !(T_Patterns_vOut57 _patsIallAttributes _patsX59) = inv_Patterns_s20 _patsX20 K_Patterns_v57 (T_Patterns_vIn57 _patsOcon _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule149 _patsIallAttributes in
         let !__st_ = st58 _patsX59
             !__result_ = T_Pattern_vOut55 _lhsOallAttributes __st_
          in __result_ )
     in C_Pattern_s18 k18
   {-# NOINLINE st51 #-}
   st51 = \ !_patsX53 -> let
      v42 :: T_Pattern_v42 
      v42 = \ !(T_Pattern_vIn42 _lhsIchildInhs _lhsIdefs _lhsIforcedIrrefutables) -> (
         let !_patsOchildInhs = rule156 _lhsIchildInhs in
         let !_patsOdefs = rule159 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule160 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut47 _patsIerrors _patsIoutput) = inv_Patterns_s53 _patsX53 (T_Patterns_vIn47 _patsOchildInhs _patsOdefs _patsOforcedIrrefutables) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule151 _patsIerrors in
         let !_output = rule153 _patsIoutput arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule155 _output in
         let !__result_ = T_Pattern_vOut42 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s51 v42
   {-# NOINLINE st54 #-}
   st54 = \ !_patsX56 -> let
      v48 :: T_Pattern_v48 
      v48 = \ !(T_Pattern_vIn48 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patsOcon = rule158 _lhsIcon in
         let !_patsOnt = rule161 _lhsInt in
         let !_patsOchildInhs = rule156 _lhsIchildInhs in
         let !_patsOdefs = rule159 _lhsIdefs in
         let !_patsOforcedIrrefutables = rule160 _lhsIforcedIrrefutables in
         let !(T_Patterns_vOut52 _patsIallAttributes _patsIerrors _patsIoutput) = inv_Patterns_s56 _patsX56 (T_Patterns_vIn52 _patsOchildInhs _patsOcon _patsOdefs _patsOforcedIrrefutables _patsOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule149 _patsIallAttributes in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule151 _patsIerrors in
         let !_output = rule153 _patsIoutput arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule155 _output in
         let !__result_ = T_Pattern_vOut48 _lhsOallAttributes _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s54 v48
   {-# NOINLINE st58 #-}
   st58 = \ !_patsX59 -> let
      v56 :: T_Pattern_v56 
      v56 = \ !(T_Pattern_vIn56 ) -> (
         let !(T_Patterns_vOut58 _patsIdefsCollect _patsX53) = inv_Patterns_s59 _patsX59 (T_Patterns_vIn58 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule150 _patsIdefsCollect in
         let !__st_ = st51 _patsX53
             !__result_ = T_Pattern_vOut56 _lhsOdefsCollect __st_
          in __result_ )
     in C_Pattern_s58 v56
   {-# NOINLINE[1] rule149 #-}
   rule149 = \ ((!_patsIallAttributes) :: AttrMap) ->
     _patsIallAttributes
   {-# NOINLINE[1] rule150 #-}
   rule150 = \ ((!_patsIdefsCollect) :: Set (Identifier, Identifier)) ->
     _patsIdefsCollect
   {-# NOINLINE[1] rule151 #-}
   rule151 = \ ((!_patsIerrors) :: Seq Error) ->
     _patsIerrors
   {-# NOINLINE[1] rule152 #-}
   rule152 = \ ((!_patsIcopy) :: Patterns) !pos_ ->
     Product pos_ _patsIcopy
   {-# NOINLINE[1] rule153 #-}
   rule153 = \ ((!_patsIoutput) :: Patterns) !pos_ ->
     Product pos_ _patsIoutput
   {-# NOINLINE[1] rule154 #-}
   rule154 = \ !_copy ->
     _copy
   {-# NOINLINE[1] rule155 #-}
   rule155 = \ !_output ->
     _output
   {-# NOINLINE[1] rule156 #-}
   rule156 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule158 #-}
   rule158 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule159 #-}
   rule159 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule160 #-}
   rule160 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule161 #-}
   rule161 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
{-# NOINLINE sem_Pattern_Alias #-}
sem_Pattern_Alias :: (Identifier) -> (Identifier) -> T_Pattern  -> T_Pattern 
sem_Pattern_Alias !arg_field_ !arg_attr_ arg_pat_ = T_Pattern (return st18) where
   {-# NOINLINE st18 #-}
   !st18 = let
      k18 :: K_Pattern_s18  t -> t
      k18 K_Pattern_v9 = v9
      k18 K_Pattern_v27 = v27
      k18 K_Pattern_v31 = v31
      k18 K_Pattern_v41 = v41
      k18 K_Pattern_v46 = v46
      k18 K_Pattern_v55 = v55
      v9 :: T_Pattern_v9 
      v9 = \ !(T_Pattern_vIn9 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_patOcon = rule174 _lhsIcon in
         let !_patOnt = rule177 _lhsInt in
         let !_def = rule166 arg_attr_ arg_field_ in
         let !_patOchildInhs = rule172 _lhsIchildInhs in
         let !_patOdefs = rule175 _lhsIdefs in
         let !(!_field',!_err1) = rule162 _lhsIchildInhs _lhsIcon _lhsInt arg_attr_ arg_field_ in
         let !_err2 = rule163 _field' _lhsIcon _lhsIdefs _lhsInt arg_attr_ arg_field_ in
         let !_patOforcedIrrefutables = rule176 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut27 _patIallAttributes _patIcopy _patIdefsCollect _patIerrors _patIoutput) = inv_Pattern_s18 _patX18 K_Pattern_v27 (T_Pattern_vIn27 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule168 _lhsIcon _lhsInt _patIallAttributes arg_attr_ arg_field_ in
         let !_copy = rule170 _patIcopy arg_attr_ arg_field_ in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule171 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule167 _def _patIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule164 _err1 _err2 _patIerrors in
         let !_output = rule165 _field' _patIoutput arg_attr_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule169 _lhsIcon _lhsIforcedIrrefutables _lhsInt _output arg_attr_ arg_field_ in
         let !__result_ = T_Pattern_vOut9 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v27 :: T_Pattern_v27 
      v27 = \ !(T_Pattern_vIn27 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_patOcon = rule174 _lhsIcon in
         let !_patOnt = rule177 _lhsInt in
         let !_def = rule166 arg_attr_ arg_field_ in
         let !_patOchildInhs = rule172 _lhsIchildInhs in
         let !_patOdefs = rule175 _lhsIdefs in
         let !(!_field',!_err1) = rule162 _lhsIchildInhs _lhsIcon _lhsInt arg_attr_ arg_field_ in
         let !_err2 = rule163 _field' _lhsIcon _lhsIdefs _lhsInt arg_attr_ arg_field_ in
         let !_patOforcedIrrefutables = rule176 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut27 _patIallAttributes _patIcopy _patIdefsCollect _patIerrors _patIoutput) = inv_Pattern_s18 _patX18 K_Pattern_v27 (T_Pattern_vIn27 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule168 _lhsIcon _lhsInt _patIallAttributes arg_attr_ arg_field_ in
         let !_copy = rule170 _patIcopy arg_attr_ arg_field_ in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule171 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule167 _def _patIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule164 _err1 _err2 _patIerrors in
         let !_output = rule165 _field' _patIoutput arg_attr_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule169 _lhsIcon _lhsIforcedIrrefutables _lhsInt _output arg_attr_ arg_field_ in
         let !__result_ = T_Pattern_vOut27 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v31 :: T_Pattern_v31 
      v31 = \ !(T_Pattern_vIn31 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_patOcon = rule174 _lhsIcon in
         let !_patOnt = rule177 _lhsInt in
         let !_def = rule166 arg_attr_ arg_field_ in
         let !_patOchildInhs = rule172 _lhsIchildInhs in
         let !_patOdefs = rule175 _lhsIdefs in
         let !(!_field',!_err1) = rule162 _lhsIchildInhs _lhsIcon _lhsInt arg_attr_ arg_field_ in
         let !_err2 = rule163 _field' _lhsIcon _lhsIdefs _lhsInt arg_attr_ arg_field_ in
         let !_patOforcedIrrefutables = rule176 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut31 _patIallAttributes _patIdefsCollect _patIerrors _patIoutput) = inv_Pattern_s18 _patX18 K_Pattern_v31 (T_Pattern_vIn31 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule168 _lhsIcon _lhsInt _patIallAttributes arg_attr_ arg_field_ in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule167 _def _patIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule164 _err1 _err2 _patIerrors in
         let !_output = rule165 _field' _patIoutput arg_attr_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule169 _lhsIcon _lhsIforcedIrrefutables _lhsInt _output arg_attr_ arg_field_ in
         let !__result_ = T_Pattern_vOut31 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v41 :: T_Pattern_v41 
      v41 = \ !(T_Pattern_vIn41 _lhsIcon _lhsInt) -> (
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_patOcon = rule174 _lhsIcon in
         let !_patOnt = rule177 _lhsInt in
         let !_def = rule166 arg_attr_ arg_field_ in
         let !(T_Pattern_vOut41 _patIallAttributes _patIdefsCollect _patX51) = inv_Pattern_s18 _patX18 K_Pattern_v41 (T_Pattern_vIn41 _patOcon _patOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule168 _lhsIcon _lhsInt _patIallAttributes arg_attr_ arg_field_ in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule167 _def _patIdefsCollect in
         let !__st_ = st51 _lhsIcon _lhsInt _patX51
             !__result_ = T_Pattern_vOut41 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v46 :: T_Pattern_v46 
      v46 = \ !(T_Pattern_vIn46 ) -> (
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_def = rule166 arg_attr_ arg_field_ in
         let !(T_Pattern_vOut46 _patIdefsCollect _patX54) = inv_Pattern_s18 _patX18 K_Pattern_v46 (T_Pattern_vIn46 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule167 _def _patIdefsCollect in
         let !__st_ = st54 _patX54
             !__result_ = T_Pattern_vOut46 _lhsOdefsCollect __st_
          in __result_ )
      v55 :: T_Pattern_v55 
      v55 = \ !(T_Pattern_vIn55 _lhsIcon _lhsInt) -> (
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_patOcon = rule174 _lhsIcon in
         let !_patOnt = rule177 _lhsInt in
         let !(T_Pattern_vOut55 _patIallAttributes _patX58) = inv_Pattern_s18 _patX18 K_Pattern_v55 (T_Pattern_vIn55 _patOcon _patOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule168 _lhsIcon _lhsInt _patIallAttributes arg_attr_ arg_field_ in
         let !__st_ = st58 _lhsIcon _lhsInt _patX58
             !__result_ = T_Pattern_vOut55 _lhsOallAttributes __st_
          in __result_ )
     in C_Pattern_s18 k18
   {-# NOINLINE st51 #-}
   st51 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) !_patX51 -> let
      v42 :: T_Pattern_v42 
      v42 = \ !(T_Pattern_vIn42 _lhsIchildInhs _lhsIdefs _lhsIforcedIrrefutables) -> (
         let !_patOchildInhs = rule172 _lhsIchildInhs in
         let !_patOdefs = rule175 _lhsIdefs in
         let !(!_field',!_err1) = rule162 _lhsIchildInhs _lhsIcon _lhsInt arg_attr_ arg_field_ in
         let !_err2 = rule163 _field' _lhsIcon _lhsIdefs _lhsInt arg_attr_ arg_field_ in
         let !_patOforcedIrrefutables = rule176 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut42 _patIerrors _patIoutput) = inv_Pattern_s51 _patX51 (T_Pattern_vIn42 _patOchildInhs _patOdefs _patOforcedIrrefutables) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule164 _err1 _err2 _patIerrors in
         let !_output = rule165 _field' _patIoutput arg_attr_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule169 _lhsIcon _lhsIforcedIrrefutables _lhsInt _output arg_attr_ arg_field_ in
         let !__result_ = T_Pattern_vOut42 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s51 v42
   {-# NOINLINE st54 #-}
   st54 = \ !_patX54 -> let
      v48 :: T_Pattern_v48 
      v48 = \ !(T_Pattern_vIn48 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_patOcon = rule174 _lhsIcon in
         let !_patOnt = rule177 _lhsInt in
         let !_patOchildInhs = rule172 _lhsIchildInhs in
         let !_patOdefs = rule175 _lhsIdefs in
         let !(!_field',!_err1) = rule162 _lhsIchildInhs _lhsIcon _lhsInt arg_attr_ arg_field_ in
         let !_err2 = rule163 _field' _lhsIcon _lhsIdefs _lhsInt arg_attr_ arg_field_ in
         let !_patOforcedIrrefutables = rule176 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut48 _patIallAttributes _patIerrors _patIoutput) = inv_Pattern_s54 _patX54 (T_Pattern_vIn48 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule168 _lhsIcon _lhsInt _patIallAttributes arg_attr_ arg_field_ in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule164 _err1 _err2 _patIerrors in
         let !_output = rule165 _field' _patIoutput arg_attr_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule169 _lhsIcon _lhsIforcedIrrefutables _lhsInt _output arg_attr_ arg_field_ in
         let !__result_ = T_Pattern_vOut48 _lhsOallAttributes _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s54 v48
   {-# NOINLINE st58 #-}
   st58 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) !_patX58 -> let
      v56 :: T_Pattern_v56 
      v56 = \ !(T_Pattern_vIn56 ) -> (
         let !_def = rule166 arg_attr_ arg_field_ in
         let !(T_Pattern_vOut56 _patIdefsCollect _patX51) = inv_Pattern_s58 _patX58 (T_Pattern_vIn56 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule167 _def _patIdefsCollect in
         let !__st_ = st51 _lhsIcon _lhsInt _patX51
             !__result_ = T_Pattern_vOut56 _lhsOdefsCollect __st_
          in __result_ )
     in C_Pattern_s58 v56
   {-# NOINLINE rule162 #-}
   {-# LINE 110 "src-ag/Desugar.ag" #-}
   rule162 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) !attr_ !field_ ->
                                 {-# LINE 110 "src-ag/Desugar.ag" #-}
                                 maybeError field_ (UndefAttr _lhsInt _lhsIcon (Ident "<ANY>" (getPos field_)) attr_ True) $
                                   findField field_ attr_ _lhsIchildInhs
                                 {-# LINE 2470 "src-generated/Desugar.hs" #-}
   {-# NOINLINE rule163 #-}
   {-# LINE 112 "src-ag/Desugar.ag" #-}
   rule163 = \ !_field' ((!_lhsIcon) :: ConstructorIdent) ((!_lhsIdefs) :: Set (Identifier, Identifier)) ((!_lhsInt) :: NontermIdent) !attr_ !field_ ->
                   {-# LINE 112 "src-ag/Desugar.ag" #-}
                   if _field'     == field_
                   then Seq.empty
                   else if (_field'    , attr_) `Set.member` _lhsIdefs
                        then Seq.singleton $ DupRule _lhsInt _lhsIcon field_ attr_ _field'
                        else Seq.empty
                   {-# LINE 2480 "src-generated/Desugar.hs" #-}
   {-# NOINLINE rule164 #-}
   {-# LINE 117 "src-ag/Desugar.ag" #-}
   rule164 = \ !_err1 !_err2 ((!_patIerrors) :: Seq Error) ->
                     {-# LINE 117 "src-ag/Desugar.ag" #-}
                     _err1     Seq.>< _err2     Seq.>< _patIerrors
                     {-# LINE 2486 "src-generated/Desugar.hs" #-}
   {-# NOINLINE rule165 #-}
   {-# LINE 118 "src-ag/Desugar.ag" #-}
   rule165 = \ !_field' ((!_patIoutput) :: Pattern) !attr_ ->
                     {-# LINE 118 "src-ag/Desugar.ag" #-}
                     Alias _field'     attr_ _patIoutput
                     {-# LINE 2492 "src-generated/Desugar.hs" #-}
   {-# NOINLINE rule166 #-}
   {-# LINE 182 "src-ag/Desugar.ag" #-}
   rule166 = \ !attr_ !field_ ->
                  {-# LINE 182 "src-ag/Desugar.ag" #-}
                  Set.singleton (field_, attr_)
                  {-# LINE 2498 "src-generated/Desugar.hs" #-}
   {-# NOINLINE rule167 #-}
   {-# LINE 183 "src-ag/Desugar.ag" #-}
   rule167 = \ !_def ((!_patIdefsCollect) :: Set (Identifier, Identifier)) ->
                          {-# LINE 183 "src-ag/Desugar.ag" #-}
                          _def     `Set.union` _patIdefsCollect
                          {-# LINE 2504 "src-generated/Desugar.hs" #-}
   {-# NOINLINE rule168 #-}
   {-# LINE 200 "src-ag/Desugar.ag" #-}
   rule168 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) ((!_patIallAttributes) :: AttrMap) !attr_ !field_ ->
                            {-# LINE 200 "src-ag/Desugar.ag" #-}
                            (Map.singleton _lhsInt $ Map.singleton _lhsIcon $ Set.singleton (field_, attr_)) `mergeAttributes` _patIallAttributes
                            {-# LINE 2510 "src-generated/Desugar.hs" #-}
   {-# NOINLINE rule169 #-}
   {-# LINE 219 "src-ag/Desugar.ag" #-}
   rule169 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsIforcedIrrefutables) :: AttrMap) ((!_lhsInt) :: NontermIdent) !_output !attr_ !field_ ->
                     {-# LINE 219 "src-ag/Desugar.ag" #-}
                     if Set.member (field_, attr_) $ Map.findWithDefault Set.empty _lhsIcon $ Map.findWithDefault Map.empty _lhsInt $ _lhsIforcedIrrefutables
                     then Irrefutable _output
                     else _output
                     {-# LINE 2518 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule170 #-}
   rule170 = \ ((!_patIcopy) :: Pattern) !attr_ !field_ ->
     Alias field_ attr_ _patIcopy
   {-# NOINLINE[1] rule171 #-}
   rule171 = \ !_copy ->
     _copy
   {-# NOINLINE[1] rule172 #-}
   rule172 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule174 #-}
   rule174 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule175 #-}
   rule175 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule176 #-}
   rule176 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule177 #-}
   rule177 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
{-# NOINLINE sem_Pattern_Irrefutable #-}
sem_Pattern_Irrefutable :: T_Pattern  -> T_Pattern 
sem_Pattern_Irrefutable arg_pat_ = T_Pattern (return st18) where
   {-# NOINLINE st18 #-}
   !st18 = let
      k18 :: K_Pattern_s18  t -> t
      k18 K_Pattern_v9 = v9
      k18 K_Pattern_v27 = v27
      k18 K_Pattern_v31 = v31
      k18 K_Pattern_v41 = v41
      k18 K_Pattern_v46 = v46
      k18 K_Pattern_v55 = v55
      v9 :: T_Pattern_v9 
      v9 = \ !(T_Pattern_vIn9 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule178  () in
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_patOchildInhs = rule185 _lhsIchildInhs in
         let !_patOcon = rule187 _lhsIcon in
         let !_patOdefs = rule188 _lhsIdefs in
         let !_patOnt = rule190 _lhsInt in
         let !_patOforcedIrrefutables = rule189 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut27 _patIallAttributes _patIcopy _patIdefsCollect _patIerrors _patIoutput) = inv_Pattern_s18 _patX18 K_Pattern_v27 (T_Pattern_vIn27 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let !_copy = rule181 _patIcopy in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule183 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule179 _patIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule180 _patIerrors in
         let !_output = rule182 _patIoutput in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule184 _output in
         let !__result_ = T_Pattern_vOut9 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v27 :: T_Pattern_v27 
      v27 = \ !(T_Pattern_vIn27 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule178  () in
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_patOchildInhs = rule185 _lhsIchildInhs in
         let !_patOcon = rule187 _lhsIcon in
         let !_patOdefs = rule188 _lhsIdefs in
         let !_patOnt = rule190 _lhsInt in
         let !_patOforcedIrrefutables = rule189 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut27 _patIallAttributes _patIcopy _patIdefsCollect _patIerrors _patIoutput) = inv_Pattern_s18 _patX18 K_Pattern_v27 (T_Pattern_vIn27 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let !_copy = rule181 _patIcopy in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule183 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule179 _patIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule180 _patIerrors in
         let !_output = rule182 _patIoutput in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule184 _output in
         let !__result_ = T_Pattern_vOut27 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v31 :: T_Pattern_v31 
      v31 = \ !(T_Pattern_vIn31 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule178  () in
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !_patOchildInhs = rule185 _lhsIchildInhs in
         let !_patOcon = rule187 _lhsIcon in
         let !_patOdefs = rule188 _lhsIdefs in
         let !_patOnt = rule190 _lhsInt in
         let !_patOforcedIrrefutables = rule189 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut31 _patIallAttributes _patIdefsCollect _patIerrors _patIoutput) = inv_Pattern_s18 _patX18 K_Pattern_v31 (T_Pattern_vIn31 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule179 _patIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule180 _patIerrors in
         let !_output = rule182 _patIoutput in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule184 _output in
         let !__result_ = T_Pattern_vOut31 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v41 :: T_Pattern_v41 
      v41 = \ !(T_Pattern_vIn41 _lhsIcon _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule178  () in
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !(T_Pattern_vOut46 _patIdefsCollect _patX54) = inv_Pattern_s18 _patX18 K_Pattern_v46 (T_Pattern_vIn46 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule179 _patIdefsCollect in
         let !__st_ = st51 _lhsIcon _lhsInt _patX54
             !__result_ = T_Pattern_vOut41 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v46 :: T_Pattern_v46 
      v46 = \ !(T_Pattern_vIn46 ) -> (
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !(T_Pattern_vOut46 _patIdefsCollect _patX54) = inv_Pattern_s18 _patX18 K_Pattern_v46 (T_Pattern_vIn46 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule179 _patIdefsCollect in
         let !__st_ = st54 _patX54
             !__result_ = T_Pattern_vOut46 _lhsOdefsCollect __st_
          in __result_ )
      v55 :: T_Pattern_v55 
      v55 = \ !(T_Pattern_vIn55 _lhsIcon _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule178  () in
         let !__st_ = st58 _lhsIcon _lhsInt
             !__result_ = T_Pattern_vOut55 _lhsOallAttributes __st_
          in __result_ )
     in C_Pattern_s18 k18
   {-# NOINLINE st51 #-}
   st51 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) !_patX54 -> let
      v42 :: T_Pattern_v42 
      v42 = \ !(T_Pattern_vIn42 _lhsIchildInhs _lhsIdefs _lhsIforcedIrrefutables) -> (
         let !_patOcon = rule187 _lhsIcon in
         let !_patOnt = rule190 _lhsInt in
         let !_patOchildInhs = rule185 _lhsIchildInhs in
         let !_patOdefs = rule188 _lhsIdefs in
         let !_patOforcedIrrefutables = rule189 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut48 _patIallAttributes _patIerrors _patIoutput) = inv_Pattern_s54 _patX54 (T_Pattern_vIn48 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule180 _patIerrors in
         let !_output = rule182 _patIoutput in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule184 _output in
         let !__result_ = T_Pattern_vOut42 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s51 v42
   {-# NOINLINE st54 #-}
   st54 = \ !_patX54 -> let
      v48 :: T_Pattern_v48 
      v48 = \ !(T_Pattern_vIn48 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule178  () in
         let !_patOchildInhs = rule185 _lhsIchildInhs in
         let !_patOcon = rule187 _lhsIcon in
         let !_patOdefs = rule188 _lhsIdefs in
         let !_patOnt = rule190 _lhsInt in
         let !_patOforcedIrrefutables = rule189 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut48 _patIallAttributes _patIerrors _patIoutput) = inv_Pattern_s54 _patX54 (T_Pattern_vIn48 _patOchildInhs _patOcon _patOdefs _patOforcedIrrefutables _patOnt) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule180 _patIerrors in
         let !_output = rule182 _patIoutput in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule184 _output in
         let !__result_ = T_Pattern_vOut48 _lhsOallAttributes _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s54 v48
   {-# NOINLINE st58 #-}
   st58 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) -> let
      v56 :: T_Pattern_v56 
      v56 = \ !(T_Pattern_vIn56 ) -> (
         let !_patX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pat_)) in
         let !(T_Pattern_vOut46 _patIdefsCollect _patX54) = inv_Pattern_s18 _patX18 K_Pattern_v46 (T_Pattern_vIn46 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule179 _patIdefsCollect in
         let !__st_ = st51 _lhsIcon _lhsInt _patX54
             !__result_ = T_Pattern_vOut56 _lhsOdefsCollect __st_
          in __result_ )
     in C_Pattern_s58 v56
   {-# NOINLINE rule178 #-}
   {-# LINE 202 "src-ag/Desugar.ag" #-}
   rule178 = \  (_ :: ()) ->
                            {-# LINE 202 "src-ag/Desugar.ag" #-}
                            Map.empty
                            {-# LINE 2701 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule179 #-}
   rule179 = \ ((!_patIdefsCollect) :: Set (Identifier, Identifier)) ->
     _patIdefsCollect
   {-# NOINLINE[1] rule180 #-}
   rule180 = \ ((!_patIerrors) :: Seq Error) ->
     _patIerrors
   {-# NOINLINE[1] rule181 #-}
   rule181 = \ ((!_patIcopy) :: Pattern) ->
     Irrefutable _patIcopy
   {-# NOINLINE[1] rule182 #-}
   rule182 = \ ((!_patIoutput) :: Pattern) ->
     Irrefutable _patIoutput
   {-# NOINLINE[1] rule183 #-}
   rule183 = \ !_copy ->
     _copy
   {-# NOINLINE[1] rule184 #-}
   rule184 = \ !_output ->
     _output
   {-# NOINLINE[1] rule185 #-}
   rule185 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule187 #-}
   rule187 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule188 #-}
   rule188 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule189 #-}
   rule189 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule190 #-}
   rule190 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
{-# NOINLINE sem_Pattern_Underscore #-}
sem_Pattern_Underscore :: (Pos) -> T_Pattern 
sem_Pattern_Underscore !arg_pos_ = T_Pattern (return st18) where
   {-# NOINLINE st18 #-}
   !st18 = let
      k18 :: K_Pattern_s18  t -> t
      k18 K_Pattern_v9 = v9
      k18 K_Pattern_v27 = v27
      k18 K_Pattern_v31 = v31
      k18 K_Pattern_v41 = v41
      k18 K_Pattern_v46 = v46
      k18 K_Pattern_v55 = v55
      v9 :: T_Pattern_v9 
      v9 = \ !(T_Pattern_vIn9 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule191  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule192  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule193  () in
         let !_copy = rule194 arg_pos_ in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule196 _copy in
         let !_output = rule195 arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule197 _output in
         let !__result_ = T_Pattern_vOut9 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v27 :: T_Pattern_v27 
      v27 = \ !(T_Pattern_vIn27 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule191  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule192  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule193  () in
         let !_copy = rule194 arg_pos_ in
         let _lhsOcopy :: Pattern
             !_lhsOcopy = rule196 _copy in
         let !_output = rule195 arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule197 _output in
         let !__result_ = T_Pattern_vOut27 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v31 :: T_Pattern_v31 
      v31 = \ !(T_Pattern_vIn31 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule191  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule192  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule193  () in
         let !_output = rule195 arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule197 _output in
         let !__result_ = T_Pattern_vOut31 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v41 :: T_Pattern_v41 
      v41 = \ !(T_Pattern_vIn41 _lhsIcon _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule191  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule192  () in
         let !__st_ = st51  ()
             !__result_ = T_Pattern_vOut41 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v46 :: T_Pattern_v46 
      v46 = \ !(T_Pattern_vIn46 ) -> (
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule192  () in
         let !__st_ = st54  ()
             !__result_ = T_Pattern_vOut46 _lhsOdefsCollect __st_
          in __result_ )
      v55 :: T_Pattern_v55 
      v55 = \ !(T_Pattern_vIn55 _lhsIcon _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule191  () in
         let !__st_ = st58  ()
             !__result_ = T_Pattern_vOut55 _lhsOallAttributes __st_
          in __result_ )
     in C_Pattern_s18 k18
   {-# NOINLINE st51 #-}
   st51 = \  (_ :: ()) -> let
      v42 :: T_Pattern_v42 
      v42 = \ !(T_Pattern_vIn42 _lhsIchildInhs _lhsIdefs _lhsIforcedIrrefutables) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule193  () in
         let !_output = rule195 arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule197 _output in
         let !__result_ = T_Pattern_vOut42 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s51 v42
   {-# NOINLINE st54 #-}
   st54 = \  (_ :: ()) -> let
      v48 :: T_Pattern_v48 
      v48 = \ !(T_Pattern_vIn48 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule191  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule193  () in
         let !_output = rule195 arg_pos_ in
         let _lhsOoutput :: Pattern
             !_lhsOoutput = rule197 _output in
         let !__result_ = T_Pattern_vOut48 _lhsOallAttributes _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Pattern_s54 v48
   {-# NOINLINE st58 #-}
   st58 = \  (_ :: ()) -> let
      v56 :: T_Pattern_v56 
      v56 = \ !(T_Pattern_vIn56 ) -> (
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule192  () in
         let !__st_ = st51  ()
             !__result_ = T_Pattern_vOut56 _lhsOdefsCollect __st_
          in __result_ )
     in C_Pattern_s58 v56
   {-# NOINLINE[1] rule191 #-}
   rule191 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule192 #-}
   rule192 = \  (_ :: ()) ->
     Set.empty
   {-# NOINLINE[1] rule193 #-}
   rule193 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule194 #-}
   rule194 = \ !pos_ ->
     Underscore pos_
   {-# NOINLINE[1] rule195 #-}
   rule195 = \ !pos_ ->
     Underscore pos_
   {-# NOINLINE[1] rule196 #-}
   rule196 = \ !_copy ->
     _copy
   {-# NOINLINE[1] rule197 #-}
   rule197 = \ !_output ->
     _output

-- Patterns ----------------------------------------------------
-- wrapper
data Inh_Patterns  = Inh_Patterns { childInhs_Inh_Patterns :: !([(Identifier, Identifier)]), childSyns_Inh_Patterns :: !([(Identifier, Identifier)]), con_Inh_Patterns :: !(ConstructorIdent), defs_Inh_Patterns :: !(Set (Identifier, Identifier)), forcedIrrefutables_Inh_Patterns :: !(AttrMap), nt_Inh_Patterns :: !(NontermIdent) }
data Syn_Patterns  = Syn_Patterns { allAttributes_Syn_Patterns :: !(AttrMap), copy_Syn_Patterns :: !(Patterns), defsCollect_Syn_Patterns :: !(Set (Identifier, Identifier)), errors_Syn_Patterns :: !(Seq Error), output_Syn_Patterns :: !(Patterns) }
{-# INLINABLE wrap_Patterns #-}
wrap_Patterns :: T_Patterns  -> Inh_Patterns  -> (Syn_Patterns )
wrap_Patterns !(T_Patterns act) !(Inh_Patterns _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg10 = T_Patterns_vIn10 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt
        !(T_Patterns_vOut10 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput) <- return (inv_Patterns_s20 sem K_Patterns_v10 arg10)
        return (Syn_Patterns _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput)
   )

-- cata
{-# NOINLINE sem_Patterns #-}
sem_Patterns :: Patterns  -> T_Patterns 
sem_Patterns list = Prelude.foldr sem_Patterns_Cons sem_Patterns_Nil (Prelude.map sem_Pattern list)

-- semantic domain
newtype T_Patterns  = T_Patterns {
                                 attach_T_Patterns :: Identity (T_Patterns_s20 )
                                 }
data T_Patterns_s20  where C_Patterns_s20 :: {
                                             inv_Patterns_s20 :: !(forall t. K_Patterns_s20  t -> t)
                                             } -> T_Patterns_s20 
data T_Patterns_s21  = C_Patterns_s21
data T_Patterns_s41  = C_Patterns_s41
data T_Patterns_s49  = C_Patterns_s49
newtype T_Patterns_s53  = C_Patterns_s53 {
                                         inv_Patterns_s53 :: (T_Patterns_v47 )
                                         }
newtype T_Patterns_s56  = C_Patterns_s56 {
                                         inv_Patterns_s56 :: (T_Patterns_v52 )
                                         }
newtype T_Patterns_s59  = C_Patterns_s59 {
                                         inv_Patterns_s59 :: (T_Patterns_v58 )
                                         }
data K_Patterns_s20 k  where
   K_Patterns_v10 :: K_Patterns_s20  (T_Patterns_v10 )
   K_Patterns_v26 :: K_Patterns_s20  (T_Patterns_v26 )
   K_Patterns_v38 :: K_Patterns_s20  (T_Patterns_v38 )
   K_Patterns_v45 :: K_Patterns_s20  (T_Patterns_v45 )
   K_Patterns_v51 :: K_Patterns_s20  (T_Patterns_v51 )
   K_Patterns_v57 :: K_Patterns_s20  (T_Patterns_v57 )
type T_Patterns_v10  = (T_Patterns_vIn10 ) -> (T_Patterns_vOut10 )
data T_Patterns_vIn10  = T_Patterns_vIn10 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent)
data T_Patterns_vOut10  = T_Patterns_vOut10 !(AttrMap) !(Patterns) !(Set (Identifier, Identifier)) !(Seq Error) !(Patterns)
type T_Patterns_v26  = (T_Patterns_vIn26 ) -> (T_Patterns_vOut26 )
data T_Patterns_vIn26  = T_Patterns_vIn26 !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent)
data T_Patterns_vOut26  = T_Patterns_vOut26 !(AttrMap) !(Patterns) !(Set (Identifier, Identifier)) !(Seq Error) !(Patterns)
type T_Patterns_v38  = (T_Patterns_vIn38 ) -> (T_Patterns_vOut38 )
data T_Patterns_vIn38  = T_Patterns_vIn38 !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent)
data T_Patterns_vOut38  = T_Patterns_vOut38 !(AttrMap) !(Set (Identifier, Identifier)) !(Seq Error) !(Patterns)
type T_Patterns_v45  = (T_Patterns_vIn45 ) -> (T_Patterns_vOut45 )
data T_Patterns_vIn45  = T_Patterns_vIn45 !(ConstructorIdent) !(NontermIdent)
data T_Patterns_vOut45  = T_Patterns_vOut45 !(AttrMap) !(Set (Identifier, Identifier)) !(T_Patterns_s53 )
type T_Patterns_v47  = (T_Patterns_vIn47 ) -> (T_Patterns_vOut47 )
data T_Patterns_vIn47  = T_Patterns_vIn47 !([(Identifier, Identifier)]) !(Set (Identifier, Identifier)) !(AttrMap)
data T_Patterns_vOut47  = T_Patterns_vOut47 !(Seq Error) !(Patterns)
type T_Patterns_v51  = (T_Patterns_vIn51 ) -> (T_Patterns_vOut51 )
data T_Patterns_vIn51  = T_Patterns_vIn51 
data T_Patterns_vOut51  = T_Patterns_vOut51 !(Set (Identifier, Identifier)) !(T_Patterns_s56 )
type T_Patterns_v52  = (T_Patterns_vIn52 ) -> (T_Patterns_vOut52 )
data T_Patterns_vIn52  = T_Patterns_vIn52 !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent)
data T_Patterns_vOut52  = T_Patterns_vOut52 !(AttrMap) !(Seq Error) !(Patterns)
type T_Patterns_v57  = (T_Patterns_vIn57 ) -> (T_Patterns_vOut57 )
data T_Patterns_vIn57  = T_Patterns_vIn57 !(ConstructorIdent) !(NontermIdent)
data T_Patterns_vOut57  = T_Patterns_vOut57 !(AttrMap) !(T_Patterns_s59 )
type T_Patterns_v58  = (T_Patterns_vIn58 ) -> (T_Patterns_vOut58 )
data T_Patterns_vIn58  = T_Patterns_vIn58 
data T_Patterns_vOut58  = T_Patterns_vOut58 !(Set (Identifier, Identifier)) !(T_Patterns_s53 )
{-# NOINLINE sem_Patterns_Cons #-}
sem_Patterns_Cons :: T_Pattern  -> T_Patterns  -> T_Patterns 
sem_Patterns_Cons arg_hd_ arg_tl_ = T_Patterns (return st20) where
   {-# NOINLINE st20 #-}
   !st20 = let
      k20 :: K_Patterns_s20  t -> t
      k20 K_Patterns_v10 = v10
      k20 K_Patterns_v26 = v26
      k20 K_Patterns_v38 = v38
      k20 K_Patterns_v45 = v45
      k20 K_Patterns_v51 = v51
      k20 K_Patterns_v57 = v57
      v10 :: T_Patterns_v10 
      v10 = \ !(T_Patterns_vIn10 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_hdX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_hd_)) in
         let !_tlX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_tl_)) in
         let !_hdOcon = rule207 _lhsIcon in
         let !_hdOnt = rule210 _lhsInt in
         let !_tlOcon = rule213 _lhsIcon in
         let !_tlOnt = rule216 _lhsInt in
         let !_hdOchildInhs = rule205 _lhsIchildInhs in
         let !_hdOdefs = rule208 _lhsIdefs in
         let !_tlOchildInhs = rule211 _lhsIchildInhs in
         let !_tlOdefs = rule214 _lhsIdefs in
         let !_hdOforcedIrrefutables = rule209 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule215 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut27 _hdIallAttributes _hdIcopy _hdIdefsCollect _hdIerrors _hdIoutput) = inv_Pattern_s18 _hdX18 K_Pattern_v27 (T_Pattern_vIn27 _hdOchildInhs _hdOcon _hdOdefs _hdOforcedIrrefutables _hdOnt) in
         let !(T_Patterns_vOut26 _tlIallAttributes _tlIcopy _tlIdefsCollect _tlIerrors _tlIoutput) = inv_Patterns_s20 _tlX20 K_Patterns_v26 (T_Patterns_vIn26 _tlOchildInhs _tlOcon _tlOdefs _tlOforcedIrrefutables _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule198 _hdIallAttributes _tlIallAttributes in
         let !_copy = rule201 _hdIcopy _tlIcopy in
         let _lhsOcopy :: Patterns
             !_lhsOcopy = rule203 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule199 _hdIdefsCollect _tlIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule200 _hdIerrors _tlIerrors in
         let !_output = rule202 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule204 _output in
         let !__result_ = T_Patterns_vOut10 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v26 :: T_Patterns_v26 
      v26 = \ !(T_Patterns_vIn26 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_hdX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_hd_)) in
         let !_tlX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_tl_)) in
         let !_hdOcon = rule207 _lhsIcon in
         let !_hdOnt = rule210 _lhsInt in
         let !_tlOcon = rule213 _lhsIcon in
         let !_tlOnt = rule216 _lhsInt in
         let !_hdOchildInhs = rule205 _lhsIchildInhs in
         let !_hdOdefs = rule208 _lhsIdefs in
         let !_tlOchildInhs = rule211 _lhsIchildInhs in
         let !_tlOdefs = rule214 _lhsIdefs in
         let !_hdOforcedIrrefutables = rule209 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule215 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut27 _hdIallAttributes _hdIcopy _hdIdefsCollect _hdIerrors _hdIoutput) = inv_Pattern_s18 _hdX18 K_Pattern_v27 (T_Pattern_vIn27 _hdOchildInhs _hdOcon _hdOdefs _hdOforcedIrrefutables _hdOnt) in
         let !(T_Patterns_vOut26 _tlIallAttributes _tlIcopy _tlIdefsCollect _tlIerrors _tlIoutput) = inv_Patterns_s20 _tlX20 K_Patterns_v26 (T_Patterns_vIn26 _tlOchildInhs _tlOcon _tlOdefs _tlOforcedIrrefutables _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule198 _hdIallAttributes _tlIallAttributes in
         let !_copy = rule201 _hdIcopy _tlIcopy in
         let _lhsOcopy :: Patterns
             !_lhsOcopy = rule203 _copy in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule199 _hdIdefsCollect _tlIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule200 _hdIerrors _tlIerrors in
         let !_output = rule202 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule204 _output in
         let !__result_ = T_Patterns_vOut26 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v38 :: T_Patterns_v38 
      v38 = \ !(T_Patterns_vIn38 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_hdX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_hd_)) in
         let !_tlX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_tl_)) in
         let !_hdOcon = rule207 _lhsIcon in
         let !_hdOnt = rule210 _lhsInt in
         let !_tlOcon = rule213 _lhsIcon in
         let !_tlOnt = rule216 _lhsInt in
         let !_hdOchildInhs = rule205 _lhsIchildInhs in
         let !_hdOdefs = rule208 _lhsIdefs in
         let !_tlOchildInhs = rule211 _lhsIchildInhs in
         let !_tlOdefs = rule214 _lhsIdefs in
         let !_hdOforcedIrrefutables = rule209 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule215 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut31 _hdIallAttributes _hdIdefsCollect _hdIerrors _hdIoutput) = inv_Pattern_s18 _hdX18 K_Pattern_v31 (T_Pattern_vIn31 _hdOchildInhs _hdOcon _hdOdefs _hdOforcedIrrefutables _hdOnt) in
         let !(T_Patterns_vOut38 _tlIallAttributes _tlIdefsCollect _tlIerrors _tlIoutput) = inv_Patterns_s20 _tlX20 K_Patterns_v38 (T_Patterns_vIn38 _tlOchildInhs _tlOcon _tlOdefs _tlOforcedIrrefutables _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule198 _hdIallAttributes _tlIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule199 _hdIdefsCollect _tlIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule200 _hdIerrors _tlIerrors in
         let !_output = rule202 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule204 _output in
         let !__result_ = T_Patterns_vOut38 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v45 :: T_Patterns_v45 
      v45 = \ !(T_Patterns_vIn45 _lhsIcon _lhsInt) -> (
         let !_hdX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_hd_)) in
         let !_tlX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_tl_)) in
         let !_hdOcon = rule207 _lhsIcon in
         let !_hdOnt = rule210 _lhsInt in
         let !_tlOcon = rule213 _lhsIcon in
         let !_tlOnt = rule216 _lhsInt in
         let !(T_Pattern_vOut41 _hdIallAttributes _hdIdefsCollect _hdX51) = inv_Pattern_s18 _hdX18 K_Pattern_v41 (T_Pattern_vIn41 _hdOcon _hdOnt) in
         let !(T_Patterns_vOut45 _tlIallAttributes _tlIdefsCollect _tlX53) = inv_Patterns_s20 _tlX20 K_Patterns_v45 (T_Patterns_vIn45 _tlOcon _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule198 _hdIallAttributes _tlIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule199 _hdIdefsCollect _tlIdefsCollect in
         let !__st_ = st53 _hdX51 _tlX53
             !__result_ = T_Patterns_vOut45 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v51 :: T_Patterns_v51 
      v51 = \ !(T_Patterns_vIn51 ) -> (
         let !_hdX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_hd_)) in
         let !_tlX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_tl_)) in
         let !(T_Pattern_vOut46 _hdIdefsCollect _hdX54) = inv_Pattern_s18 _hdX18 K_Pattern_v46 (T_Pattern_vIn46 ) in
         let !(T_Patterns_vOut51 _tlIdefsCollect _tlX56) = inv_Patterns_s20 _tlX20 K_Patterns_v51 (T_Patterns_vIn51 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule199 _hdIdefsCollect _tlIdefsCollect in
         let !__st_ = st56 _hdX54 _tlX56
             !__result_ = T_Patterns_vOut51 _lhsOdefsCollect __st_
          in __result_ )
      v57 :: T_Patterns_v57 
      v57 = \ !(T_Patterns_vIn57 _lhsIcon _lhsInt) -> (
         let !_hdX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_hd_)) in
         let !_tlX20 = Control.Monad.Identity.runIdentity (attach_T_Patterns (arg_tl_)) in
         let !_hdOcon = rule207 _lhsIcon in
         let !_hdOnt = rule210 _lhsInt in
         let !_tlOcon = rule213 _lhsIcon in
         let !_tlOnt = rule216 _lhsInt in
         let !(T_Pattern_vOut55 _hdIallAttributes _hdX58) = inv_Pattern_s18 _hdX18 K_Pattern_v55 (T_Pattern_vIn55 _hdOcon _hdOnt) in
         let !(T_Patterns_vOut57 _tlIallAttributes _tlX59) = inv_Patterns_s20 _tlX20 K_Patterns_v57 (T_Patterns_vIn57 _tlOcon _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule198 _hdIallAttributes _tlIallAttributes in
         let !__st_ = st59 _hdX58 _tlX59
             !__result_ = T_Patterns_vOut57 _lhsOallAttributes __st_
          in __result_ )
     in C_Patterns_s20 k20
   {-# NOINLINE st53 #-}
   st53 = \ !_hdX51 !_tlX53 -> let
      v47 :: T_Patterns_v47 
      v47 = \ !(T_Patterns_vIn47 _lhsIchildInhs _lhsIdefs _lhsIforcedIrrefutables) -> (
         let !_hdOchildInhs = rule205 _lhsIchildInhs in
         let !_hdOdefs = rule208 _lhsIdefs in
         let !_tlOchildInhs = rule211 _lhsIchildInhs in
         let !_tlOdefs = rule214 _lhsIdefs in
         let !_hdOforcedIrrefutables = rule209 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule215 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut42 _hdIerrors _hdIoutput) = inv_Pattern_s51 _hdX51 (T_Pattern_vIn42 _hdOchildInhs _hdOdefs _hdOforcedIrrefutables) in
         let !(T_Patterns_vOut47 _tlIerrors _tlIoutput) = inv_Patterns_s53 _tlX53 (T_Patterns_vIn47 _tlOchildInhs _tlOdefs _tlOforcedIrrefutables) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule200 _hdIerrors _tlIerrors in
         let !_output = rule202 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule204 _output in
         let !__result_ = T_Patterns_vOut47 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Patterns_s53 v47
   {-# NOINLINE st56 #-}
   st56 = \ !_hdX54 !_tlX56 -> let
      v52 :: T_Patterns_v52 
      v52 = \ !(T_Patterns_vIn52 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let !_hdOcon = rule207 _lhsIcon in
         let !_hdOnt = rule210 _lhsInt in
         let !_tlOcon = rule213 _lhsIcon in
         let !_tlOnt = rule216 _lhsInt in
         let !_hdOchildInhs = rule205 _lhsIchildInhs in
         let !_hdOdefs = rule208 _lhsIdefs in
         let !_tlOchildInhs = rule211 _lhsIchildInhs in
         let !_tlOdefs = rule214 _lhsIdefs in
         let !_hdOforcedIrrefutables = rule209 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule215 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut48 _hdIallAttributes _hdIerrors _hdIoutput) = inv_Pattern_s54 _hdX54 (T_Pattern_vIn48 _hdOchildInhs _hdOcon _hdOdefs _hdOforcedIrrefutables _hdOnt) in
         let !(T_Patterns_vOut52 _tlIallAttributes _tlIerrors _tlIoutput) = inv_Patterns_s56 _tlX56 (T_Patterns_vIn52 _tlOchildInhs _tlOcon _tlOdefs _tlOforcedIrrefutables _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule198 _hdIallAttributes _tlIallAttributes in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule200 _hdIerrors _tlIerrors in
         let !_output = rule202 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule204 _output in
         let !__result_ = T_Patterns_vOut52 _lhsOallAttributes _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Patterns_s56 v52
   {-# NOINLINE st59 #-}
   st59 = \ !_hdX58 !_tlX59 -> let
      v58 :: T_Patterns_v58 
      v58 = \ !(T_Patterns_vIn58 ) -> (
         let !(T_Pattern_vOut56 _hdIdefsCollect _hdX51) = inv_Pattern_s58 _hdX58 (T_Pattern_vIn56 ) in
         let !(T_Patterns_vOut58 _tlIdefsCollect _tlX53) = inv_Patterns_s59 _tlX59 (T_Patterns_vIn58 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule199 _hdIdefsCollect _tlIdefsCollect in
         let !__st_ = st53 _hdX51 _tlX53
             !__result_ = T_Patterns_vOut58 _lhsOdefsCollect __st_
          in __result_ )
     in C_Patterns_s59 v58
   {-# NOINLINE[1] rule198 #-}
   rule198 = \ ((!_hdIallAttributes) :: AttrMap) ((!_tlIallAttributes) :: AttrMap) ->
     _hdIallAttributes `mergeAttributes` _tlIallAttributes
   {-# NOINLINE[1] rule199 #-}
   rule199 = \ ((!_hdIdefsCollect) :: Set (Identifier, Identifier)) ((!_tlIdefsCollect) :: Set (Identifier, Identifier)) ->
     _hdIdefsCollect `Set.union` _tlIdefsCollect
   {-# NOINLINE[1] rule200 #-}
   rule200 = \ ((!_hdIerrors) :: Seq Error) ((!_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# NOINLINE[1] rule201 #-}
   rule201 = \ ((!_hdIcopy) :: Pattern) ((!_tlIcopy) :: Patterns) ->
     (:) _hdIcopy _tlIcopy
   {-# NOINLINE[1] rule202 #-}
   rule202 = \ ((!_hdIoutput) :: Pattern) ((!_tlIoutput) :: Patterns) ->
     (:) _hdIoutput _tlIoutput
   {-# NOINLINE[1] rule203 #-}
   rule203 = \ !_copy ->
     _copy
   {-# NOINLINE[1] rule204 #-}
   rule204 = \ !_output ->
     _output
   {-# NOINLINE[1] rule205 #-}
   rule205 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule207 #-}
   rule207 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule208 #-}
   rule208 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule209 #-}
   rule209 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule210 #-}
   rule210 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule211 #-}
   rule211 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule213 #-}
   rule213 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule214 #-}
   rule214 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule215 #-}
   rule215 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule216 #-}
   rule216 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
{-# NOINLINE sem_Patterns_Nil #-}
sem_Patterns_Nil ::  T_Patterns 
sem_Patterns_Nil  = T_Patterns (return st20) where
   {-# NOINLINE st20 #-}
   !st20 = let
      k20 :: K_Patterns_s20  t -> t
      k20 K_Patterns_v10 = v10
      k20 K_Patterns_v26 = v26
      k20 K_Patterns_v38 = v38
      k20 K_Patterns_v45 = v45
      k20 K_Patterns_v51 = v51
      k20 K_Patterns_v57 = v57
      v10 :: T_Patterns_v10 
      v10 = \ !(T_Patterns_vIn10 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule217  () in
         let !_copy = rule220  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule218  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule219  () in
         let !_output = rule221  () in
         let _lhsOcopy :: Patterns
             !_lhsOcopy = rule222 _copy in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule223 _output in
         let !__result_ = T_Patterns_vOut10 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v26 :: T_Patterns_v26 
      v26 = \ !(T_Patterns_vIn26 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule217  () in
         let !_copy = rule220  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule218  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule219  () in
         let !_output = rule221  () in
         let _lhsOcopy :: Patterns
             !_lhsOcopy = rule222 _copy in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule223 _output in
         let !__result_ = T_Patterns_vOut26 _lhsOallAttributes _lhsOcopy _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v38 :: T_Patterns_v38 
      v38 = \ !(T_Patterns_vIn38 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule217  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule218  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule219  () in
         let !_output = rule221  () in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule223 _output in
         let !__result_ = T_Patterns_vOut38 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v45 :: T_Patterns_v45 
      v45 = \ !(T_Patterns_vIn45 _lhsIcon _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule217  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule218  () in
         let !__st_ = st53  ()
             !__result_ = T_Patterns_vOut45 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v51 :: T_Patterns_v51 
      v51 = \ !(T_Patterns_vIn51 ) -> (
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule218  () in
         let !__st_ = st56  ()
             !__result_ = T_Patterns_vOut51 _lhsOdefsCollect __st_
          in __result_ )
      v57 :: T_Patterns_v57 
      v57 = \ !(T_Patterns_vIn57 _lhsIcon _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule217  () in
         let !__st_ = st59  ()
             !__result_ = T_Patterns_vOut57 _lhsOallAttributes __st_
          in __result_ )
     in C_Patterns_s20 k20
   {-# NOINLINE st53 #-}
   st53 = \  (_ :: ()) -> let
      v47 :: T_Patterns_v47 
      v47 = \ !(T_Patterns_vIn47 _lhsIchildInhs _lhsIdefs _lhsIforcedIrrefutables) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule219  () in
         let !_output = rule221  () in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule223 _output in
         let !__result_ = T_Patterns_vOut47 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Patterns_s53 v47
   {-# NOINLINE st56 #-}
   st56 = \  (_ :: ()) -> let
      v52 :: T_Patterns_v52 
      v52 = \ !(T_Patterns_vIn52 _lhsIchildInhs _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule217  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule219  () in
         let !_output = rule221  () in
         let _lhsOoutput :: Patterns
             !_lhsOoutput = rule223 _output in
         let !__result_ = T_Patterns_vOut52 _lhsOallAttributes _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Patterns_s56 v52
   {-# NOINLINE st59 #-}
   st59 = \  (_ :: ()) -> let
      v58 :: T_Patterns_v58 
      v58 = \ !(T_Patterns_vIn58 ) -> (
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule218  () in
         let !__st_ = st53  ()
             !__result_ = T_Patterns_vOut58 _lhsOdefsCollect __st_
          in __result_ )
     in C_Patterns_s59 v58
   {-# NOINLINE[1] rule217 #-}
   rule217 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule218 #-}
   rule218 = \  (_ :: ()) ->
     Set.empty
   {-# NOINLINE[1] rule219 #-}
   rule219 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule220 #-}
   rule220 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule221 #-}
   rule221 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule222 #-}
   rule222 = \ !_copy ->
     _copy
   {-# NOINLINE[1] rule223 #-}
   rule223 = \ !_output ->
     _output

-- Production --------------------------------------------------
-- wrapper
data Inh_Production  = Inh_Production { augmentsIn_Inh_Production :: !(Map ConstructorIdent (Map Identifier [Expression])), forcedIrrefutables_Inh_Production :: !(AttrMap), inhMap_Inh_Production :: !(Map Identifier Attributes), mainName_Inh_Production :: !(String), nt_Inh_Production :: !(NontermIdent), options_Inh_Production :: !(Options), synMap_Inh_Production :: !(Map Identifier Attributes) }
data Syn_Production  = Syn_Production { allAttributes_Syn_Production :: !(AttrMap), augmentsOut_Syn_Production :: !(Map ConstructorIdent (Map Identifier [Expression])), errors_Syn_Production :: !(Seq Error), output_Syn_Production :: !(Production) }
{-# INLINABLE wrap_Production #-}
wrap_Production :: T_Production  -> Inh_Production  -> (Syn_Production )
wrap_Production !(T_Production act) !(Inh_Production _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsInt _lhsIoptions _lhsIsynMap) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg11 = T_Production_vIn11 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsInt _lhsIoptions _lhsIsynMap
        !(T_Production_vOut11 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput) <- return (inv_Production_s22 sem K_Production_v11 arg11)
        return (Syn_Production _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput)
   )

-- cata
{-# INLINE sem_Production #-}
sem_Production :: Production  -> T_Production 
sem_Production ( Production !con_ !params_ !constraints_ children_ rules_ typeSigs_ !macro_ ) = sem_Production_Production con_ params_ constraints_ ( sem_Children children_ ) ( sem_Rules rules_ ) ( sem_TypeSigs typeSigs_ ) macro_

-- semantic domain
newtype T_Production  = T_Production {
                                     attach_T_Production :: Identity (T_Production_s22 )
                                     }
data T_Production_s22  where C_Production_s22 :: {
                                                 inv_Production_s22 :: !(forall t. K_Production_s22  t -> t)
                                                 } -> T_Production_s22 
data T_Production_s23  = C_Production_s23
data T_Production_s44  = C_Production_s44
newtype T_Production_s52  = C_Production_s52 {
                                             inv_Production_s52 :: (T_Production_v44 )
                                             }
data K_Production_s22 k  where
   K_Production_v11 :: K_Production_s22  (T_Production_v11 )
   K_Production_v30 :: K_Production_s22  (T_Production_v30 )
   K_Production_v43 :: K_Production_s22  (T_Production_v43 )
type T_Production_v11  = (T_Production_vIn11 ) -> (T_Production_vOut11 )
data T_Production_vIn11  = T_Production_vIn11 !(Map ConstructorIdent (Map Identifier [Expression])) !(AttrMap) !(Map Identifier Attributes) !(String) !(NontermIdent) !(Options) !(Map Identifier Attributes)
data T_Production_vOut11  = T_Production_vOut11 !(AttrMap) !(Map ConstructorIdent (Map Identifier [Expression])) !(Seq Error) !(Production)
type T_Production_v30  = (T_Production_vIn30 ) -> (T_Production_vOut30 )
data T_Production_vIn30  = T_Production_vIn30 !(Map ConstructorIdent (Map Identifier [Expression])) !(AttrMap) !(Map Identifier Attributes) !(NontermIdent) !(Options) !(Map Identifier Attributes)
data T_Production_vOut30  = T_Production_vOut30 !(AttrMap) !(Map ConstructorIdent (Map Identifier [Expression])) !(Seq Error) !(Production)
type T_Production_v43  = (T_Production_vIn43 ) -> (T_Production_vOut43 )
data T_Production_vIn43  = T_Production_vIn43 !(NontermIdent)
data T_Production_vOut43  = T_Production_vOut43 !(AttrMap) !(T_Production_s52 )
type T_Production_v44  = (T_Production_vIn44 ) -> (T_Production_vOut44 )
data T_Production_vIn44  = T_Production_vIn44 !(Map ConstructorIdent (Map Identifier [Expression])) !(AttrMap) !(Map Identifier Attributes) !(Options) !(Map Identifier Attributes)
data T_Production_vOut44  = T_Production_vOut44 !(Map ConstructorIdent (Map Identifier [Expression])) !(Seq Error) !(Production)
{-# NOINLINE sem_Production_Production #-}
sem_Production_Production :: (ConstructorIdent) -> ([Identifier]) -> ([Type]) -> T_Children  -> T_Rules  -> T_TypeSigs  -> (MaybeMacro) -> T_Production 
sem_Production_Production !arg_con_ !arg_params_ !arg_constraints_ arg_children_ arg_rules_ arg_typeSigs_ !arg_macro_ = T_Production (return st22) where
   {-# NOINLINE st22 #-}
   !st22 = let
      k22 :: K_Production_s22  t -> t
      k22 K_Production_v11 = v11
      k22 K_Production_v30 = v30
      k22 K_Production_v43 = v43
      v11 :: T_Production_v11 
      v11 = \ !(T_Production_vIn11 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsInt _lhsIoptions _lhsIsynMap) -> (
         let !_rulesX28 = Control.Monad.Identity.runIdentity (attach_T_Rules (arg_rules_)) in
         let !_childrenX2 = Control.Monad.Identity.runIdentity (attach_T_Children (arg_children_)) in
         let !_typeSigsX32 = Control.Monad.Identity.runIdentity (attach_T_TypeSigs (arg_typeSigs_)) in
         let !_rulesOcon = rule224 arg_con_ in
         let !_rulesOnt = rule241 _lhsInt in
         let !_childrenOinhMap = rule234 _lhsIinhMap in
         let !_childrenOsynMap = rule237 _lhsIsynMap in
         let !_augmentsIn = rule226 _lhsIaugmentsIn arg_con_ in
         let !_rulesOoptions = rule242 _lhsIoptions in
         let !_rulesOforcedIrrefutables = rule240 _lhsIforcedIrrefutables in
         let !(T_Children_vOut18 _childrenIchildInhs _childrenIchildSyns _childrenIoutput) = inv_Children_s2 _childrenX2 K_Children_v18 (T_Children_vIn18 _childrenOinhMap _childrenOsynMap) in
         let !(T_Rules_vOut28 _rulesIallAttributes _rulesIdefsCollect _rulesX43) = inv_Rules_s28 _rulesX28 K_Rules_v28 (T_Rules_vIn28 _rulesOcon _rulesOnt) in
         let !(T_TypeSigs_vOut16 _typeSigsIoutput) = inv_TypeSigs_s32 _typeSigsX32 (T_TypeSigs_vIn16 ) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule230 _rulesIallAttributes in
         let !(!_augmentErrs,!_augmentsOut1) = rule228 _augmentsIn _childrenIchildInhs _childrenIchildSyns _lhsInt _lhsIoptions arg_con_ in
         let !_augmentsOut = rule227 _augmentsOut1 arg_con_ in
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule231 _augmentsOut in
         let !_rulesOchildInhs = rule238 _childrenIchildInhs in
         let !_rulesOchildSyns = rule239 _childrenIchildSyns in
         let !_rulesOdefs = rule225 _rulesIdefsCollect in
         let !(T_Rules_vOut29 _rulesIerrors _rulesIoutput) = inv_Rules_s43 _rulesX43 (T_Rules_vIn29 _rulesOchildInhs _rulesOchildSyns _rulesOdefs _rulesOforcedIrrefutables _rulesOoptions) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule229 _augmentErrs _rulesIerrors in
         let !_output = rule232 _childrenIoutput _rulesIoutput _typeSigsIoutput arg_con_ arg_constraints_ arg_macro_ arg_params_ in
         let _lhsOoutput :: Production
             !_lhsOoutput = rule233 _output in
         let !__result_ = T_Production_vOut11 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
      v30 :: T_Production_v30 
      v30 = \ !(T_Production_vIn30 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsInt _lhsIoptions _lhsIsynMap) -> (
         let !_rulesX28 = Control.Monad.Identity.runIdentity (attach_T_Rules (arg_rules_)) in
         let !_childrenX2 = Control.Monad.Identity.runIdentity (attach_T_Children (arg_children_)) in
         let !_typeSigsX32 = Control.Monad.Identity.runIdentity (attach_T_TypeSigs (arg_typeSigs_)) in
         let !_rulesOcon = rule224 arg_con_ in
         let !_rulesOnt = rule241 _lhsInt in
         let !_childrenOinhMap = rule234 _lhsIinhMap in
         let !_childrenOsynMap = rule237 _lhsIsynMap in
         let !_augmentsIn = rule226 _lhsIaugmentsIn arg_con_ in
         let !_rulesOoptions = rule242 _lhsIoptions in
         let !_rulesOforcedIrrefutables = rule240 _lhsIforcedIrrefutables in
         let !(T_Children_vOut18 _childrenIchildInhs _childrenIchildSyns _childrenIoutput) = inv_Children_s2 _childrenX2 K_Children_v18 (T_Children_vIn18 _childrenOinhMap _childrenOsynMap) in
         let !(T_Rules_vOut28 _rulesIallAttributes _rulesIdefsCollect _rulesX43) = inv_Rules_s28 _rulesX28 K_Rules_v28 (T_Rules_vIn28 _rulesOcon _rulesOnt) in
         let !(T_TypeSigs_vOut16 _typeSigsIoutput) = inv_TypeSigs_s32 _typeSigsX32 (T_TypeSigs_vIn16 ) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule230 _rulesIallAttributes in
         let !(!_augmentErrs,!_augmentsOut1) = rule228 _augmentsIn _childrenIchildInhs _childrenIchildSyns _lhsInt _lhsIoptions arg_con_ in
         let !_augmentsOut = rule227 _augmentsOut1 arg_con_ in
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule231 _augmentsOut in
         let !_rulesOchildInhs = rule238 _childrenIchildInhs in
         let !_rulesOchildSyns = rule239 _childrenIchildSyns in
         let !_rulesOdefs = rule225 _rulesIdefsCollect in
         let !(T_Rules_vOut29 _rulesIerrors _rulesIoutput) = inv_Rules_s43 _rulesX43 (T_Rules_vIn29 _rulesOchildInhs _rulesOchildSyns _rulesOdefs _rulesOforcedIrrefutables _rulesOoptions) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule229 _augmentErrs _rulesIerrors in
         let !_output = rule232 _childrenIoutput _rulesIoutput _typeSigsIoutput arg_con_ arg_constraints_ arg_macro_ arg_params_ in
         let _lhsOoutput :: Production
             !_lhsOoutput = rule233 _output in
         let !__result_ = T_Production_vOut30 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
      v43 :: T_Production_v43 
      v43 = \ !(T_Production_vIn43 _lhsInt) -> (
         let !_rulesX28 = Control.Monad.Identity.runIdentity (attach_T_Rules (arg_rules_)) in
         let !_rulesOcon = rule224 arg_con_ in
         let !_rulesOnt = rule241 _lhsInt in
         let !(T_Rules_vOut49 _rulesIallAttributes _rulesX55) = inv_Rules_s28 _rulesX28 K_Rules_v49 (T_Rules_vIn49 _rulesOcon _rulesOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule230 _rulesIallAttributes in
         let !__st_ = st52 _lhsInt _rulesX55
             !__result_ = T_Production_vOut43 _lhsOallAttributes __st_
          in __result_ )
     in C_Production_s22 k22
   {-# NOINLINE st52 #-}
   st52 = \ ((!_lhsInt) :: NontermIdent) !_rulesX55 -> let
      v44 :: T_Production_v44 
      v44 = \ !(T_Production_vIn44 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsIoptions _lhsIsynMap) -> (
         let !_childrenX2 = Control.Monad.Identity.runIdentity (attach_T_Children (arg_children_)) in
         let !_typeSigsX32 = Control.Monad.Identity.runIdentity (attach_T_TypeSigs (arg_typeSigs_)) in
         let !_childrenOinhMap = rule234 _lhsIinhMap in
         let !_childrenOsynMap = rule237 _lhsIsynMap in
         let !_augmentsIn = rule226 _lhsIaugmentsIn arg_con_ in
         let !_rulesOoptions = rule242 _lhsIoptions in
         let !_rulesOforcedIrrefutables = rule240 _lhsIforcedIrrefutables in
         let !(T_Children_vOut18 _childrenIchildInhs _childrenIchildSyns _childrenIoutput) = inv_Children_s2 _childrenX2 K_Children_v18 (T_Children_vIn18 _childrenOinhMap _childrenOsynMap) in
         let !(T_Rules_vOut50 _rulesIdefsCollect _rulesX43) = inv_Rules_s55 _rulesX55 (T_Rules_vIn50 ) in
         let !(T_TypeSigs_vOut16 _typeSigsIoutput) = inv_TypeSigs_s32 _typeSigsX32 (T_TypeSigs_vIn16 ) in
         let !(!_augmentErrs,!_augmentsOut1) = rule228 _augmentsIn _childrenIchildInhs _childrenIchildSyns _lhsInt _lhsIoptions arg_con_ in
         let !_augmentsOut = rule227 _augmentsOut1 arg_con_ in
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule231 _augmentsOut in
         let !_rulesOchildInhs = rule238 _childrenIchildInhs in
         let !_rulesOchildSyns = rule239 _childrenIchildSyns in
         let !_rulesOdefs = rule225 _rulesIdefsCollect in
         let !(T_Rules_vOut29 _rulesIerrors _rulesIoutput) = inv_Rules_s43 _rulesX43 (T_Rules_vIn29 _rulesOchildInhs _rulesOchildSyns _rulesOdefs _rulesOforcedIrrefutables _rulesOoptions) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule229 _augmentErrs _rulesIerrors in
         let !_output = rule232 _childrenIoutput _rulesIoutput _typeSigsIoutput arg_con_ arg_constraints_ arg_macro_ arg_params_ in
         let _lhsOoutput :: Production
             !_lhsOoutput = rule233 _output in
         let !__result_ = T_Production_vOut44 _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Production_s52 v44
   {-# NOINLINE[1] rule224 #-}
   {-# LINE 161 "src-ag/Desugar.ag" #-}
   rule224 = \ !con_ ->
                    {-# LINE 161 "src-ag/Desugar.ag" #-}
                    con_
                    {-# LINE 3504 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule225 #-}
   {-# LINE 188 "src-ag/Desugar.ag" #-}
   rule225 = \ ((!_rulesIdefsCollect) :: Set (Identifier, Identifier)) ->
                     {-# LINE 188 "src-ag/Desugar.ag" #-}
                     _rulesIdefsCollect
                     {-# LINE 3510 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule226 #-}
   {-# LINE 244 "src-ag/Desugar.ag" #-}
   rule226 = \ ((!_lhsIaugmentsIn) :: Map ConstructorIdent (Map Identifier [Expression])) !con_ ->
                         {-# LINE 244 "src-ag/Desugar.ag" #-}
                         Map.findWithDefault Map.empty con_ _lhsIaugmentsIn
                         {-# LINE 3516 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule227 #-}
   {-# LINE 245 "src-ag/Desugar.ag" #-}
   rule227 = \ !_augmentsOut1 !con_ ->
                          {-# LINE 245 "src-ag/Desugar.ag" #-}
                          Map.singleton con_ _augmentsOut1
                          {-# LINE 3522 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule228 #-}
   {-# LINE 247 "src-ag/Desugar.ag" #-}
   rule228 = \ !_augmentsIn ((!_childrenIchildInhs) :: [(Identifier, Identifier)]) ((!_childrenIchildSyns) :: [(Identifier, Identifier)]) ((!_lhsInt) :: NontermIdent) ((!_lhsIoptions) :: Options) !con_ ->
                                              {-# LINE 247 "src-ag/Desugar.ag" #-}
                                              Map.mapAccum (desugarExprs _lhsIoptions _lhsInt con_ _childrenIchildInhs _childrenIchildSyns) Seq.empty _augmentsIn
                                              {-# LINE 3528 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule229 #-}
   {-# LINE 283 "src-ag/Desugar.ag" #-}
   rule229 = \ !_augmentErrs ((!_rulesIerrors) :: Seq Error) ->
                     {-# LINE 283 "src-ag/Desugar.ag" #-}
                     _rulesIerrors Seq.>< _augmentErrs
                     {-# LINE 3534 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule230 #-}
   rule230 = \ ((!_rulesIallAttributes) :: AttrMap) ->
     _rulesIallAttributes
   {-# NOINLINE[1] rule231 #-}
   rule231 = \ !_augmentsOut ->
     _augmentsOut
   {-# NOINLINE[1] rule232 #-}
   rule232 = \ ((!_childrenIoutput) :: Children) ((!_rulesIoutput) :: Rules) ((!_typeSigsIoutput) :: TypeSigs) !con_ !constraints_ !macro_ !params_ ->
     Production con_ params_ constraints_ _childrenIoutput _rulesIoutput _typeSigsIoutput macro_
   {-# NOINLINE[1] rule233 #-}
   rule233 = \ !_output ->
     _output
   {-# NOINLINE[1] rule234 #-}
   rule234 = \ ((!_lhsIinhMap) :: Map Identifier Attributes) ->
     _lhsIinhMap
   {-# NOINLINE[1] rule237 #-}
   rule237 = \ ((!_lhsIsynMap) :: Map Identifier Attributes) ->
     _lhsIsynMap
   {-# NOINLINE[1] rule238 #-}
   rule238 = \ ((!_childrenIchildInhs) :: [(Identifier, Identifier)]) ->
     _childrenIchildInhs
   {-# NOINLINE[1] rule239 #-}
   rule239 = \ ((!_childrenIchildSyns) :: [(Identifier, Identifier)]) ->
     _childrenIchildSyns
   {-# NOINLINE[1] rule240 #-}
   rule240 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule241 #-}
   rule241 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule242 #-}
   rule242 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions

-- Productions -------------------------------------------------
-- wrapper
data Inh_Productions  = Inh_Productions { augmentsIn_Inh_Productions :: !(Map ConstructorIdent (Map Identifier [Expression])), forcedIrrefutables_Inh_Productions :: !(AttrMap), inhMap_Inh_Productions :: !(Map Identifier Attributes), mainName_Inh_Productions :: !(String), nt_Inh_Productions :: !(NontermIdent), options_Inh_Productions :: !(Options), synMap_Inh_Productions :: !(Map Identifier Attributes) }
data Syn_Productions  = Syn_Productions { allAttributes_Syn_Productions :: !(AttrMap), augmentsOut_Syn_Productions :: !(Map ConstructorIdent (Map Identifier [Expression])), errors_Syn_Productions :: !(Seq Error), output_Syn_Productions :: !(Productions) }
{-# INLINABLE wrap_Productions #-}
wrap_Productions :: T_Productions  -> Inh_Productions  -> (Syn_Productions )
wrap_Productions !(T_Productions act) !(Inh_Productions _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsInt _lhsIoptions _lhsIsynMap) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg12 = T_Productions_vIn12 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsInt _lhsIoptions _lhsIsynMap
        !(T_Productions_vOut12 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput) <- return (inv_Productions_s24 sem K_Productions_v12 arg12)
        return (Syn_Productions _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput)
   )

-- cata
{-# NOINLINE sem_Productions #-}
sem_Productions :: Productions  -> T_Productions 
sem_Productions list = Prelude.foldr sem_Productions_Cons sem_Productions_Nil (Prelude.map sem_Production list)

-- semantic domain
newtype T_Productions  = T_Productions {
                                       attach_T_Productions :: Identity (T_Productions_s24 )
                                       }
data T_Productions_s24  where C_Productions_s24 :: {
                                                   inv_Productions_s24 :: !(forall t. K_Productions_s24  t -> t)
                                                   } -> T_Productions_s24 
data T_Productions_s25  = C_Productions_s25
data T_Productions_s40  = C_Productions_s40
newtype T_Productions_s50  = C_Productions_s50 {
                                               inv_Productions_s50 :: (T_Productions_v40 )
                                               }
data K_Productions_s24 k  where
   K_Productions_v12 :: K_Productions_s24  (T_Productions_v12 )
   K_Productions_v25 :: K_Productions_s24  (T_Productions_v25 )
   K_Productions_v39 :: K_Productions_s24  (T_Productions_v39 )
type T_Productions_v12  = (T_Productions_vIn12 ) -> (T_Productions_vOut12 )
data T_Productions_vIn12  = T_Productions_vIn12 !(Map ConstructorIdent (Map Identifier [Expression])) !(AttrMap) !(Map Identifier Attributes) !(String) !(NontermIdent) !(Options) !(Map Identifier Attributes)
data T_Productions_vOut12  = T_Productions_vOut12 !(AttrMap) !(Map ConstructorIdent (Map Identifier [Expression])) !(Seq Error) !(Productions)
type T_Productions_v25  = (T_Productions_vIn25 ) -> (T_Productions_vOut25 )
data T_Productions_vIn25  = T_Productions_vIn25 !(Map ConstructorIdent (Map Identifier [Expression])) !(AttrMap) !(Map Identifier Attributes) !(NontermIdent) !(Options) !(Map Identifier Attributes)
data T_Productions_vOut25  = T_Productions_vOut25 !(AttrMap) !(Map ConstructorIdent (Map Identifier [Expression])) !(Seq Error) !(Productions)
type T_Productions_v39  = (T_Productions_vIn39 ) -> (T_Productions_vOut39 )
data T_Productions_vIn39  = T_Productions_vIn39 !(NontermIdent)
data T_Productions_vOut39  = T_Productions_vOut39 !(AttrMap) !(T_Productions_s50 )
type T_Productions_v40  = (T_Productions_vIn40 ) -> (T_Productions_vOut40 )
data T_Productions_vIn40  = T_Productions_vIn40 !(Map ConstructorIdent (Map Identifier [Expression])) !(AttrMap) !(Map Identifier Attributes) !(Options) !(Map Identifier Attributes)
data T_Productions_vOut40  = T_Productions_vOut40 !(Map ConstructorIdent (Map Identifier [Expression])) !(Seq Error) !(Productions)
{-# NOINLINE sem_Productions_Cons #-}
sem_Productions_Cons :: T_Production  -> T_Productions  -> T_Productions 
sem_Productions_Cons arg_hd_ arg_tl_ = T_Productions (return st24) where
   {-# NOINLINE st24 #-}
   !st24 = let
      k24 :: K_Productions_s24  t -> t
      k24 K_Productions_v12 = v12
      k24 K_Productions_v25 = v25
      k24 K_Productions_v39 = v39
      v12 :: T_Productions_v12 
      v12 = \ !(T_Productions_vIn12 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsInt _lhsIoptions _lhsIsynMap) -> (
         let !_hdX22 = Control.Monad.Identity.runIdentity (attach_T_Production (arg_hd_)) in
         let !_tlX24 = Control.Monad.Identity.runIdentity (attach_T_Productions (arg_tl_)) in
         let !_hdOnt = rule252 _lhsInt in
         let !_tlOnt = rule259 _lhsInt in
         let !_hdOaugmentsIn = rule248 _lhsIaugmentsIn in
         let !_hdOinhMap = rule250 _lhsIinhMap in
         let !_hdOoptions = rule253 _lhsIoptions in
         let !_hdOsynMap = rule254 _lhsIsynMap in
         let !_tlOaugmentsIn = rule255 _lhsIaugmentsIn in
         let !_tlOinhMap = rule257 _lhsIinhMap in
         let !_tlOoptions = rule260 _lhsIoptions in
         let !_tlOsynMap = rule261 _lhsIsynMap in
         let !_hdOforcedIrrefutables = rule249 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule256 _lhsIforcedIrrefutables in
         let !(T_Production_vOut30 _hdIallAttributes _hdIaugmentsOut _hdIerrors _hdIoutput) = inv_Production_s22 _hdX22 K_Production_v30 (T_Production_vIn30 _hdOaugmentsIn _hdOforcedIrrefutables _hdOinhMap _hdOnt _hdOoptions _hdOsynMap) in
         let !(T_Productions_vOut25 _tlIallAttributes _tlIaugmentsOut _tlIerrors _tlIoutput) = inv_Productions_s24 _tlX24 K_Productions_v25 (T_Productions_vIn25 _tlOaugmentsIn _tlOforcedIrrefutables _tlOinhMap _tlOnt _tlOoptions _tlOsynMap) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule243 _hdIallAttributes _tlIallAttributes in
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule244 _hdIaugmentsOut _tlIaugmentsOut in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule245 _hdIerrors _tlIerrors in
         let !_output = rule246 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Productions
             !_lhsOoutput = rule247 _output in
         let !__result_ = T_Productions_vOut12 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
      v25 :: T_Productions_v25 
      v25 = \ !(T_Productions_vIn25 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsInt _lhsIoptions _lhsIsynMap) -> (
         let !_hdX22 = Control.Monad.Identity.runIdentity (attach_T_Production (arg_hd_)) in
         let !_tlX24 = Control.Monad.Identity.runIdentity (attach_T_Productions (arg_tl_)) in
         let !_hdOnt = rule252 _lhsInt in
         let !_tlOnt = rule259 _lhsInt in
         let !_hdOaugmentsIn = rule248 _lhsIaugmentsIn in
         let !_hdOinhMap = rule250 _lhsIinhMap in
         let !_hdOoptions = rule253 _lhsIoptions in
         let !_hdOsynMap = rule254 _lhsIsynMap in
         let !_tlOaugmentsIn = rule255 _lhsIaugmentsIn in
         let !_tlOinhMap = rule257 _lhsIinhMap in
         let !_tlOoptions = rule260 _lhsIoptions in
         let !_tlOsynMap = rule261 _lhsIsynMap in
         let !_hdOforcedIrrefutables = rule249 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule256 _lhsIforcedIrrefutables in
         let !(T_Production_vOut30 _hdIallAttributes _hdIaugmentsOut _hdIerrors _hdIoutput) = inv_Production_s22 _hdX22 K_Production_v30 (T_Production_vIn30 _hdOaugmentsIn _hdOforcedIrrefutables _hdOinhMap _hdOnt _hdOoptions _hdOsynMap) in
         let !(T_Productions_vOut25 _tlIallAttributes _tlIaugmentsOut _tlIerrors _tlIoutput) = inv_Productions_s24 _tlX24 K_Productions_v25 (T_Productions_vIn25 _tlOaugmentsIn _tlOforcedIrrefutables _tlOinhMap _tlOnt _tlOoptions _tlOsynMap) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule243 _hdIallAttributes _tlIallAttributes in
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule244 _hdIaugmentsOut _tlIaugmentsOut in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule245 _hdIerrors _tlIerrors in
         let !_output = rule246 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Productions
             !_lhsOoutput = rule247 _output in
         let !__result_ = T_Productions_vOut25 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
      v39 :: T_Productions_v39 
      v39 = \ !(T_Productions_vIn39 _lhsInt) -> (
         let !_hdX22 = Control.Monad.Identity.runIdentity (attach_T_Production (arg_hd_)) in
         let !_tlX24 = Control.Monad.Identity.runIdentity (attach_T_Productions (arg_tl_)) in
         let !_hdOnt = rule252 _lhsInt in
         let !_tlOnt = rule259 _lhsInt in
         let !(T_Production_vOut43 _hdIallAttributes _hdX52) = inv_Production_s22 _hdX22 K_Production_v43 (T_Production_vIn43 _hdOnt) in
         let !(T_Productions_vOut39 _tlIallAttributes _tlX50) = inv_Productions_s24 _tlX24 K_Productions_v39 (T_Productions_vIn39 _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule243 _hdIallAttributes _tlIallAttributes in
         let !__st_ = st50 _hdX52 _tlX50
             !__result_ = T_Productions_vOut39 _lhsOallAttributes __st_
          in __result_ )
     in C_Productions_s24 k24
   {-# NOINLINE st50 #-}
   st50 = \ !_hdX52 !_tlX50 -> let
      v40 :: T_Productions_v40 
      v40 = \ !(T_Productions_vIn40 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsIoptions _lhsIsynMap) -> (
         let !_hdOaugmentsIn = rule248 _lhsIaugmentsIn in
         let !_hdOinhMap = rule250 _lhsIinhMap in
         let !_hdOoptions = rule253 _lhsIoptions in
         let !_hdOsynMap = rule254 _lhsIsynMap in
         let !_tlOaugmentsIn = rule255 _lhsIaugmentsIn in
         let !_tlOinhMap = rule257 _lhsIinhMap in
         let !_tlOoptions = rule260 _lhsIoptions in
         let !_tlOsynMap = rule261 _lhsIsynMap in
         let !_hdOforcedIrrefutables = rule249 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule256 _lhsIforcedIrrefutables in
         let !(T_Production_vOut44 _hdIaugmentsOut _hdIerrors _hdIoutput) = inv_Production_s52 _hdX52 (T_Production_vIn44 _hdOaugmentsIn _hdOforcedIrrefutables _hdOinhMap _hdOoptions _hdOsynMap) in
         let !(T_Productions_vOut40 _tlIaugmentsOut _tlIerrors _tlIoutput) = inv_Productions_s50 _tlX50 (T_Productions_vIn40 _tlOaugmentsIn _tlOforcedIrrefutables _tlOinhMap _tlOoptions _tlOsynMap) in
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule244 _hdIaugmentsOut _tlIaugmentsOut in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule245 _hdIerrors _tlIerrors in
         let !_output = rule246 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Productions
             !_lhsOoutput = rule247 _output in
         let !__result_ = T_Productions_vOut40 _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Productions_s50 v40
   {-# NOINLINE[1] rule243 #-}
   rule243 = \ ((!_hdIallAttributes) :: AttrMap) ((!_tlIallAttributes) :: AttrMap) ->
     _hdIallAttributes `mergeAttributes` _tlIallAttributes
   {-# NOINLINE[1] rule244 #-}
   rule244 = \ ((!_hdIaugmentsOut) :: Map ConstructorIdent (Map Identifier [Expression])) ((!_tlIaugmentsOut) :: Map ConstructorIdent (Map Identifier [Expression])) ->
     _hdIaugmentsOut `Map.union` _tlIaugmentsOut
   {-# NOINLINE[1] rule245 #-}
   rule245 = \ ((!_hdIerrors) :: Seq Error) ((!_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# NOINLINE[1] rule246 #-}
   rule246 = \ ((!_hdIoutput) :: Production) ((!_tlIoutput) :: Productions) ->
     (:) _hdIoutput _tlIoutput
   {-# NOINLINE[1] rule247 #-}
   rule247 = \ !_output ->
     _output
   {-# NOINLINE[1] rule248 #-}
   rule248 = \ ((!_lhsIaugmentsIn) :: Map ConstructorIdent (Map Identifier [Expression])) ->
     _lhsIaugmentsIn
   {-# NOINLINE[1] rule249 #-}
   rule249 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule250 #-}
   rule250 = \ ((!_lhsIinhMap) :: Map Identifier Attributes) ->
     _lhsIinhMap
   {-# NOINLINE[1] rule252 #-}
   rule252 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule253 #-}
   rule253 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# NOINLINE[1] rule254 #-}
   rule254 = \ ((!_lhsIsynMap) :: Map Identifier Attributes) ->
     _lhsIsynMap
   {-# NOINLINE[1] rule255 #-}
   rule255 = \ ((!_lhsIaugmentsIn) :: Map ConstructorIdent (Map Identifier [Expression])) ->
     _lhsIaugmentsIn
   {-# NOINLINE[1] rule256 #-}
   rule256 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule257 #-}
   rule257 = \ ((!_lhsIinhMap) :: Map Identifier Attributes) ->
     _lhsIinhMap
   {-# NOINLINE[1] rule259 #-}
   rule259 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule260 #-}
   rule260 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# NOINLINE[1] rule261 #-}
   rule261 = \ ((!_lhsIsynMap) :: Map Identifier Attributes) ->
     _lhsIsynMap
{-# NOINLINE sem_Productions_Nil #-}
sem_Productions_Nil ::  T_Productions 
sem_Productions_Nil  = T_Productions (return st24) where
   {-# NOINLINE st24 #-}
   !st24 = let
      k24 :: K_Productions_s24  t -> t
      k24 K_Productions_v12 = v12
      k24 K_Productions_v25 = v25
      k24 K_Productions_v39 = v39
      v12 :: T_Productions_v12 
      v12 = \ !(T_Productions_vIn12 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsImainName _lhsInt _lhsIoptions _lhsIsynMap) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule262  () in
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule263  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule264  () in
         let !_output = rule265  () in
         let _lhsOoutput :: Productions
             !_lhsOoutput = rule266 _output in
         let !__result_ = T_Productions_vOut12 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
      v25 :: T_Productions_v25 
      v25 = \ !(T_Productions_vIn25 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsInt _lhsIoptions _lhsIsynMap) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule262  () in
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule263  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule264  () in
         let !_output = rule265  () in
         let _lhsOoutput :: Productions
             !_lhsOoutput = rule266 _output in
         let !__result_ = T_Productions_vOut25 _lhsOallAttributes _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
      v39 :: T_Productions_v39 
      v39 = \ !(T_Productions_vIn39 _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule262  () in
         let !__st_ = st50  ()
             !__result_ = T_Productions_vOut39 _lhsOallAttributes __st_
          in __result_ )
     in C_Productions_s24 k24
   {-# NOINLINE st50 #-}
   st50 = \  (_ :: ()) -> let
      v40 :: T_Productions_v40 
      v40 = \ !(T_Productions_vIn40 _lhsIaugmentsIn _lhsIforcedIrrefutables _lhsIinhMap _lhsIoptions _lhsIsynMap) -> (
         let _lhsOaugmentsOut :: Map ConstructorIdent (Map Identifier [Expression])
             !_lhsOaugmentsOut = rule263  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule264  () in
         let !_output = rule265  () in
         let _lhsOoutput :: Productions
             !_lhsOoutput = rule266 _output in
         let !__result_ = T_Productions_vOut40 _lhsOaugmentsOut _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Productions_s50 v40
   {-# NOINLINE[1] rule262 #-}
   rule262 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule263 #-}
   rule263 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule264 #-}
   rule264 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule265 #-}
   rule265 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule266 #-}
   rule266 = \ !_output ->
     _output

-- Rule --------------------------------------------------------
-- wrapper
data Inh_Rule  = Inh_Rule { childInhs_Inh_Rule :: !([(Identifier, Identifier)]), childSyns_Inh_Rule :: !([(Identifier, Identifier)]), con_Inh_Rule :: !(ConstructorIdent), defs_Inh_Rule :: !(Set (Identifier, Identifier)), forcedIrrefutables_Inh_Rule :: !(AttrMap), nt_Inh_Rule :: !(NontermIdent), options_Inh_Rule :: !(Options) }
data Syn_Rule  = Syn_Rule { allAttributes_Syn_Rule :: !(AttrMap), defsCollect_Syn_Rule :: !(Set (Identifier, Identifier)), errors_Syn_Rule :: !(Seq Error), output_Syn_Rule :: !(Rule) }
{-# INLINABLE wrap_Rule #-}
wrap_Rule :: T_Rule  -> Inh_Rule  -> (Syn_Rule )
wrap_Rule !(T_Rule act) !(Inh_Rule _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt _lhsIoptions) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg13 = T_Rule_vIn13 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt _lhsIoptions
        !(T_Rule_vOut13 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput) <- return (inv_Rule_s26 sem K_Rule_v13 arg13)
        return (Syn_Rule _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput)
   )

-- cata
{-# INLINE sem_Rule #-}
sem_Rule :: Rule  -> T_Rule 
sem_Rule ( Rule !mbName_ pattern_ rhs_ !owrt_ !origin_ !explicit_ !pure_ !identity_ !mbError_ !eager_ ) = sem_Rule_Rule mbName_ ( sem_Pattern pattern_ ) ( sem_Expression rhs_ ) owrt_ origin_ explicit_ pure_ identity_ mbError_ eager_

-- semantic domain
newtype T_Rule  = T_Rule {
                         attach_T_Rule :: Identity (T_Rule_s26 )
                         }
data T_Rule_s26  where C_Rule_s26 :: {
                                     inv_Rule_s26 :: !(forall t. K_Rule_s26  t -> t)
                                     } -> T_Rule_s26 
data T_Rule_s27  = C_Rule_s27
newtype T_Rule_s48  = C_Rule_s48 {
                                 inv_Rule_s48 :: (T_Rule_v37 )
                                 }
newtype T_Rule_s57  = C_Rule_s57 {
                                 inv_Rule_s57 :: (T_Rule_v54 )
                                 }
data K_Rule_s26 k  where
   K_Rule_v13 :: K_Rule_s26  (T_Rule_v13 )
   K_Rule_v36 :: K_Rule_s26  (T_Rule_v36 )
   K_Rule_v53 :: K_Rule_s26  (T_Rule_v53 )
type T_Rule_v13  = (T_Rule_vIn13 ) -> (T_Rule_vOut13 )
data T_Rule_vIn13  = T_Rule_vIn13 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent) !(Options)
data T_Rule_vOut13  = T_Rule_vOut13 !(AttrMap) !(Set (Identifier, Identifier)) !(Seq Error) !(Rule)
type T_Rule_v36  = (T_Rule_vIn36 ) -> (T_Rule_vOut36 )
data T_Rule_vIn36  = T_Rule_vIn36 !(ConstructorIdent) !(NontermIdent)
data T_Rule_vOut36  = T_Rule_vOut36 !(AttrMap) !(Set (Identifier, Identifier)) !(T_Rule_s48 )
type T_Rule_v37  = (T_Rule_vIn37 ) -> (T_Rule_vOut37 )
data T_Rule_vIn37  = T_Rule_vIn37 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(Set (Identifier, Identifier)) !(AttrMap) !(Options)
data T_Rule_vOut37  = T_Rule_vOut37 !(Seq Error) !(Rule)
type T_Rule_v53  = (T_Rule_vIn53 ) -> (T_Rule_vOut53 )
data T_Rule_vIn53  = T_Rule_vIn53 !(ConstructorIdent) !(NontermIdent)
data T_Rule_vOut53  = T_Rule_vOut53 !(AttrMap) !(T_Rule_s57 )
type T_Rule_v54  = (T_Rule_vIn54 ) -> (T_Rule_vOut54 )
data T_Rule_vIn54  = T_Rule_vIn54 
data T_Rule_vOut54  = T_Rule_vOut54 !(Set (Identifier, Identifier)) !(T_Rule_s48 )
{-# NOINLINE sem_Rule_Rule #-}
sem_Rule_Rule :: (Maybe Identifier) -> T_Pattern  -> T_Expression  -> (Bool) -> (String) -> (Bool) -> (Bool) -> (Bool) -> (Maybe Error) -> (Bool) -> T_Rule 
sem_Rule_Rule !arg_mbName_ arg_pattern_ arg_rhs_ !arg_owrt_ !arg_origin_ !arg_explicit_ !arg_pure_ !arg_identity_ !arg_mbError_ !arg_eager_ = T_Rule (return st26) where
   {-# NOINLINE st26 #-}
   !st26 = let
      k26 :: K_Rule_s26  t -> t
      k26 K_Rule_v13 = v13
      k26 K_Rule_v36 = v36
      k26 K_Rule_v53 = v53
      v13 :: T_Rule_v13 
      v13 = \ !(T_Rule_vIn13 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt _lhsIoptions) -> (
         let !_patternX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pattern_)) in
         let !_rhsX4 = Control.Monad.Identity.runIdentity (attach_T_Expression (arg_rhs_)) in
         let !_patternOcon = rule275 _lhsIcon in
         let !_patternOnt = rule278 _lhsInt in
         let !_patternOchildInhs = rule273 _lhsIchildInhs in
         let !_patternOdefs = rule276 _lhsIdefs in
         let !_rhsOchildInhs = rule279 _lhsIchildInhs in
         let !_rhsOchildSyns = rule280 _lhsIchildSyns in
         let !_rhsOcon = rule281 _lhsIcon in
         let !_rhsOnt = rule282 _lhsInt in
         let !_rhsOoptions = rule283 _lhsIoptions in
         let !_patternOforcedIrrefutables = rule277 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut31 _patternIallAttributes _patternIdefsCollect _patternIerrors _patternIoutput) = inv_Pattern_s18 _patternX18 K_Pattern_v31 (T_Pattern_vIn31 _patternOchildInhs _patternOcon _patternOdefs _patternOforcedIrrefutables _patternOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule268 _patternIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule269 _patternIdefsCollect in
         let !_ruleDescr = rule267 _lhsIcon _lhsInt _patternIdefsCollect in
         let !_rhsOruleDescr = rule284 _ruleDescr in
         let !(T_Expression_vOut2 _rhsIerrors _rhsIoutput) = inv_Expression_s4 _rhsX4 (T_Expression_vIn2 _rhsOchildInhs _rhsOchildSyns _rhsOcon _rhsOnt _rhsOoptions _rhsOruleDescr) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule270 _patternIerrors _rhsIerrors in
         let !_output = rule271 _patternIoutput _rhsIoutput arg_eager_ arg_explicit_ arg_identity_ arg_mbError_ arg_mbName_ arg_origin_ arg_owrt_ arg_pure_ in
         let _lhsOoutput :: Rule
             !_lhsOoutput = rule272 _output in
         let !__result_ = T_Rule_vOut13 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v36 :: T_Rule_v36 
      v36 = \ !(T_Rule_vIn36 _lhsIcon _lhsInt) -> (
         let !_patternX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pattern_)) in
         let !_patternOcon = rule275 _lhsIcon in
         let !_patternOnt = rule278 _lhsInt in
         let !(T_Pattern_vOut41 _patternIallAttributes _patternIdefsCollect _patternX51) = inv_Pattern_s18 _patternX18 K_Pattern_v41 (T_Pattern_vIn41 _patternOcon _patternOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule268 _patternIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule269 _patternIdefsCollect in
         let !__st_ = st48 _lhsIcon _lhsInt _patternIdefsCollect _patternX51
             !__result_ = T_Rule_vOut36 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v53 :: T_Rule_v53 
      v53 = \ !(T_Rule_vIn53 _lhsIcon _lhsInt) -> (
         let !_patternX18 = Control.Monad.Identity.runIdentity (attach_T_Pattern (arg_pattern_)) in
         let !_patternOcon = rule275 _lhsIcon in
         let !_patternOnt = rule278 _lhsInt in
         let !(T_Pattern_vOut55 _patternIallAttributes _patternX58) = inv_Pattern_s18 _patternX18 K_Pattern_v55 (T_Pattern_vIn55 _patternOcon _patternOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule268 _patternIallAttributes in
         let !__st_ = st57 _lhsIcon _lhsInt _patternX58
             !__result_ = T_Rule_vOut53 _lhsOallAttributes __st_
          in __result_ )
     in C_Rule_s26 k26
   {-# NOINLINE st48 #-}
   st48 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) ((!_patternIdefsCollect) :: Set (Identifier, Identifier)) !_patternX51 -> let
      v37 :: T_Rule_v37 
      v37 = \ !(T_Rule_vIn37 _lhsIchildInhs _lhsIchildSyns _lhsIdefs _lhsIforcedIrrefutables _lhsIoptions) -> (
         let !_rhsOcon = rule281 _lhsIcon in
         let !_rhsOnt = rule282 _lhsInt in
         let !_ruleDescr = rule267 _lhsIcon _lhsInt _patternIdefsCollect in
         let !_rhsX4 = Control.Monad.Identity.runIdentity (attach_T_Expression (arg_rhs_)) in
         let !_patternOchildInhs = rule273 _lhsIchildInhs in
         let !_patternOdefs = rule276 _lhsIdefs in
         let !_rhsOchildInhs = rule279 _lhsIchildInhs in
         let !_rhsOchildSyns = rule280 _lhsIchildSyns in
         let !_rhsOoptions = rule283 _lhsIoptions in
         let !_rhsOruleDescr = rule284 _ruleDescr in
         let !_patternOforcedIrrefutables = rule277 _lhsIforcedIrrefutables in
         let !(T_Pattern_vOut42 _patternIerrors _patternIoutput) = inv_Pattern_s51 _patternX51 (T_Pattern_vIn42 _patternOchildInhs _patternOdefs _patternOforcedIrrefutables) in
         let !(T_Expression_vOut2 _rhsIerrors _rhsIoutput) = inv_Expression_s4 _rhsX4 (T_Expression_vIn2 _rhsOchildInhs _rhsOchildSyns _rhsOcon _rhsOnt _rhsOoptions _rhsOruleDescr) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule270 _patternIerrors _rhsIerrors in
         let !_output = rule271 _patternIoutput _rhsIoutput arg_eager_ arg_explicit_ arg_identity_ arg_mbError_ arg_mbName_ arg_origin_ arg_owrt_ arg_pure_ in
         let _lhsOoutput :: Rule
             !_lhsOoutput = rule272 _output in
         let !__result_ = T_Rule_vOut37 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Rule_s48 v37
   {-# NOINLINE st57 #-}
   st57 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) !_patternX58 -> let
      v54 :: T_Rule_v54 
      v54 = \ !(T_Rule_vIn54 ) -> (
         let !(T_Pattern_vOut56 _patternIdefsCollect _patternX51) = inv_Pattern_s58 _patternX58 (T_Pattern_vIn56 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule269 _patternIdefsCollect in
         let !__st_ = st48 _lhsIcon _lhsInt _patternIdefsCollect _patternX51
             !__result_ = T_Rule_vOut54 _lhsOdefsCollect __st_
          in __result_ )
     in C_Rule_s57 v54
   {-# NOINLINE[1] rule267 #-}
   {-# LINE 172 "src-ag/Desugar.ag" #-}
   rule267 = \ ((!_lhsIcon) :: ConstructorIdent) ((!_lhsInt) :: NontermIdent) ((!_patternIdefsCollect) :: Set (Identifier, Identifier)) ->
                        {-# LINE 172 "src-ag/Desugar.ag" #-}
                        show _lhsInt ++ " :: " ++ show _lhsIcon ++ " :: " ++ (concat $ intersperse "," $ map (\(f,a) -> show f ++ "." ++ show a) $ Set.toList _patternIdefsCollect)
                        {-# LINE 4003 "src-generated/Desugar.hs" #-}
   {-# NOINLINE[1] rule268 #-}
   rule268 = \ ((!_patternIallAttributes) :: AttrMap) ->
     _patternIallAttributes
   {-# NOINLINE[1] rule269 #-}
   rule269 = \ ((!_patternIdefsCollect) :: Set (Identifier, Identifier)) ->
     _patternIdefsCollect
   {-# NOINLINE[1] rule270 #-}
   rule270 = \ ((!_patternIerrors) :: Seq Error) ((!_rhsIerrors) :: Seq Error) ->
     _patternIerrors Seq.>< _rhsIerrors
   {-# NOINLINE[1] rule271 #-}
   rule271 = \ ((!_patternIoutput) :: Pattern) ((!_rhsIoutput) :: Expression) !eager_ !explicit_ !identity_ !mbError_ !mbName_ !origin_ !owrt_ !pure_ ->
     Rule mbName_ _patternIoutput _rhsIoutput owrt_ origin_ explicit_ pure_ identity_ mbError_ eager_
   {-# NOINLINE[1] rule272 #-}
   rule272 = \ !_output ->
     _output
   {-# NOINLINE[1] rule273 #-}
   rule273 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule275 #-}
   rule275 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule276 #-}
   rule276 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule277 #-}
   rule277 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule278 #-}
   rule278 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule279 #-}
   rule279 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule280 #-}
   rule280 = \ ((!_lhsIchildSyns) :: [(Identifier, Identifier)]) ->
     _lhsIchildSyns
   {-# NOINLINE[1] rule281 #-}
   rule281 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule282 #-}
   rule282 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule283 #-}
   rule283 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# NOINLINE[1] rule284 #-}
   rule284 = \ !_ruleDescr ->
     _ruleDescr

-- Rules -------------------------------------------------------
-- wrapper
data Inh_Rules  = Inh_Rules { childInhs_Inh_Rules :: !([(Identifier, Identifier)]), childSyns_Inh_Rules :: !([(Identifier, Identifier)]), con_Inh_Rules :: !(ConstructorIdent), defs_Inh_Rules :: !(Set (Identifier, Identifier)), forcedIrrefutables_Inh_Rules :: !(AttrMap), nt_Inh_Rules :: !(NontermIdent), options_Inh_Rules :: !(Options) }
data Syn_Rules  = Syn_Rules { allAttributes_Syn_Rules :: !(AttrMap), defsCollect_Syn_Rules :: !(Set (Identifier, Identifier)), errors_Syn_Rules :: !(Seq Error), output_Syn_Rules :: !(Rules) }
{-# INLINABLE wrap_Rules #-}
wrap_Rules :: T_Rules  -> Inh_Rules  -> (Syn_Rules )
wrap_Rules !(T_Rules act) !(Inh_Rules _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt _lhsIoptions) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg14 = T_Rules_vIn14 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt _lhsIoptions
        !(T_Rules_vOut14 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput) <- return (inv_Rules_s28 sem K_Rules_v14 arg14)
        return (Syn_Rules _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput)
   )

-- cata
{-# NOINLINE sem_Rules #-}
sem_Rules :: Rules  -> T_Rules 
sem_Rules list = Prelude.foldr sem_Rules_Cons sem_Rules_Nil (Prelude.map sem_Rule list)

-- semantic domain
newtype T_Rules  = T_Rules {
                           attach_T_Rules :: Identity (T_Rules_s28 )
                           }
data T_Rules_s28  where C_Rules_s28 :: {
                                       inv_Rules_s28 :: !(forall t. K_Rules_s28  t -> t)
                                       } -> T_Rules_s28 
data T_Rules_s29  = C_Rules_s29
newtype T_Rules_s43  = C_Rules_s43 {
                                   inv_Rules_s43 :: (T_Rules_v29 )
                                   }
newtype T_Rules_s55  = C_Rules_s55 {
                                   inv_Rules_s55 :: (T_Rules_v50 )
                                   }
data K_Rules_s28 k  where
   K_Rules_v14 :: K_Rules_s28  (T_Rules_v14 )
   K_Rules_v28 :: K_Rules_s28  (T_Rules_v28 )
   K_Rules_v49 :: K_Rules_s28  (T_Rules_v49 )
type T_Rules_v14  = (T_Rules_vIn14 ) -> (T_Rules_vOut14 )
data T_Rules_vIn14  = T_Rules_vIn14 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(ConstructorIdent) !(Set (Identifier, Identifier)) !(AttrMap) !(NontermIdent) !(Options)
data T_Rules_vOut14  = T_Rules_vOut14 !(AttrMap) !(Set (Identifier, Identifier)) !(Seq Error) !(Rules)
type T_Rules_v28  = (T_Rules_vIn28 ) -> (T_Rules_vOut28 )
data T_Rules_vIn28  = T_Rules_vIn28 !(ConstructorIdent) !(NontermIdent)
data T_Rules_vOut28  = T_Rules_vOut28 !(AttrMap) !(Set (Identifier, Identifier)) !(T_Rules_s43 )
type T_Rules_v29  = (T_Rules_vIn29 ) -> (T_Rules_vOut29 )
data T_Rules_vIn29  = T_Rules_vIn29 !([(Identifier, Identifier)]) !([(Identifier, Identifier)]) !(Set (Identifier, Identifier)) !(AttrMap) !(Options)
data T_Rules_vOut29  = T_Rules_vOut29 !(Seq Error) !(Rules)
type T_Rules_v49  = (T_Rules_vIn49 ) -> (T_Rules_vOut49 )
data T_Rules_vIn49  = T_Rules_vIn49 !(ConstructorIdent) !(NontermIdent)
data T_Rules_vOut49  = T_Rules_vOut49 !(AttrMap) !(T_Rules_s55 )
type T_Rules_v50  = (T_Rules_vIn50 ) -> (T_Rules_vOut50 )
data T_Rules_vIn50  = T_Rules_vIn50 
data T_Rules_vOut50  = T_Rules_vOut50 !(Set (Identifier, Identifier)) !(T_Rules_s43 )
{-# NOINLINE sem_Rules_Cons #-}
sem_Rules_Cons :: T_Rule  -> T_Rules  -> T_Rules 
sem_Rules_Cons arg_hd_ arg_tl_ = T_Rules (return st28) where
   {-# NOINLINE st28 #-}
   !st28 = let
      k28 :: K_Rules_s28  t -> t
      k28 K_Rules_v14 = v14
      k28 K_Rules_v28 = v28
      k28 K_Rules_v49 = v49
      v14 :: T_Rules_v14 
      v14 = \ !(T_Rules_vIn14 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt _lhsIoptions) -> (
         let !_hdX26 = Control.Monad.Identity.runIdentity (attach_T_Rule (arg_hd_)) in
         let !_tlX28 = Control.Monad.Identity.runIdentity (attach_T_Rules (arg_tl_)) in
         let !_hdOcon = rule292 _lhsIcon in
         let !_hdOnt = rule295 _lhsInt in
         let !_tlOcon = rule299 _lhsIcon in
         let !_tlOnt = rule302 _lhsInt in
         let !_hdOchildInhs = rule290 _lhsIchildInhs in
         let !_hdOchildSyns = rule291 _lhsIchildSyns in
         let !_hdOdefs = rule293 _lhsIdefs in
         let !_hdOoptions = rule296 _lhsIoptions in
         let !_tlOchildInhs = rule297 _lhsIchildInhs in
         let !_tlOchildSyns = rule298 _lhsIchildSyns in
         let !_tlOdefs = rule300 _lhsIdefs in
         let !_tlOoptions = rule303 _lhsIoptions in
         let !_hdOforcedIrrefutables = rule294 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule301 _lhsIforcedIrrefutables in
         let !(T_Rule_vOut13 _hdIallAttributes _hdIdefsCollect _hdIerrors _hdIoutput) = inv_Rule_s26 _hdX26 K_Rule_v13 (T_Rule_vIn13 _hdOchildInhs _hdOchildSyns _hdOcon _hdOdefs _hdOforcedIrrefutables _hdOnt _hdOoptions) in
         let !(T_Rules_vOut14 _tlIallAttributes _tlIdefsCollect _tlIerrors _tlIoutput) = inv_Rules_s28 _tlX28 K_Rules_v14 (T_Rules_vIn14 _tlOchildInhs _tlOchildSyns _tlOcon _tlOdefs _tlOforcedIrrefutables _tlOnt _tlOoptions) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule285 _hdIallAttributes _tlIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule286 _hdIdefsCollect _tlIdefsCollect in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule287 _hdIerrors _tlIerrors in
         let !_output = rule288 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Rules
             !_lhsOoutput = rule289 _output in
         let !__result_ = T_Rules_vOut14 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v28 :: T_Rules_v28 
      v28 = \ !(T_Rules_vIn28 _lhsIcon _lhsInt) -> (
         let !_hdX26 = Control.Monad.Identity.runIdentity (attach_T_Rule (arg_hd_)) in
         let !_tlX28 = Control.Monad.Identity.runIdentity (attach_T_Rules (arg_tl_)) in
         let !_hdOcon = rule292 _lhsIcon in
         let !_hdOnt = rule295 _lhsInt in
         let !_tlOcon = rule299 _lhsIcon in
         let !_tlOnt = rule302 _lhsInt in
         let !(T_Rule_vOut36 _hdIallAttributes _hdIdefsCollect _hdX48) = inv_Rule_s26 _hdX26 K_Rule_v36 (T_Rule_vIn36 _hdOcon _hdOnt) in
         let !(T_Rules_vOut28 _tlIallAttributes _tlIdefsCollect _tlX43) = inv_Rules_s28 _tlX28 K_Rules_v28 (T_Rules_vIn28 _tlOcon _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule285 _hdIallAttributes _tlIallAttributes in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule286 _hdIdefsCollect _tlIdefsCollect in
         let !__st_ = st43 _hdX48 _tlX43
             !__result_ = T_Rules_vOut28 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v49 :: T_Rules_v49 
      v49 = \ !(T_Rules_vIn49 _lhsIcon _lhsInt) -> (
         let !_hdX26 = Control.Monad.Identity.runIdentity (attach_T_Rule (arg_hd_)) in
         let !_tlX28 = Control.Monad.Identity.runIdentity (attach_T_Rules (arg_tl_)) in
         let !_hdOcon = rule292 _lhsIcon in
         let !_hdOnt = rule295 _lhsInt in
         let !_tlOcon = rule299 _lhsIcon in
         let !_tlOnt = rule302 _lhsInt in
         let !(T_Rule_vOut53 _hdIallAttributes _hdX57) = inv_Rule_s26 _hdX26 K_Rule_v53 (T_Rule_vIn53 _hdOcon _hdOnt) in
         let !(T_Rules_vOut49 _tlIallAttributes _tlX55) = inv_Rules_s28 _tlX28 K_Rules_v49 (T_Rules_vIn49 _tlOcon _tlOnt) in
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule285 _hdIallAttributes _tlIallAttributes in
         let !__st_ = st55 _hdX57 _tlX55
             !__result_ = T_Rules_vOut49 _lhsOallAttributes __st_
          in __result_ )
     in C_Rules_s28 k28
   {-# NOINLINE st43 #-}
   st43 = \ !_hdX48 !_tlX43 -> let
      v29 :: T_Rules_v29 
      v29 = \ !(T_Rules_vIn29 _lhsIchildInhs _lhsIchildSyns _lhsIdefs _lhsIforcedIrrefutables _lhsIoptions) -> (
         let !_hdOchildInhs = rule290 _lhsIchildInhs in
         let !_hdOchildSyns = rule291 _lhsIchildSyns in
         let !_hdOdefs = rule293 _lhsIdefs in
         let !_hdOoptions = rule296 _lhsIoptions in
         let !_tlOchildInhs = rule297 _lhsIchildInhs in
         let !_tlOchildSyns = rule298 _lhsIchildSyns in
         let !_tlOdefs = rule300 _lhsIdefs in
         let !_tlOoptions = rule303 _lhsIoptions in
         let !_hdOforcedIrrefutables = rule294 _lhsIforcedIrrefutables in
         let !_tlOforcedIrrefutables = rule301 _lhsIforcedIrrefutables in
         let !(T_Rule_vOut37 _hdIerrors _hdIoutput) = inv_Rule_s48 _hdX48 (T_Rule_vIn37 _hdOchildInhs _hdOchildSyns _hdOdefs _hdOforcedIrrefutables _hdOoptions) in
         let !(T_Rules_vOut29 _tlIerrors _tlIoutput) = inv_Rules_s43 _tlX43 (T_Rules_vIn29 _tlOchildInhs _tlOchildSyns _tlOdefs _tlOforcedIrrefutables _tlOoptions) in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule287 _hdIerrors _tlIerrors in
         let !_output = rule288 _hdIoutput _tlIoutput in
         let _lhsOoutput :: Rules
             !_lhsOoutput = rule289 _output in
         let !__result_ = T_Rules_vOut29 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Rules_s43 v29
   {-# NOINLINE st55 #-}
   st55 = \ !_hdX57 !_tlX55 -> let
      v50 :: T_Rules_v50 
      v50 = \ !(T_Rules_vIn50 ) -> (
         let !(T_Rule_vOut54 _hdIdefsCollect _hdX48) = inv_Rule_s57 _hdX57 (T_Rule_vIn54 ) in
         let !(T_Rules_vOut50 _tlIdefsCollect _tlX43) = inv_Rules_s55 _tlX55 (T_Rules_vIn50 ) in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule286 _hdIdefsCollect _tlIdefsCollect in
         let !__st_ = st43 _hdX48 _tlX43
             !__result_ = T_Rules_vOut50 _lhsOdefsCollect __st_
          in __result_ )
     in C_Rules_s55 v50
   {-# NOINLINE[1] rule285 #-}
   rule285 = \ ((!_hdIallAttributes) :: AttrMap) ((!_tlIallAttributes) :: AttrMap) ->
     _hdIallAttributes `mergeAttributes` _tlIallAttributes
   {-# NOINLINE[1] rule286 #-}
   rule286 = \ ((!_hdIdefsCollect) :: Set (Identifier, Identifier)) ((!_tlIdefsCollect) :: Set (Identifier, Identifier)) ->
     _hdIdefsCollect `Set.union` _tlIdefsCollect
   {-# NOINLINE[1] rule287 #-}
   rule287 = \ ((!_hdIerrors) :: Seq Error) ((!_tlIerrors) :: Seq Error) ->
     _hdIerrors Seq.>< _tlIerrors
   {-# NOINLINE[1] rule288 #-}
   rule288 = \ ((!_hdIoutput) :: Rule) ((!_tlIoutput) :: Rules) ->
     (:) _hdIoutput _tlIoutput
   {-# NOINLINE[1] rule289 #-}
   rule289 = \ !_output ->
     _output
   {-# NOINLINE[1] rule290 #-}
   rule290 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule291 #-}
   rule291 = \ ((!_lhsIchildSyns) :: [(Identifier, Identifier)]) ->
     _lhsIchildSyns
   {-# NOINLINE[1] rule292 #-}
   rule292 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule293 #-}
   rule293 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule294 #-}
   rule294 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule295 #-}
   rule295 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule296 #-}
   rule296 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions
   {-# NOINLINE[1] rule297 #-}
   rule297 = \ ((!_lhsIchildInhs) :: [(Identifier, Identifier)]) ->
     _lhsIchildInhs
   {-# NOINLINE[1] rule298 #-}
   rule298 = \ ((!_lhsIchildSyns) :: [(Identifier, Identifier)]) ->
     _lhsIchildSyns
   {-# NOINLINE[1] rule299 #-}
   rule299 = \ ((!_lhsIcon) :: ConstructorIdent) ->
     _lhsIcon
   {-# NOINLINE[1] rule300 #-}
   rule300 = \ ((!_lhsIdefs) :: Set (Identifier, Identifier)) ->
     _lhsIdefs
   {-# NOINLINE[1] rule301 #-}
   rule301 = \ ((!_lhsIforcedIrrefutables) :: AttrMap) ->
     _lhsIforcedIrrefutables
   {-# NOINLINE[1] rule302 #-}
   rule302 = \ ((!_lhsInt) :: NontermIdent) ->
     _lhsInt
   {-# NOINLINE[1] rule303 #-}
   rule303 = \ ((!_lhsIoptions) :: Options) ->
     _lhsIoptions
{-# NOINLINE sem_Rules_Nil #-}
sem_Rules_Nil ::  T_Rules 
sem_Rules_Nil  = T_Rules (return st28) where
   {-# NOINLINE st28 #-}
   !st28 = let
      k28 :: K_Rules_s28  t -> t
      k28 K_Rules_v14 = v14
      k28 K_Rules_v28 = v28
      k28 K_Rules_v49 = v49
      v14 :: T_Rules_v14 
      v14 = \ !(T_Rules_vIn14 _lhsIchildInhs _lhsIchildSyns _lhsIcon _lhsIdefs _lhsIforcedIrrefutables _lhsInt _lhsIoptions) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule304  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule305  () in
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule306  () in
         let !_output = rule307  () in
         let _lhsOoutput :: Rules
             !_lhsOoutput = rule308 _output in
         let !__result_ = T_Rules_vOut14 _lhsOallAttributes _lhsOdefsCollect _lhsOerrors _lhsOoutput
          in __result_ )
      v28 :: T_Rules_v28 
      v28 = \ !(T_Rules_vIn28 _lhsIcon _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule304  () in
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule305  () in
         let !__st_ = st43  ()
             !__result_ = T_Rules_vOut28 _lhsOallAttributes _lhsOdefsCollect __st_
          in __result_ )
      v49 :: T_Rules_v49 
      v49 = \ !(T_Rules_vIn49 _lhsIcon _lhsInt) -> (
         let _lhsOallAttributes :: AttrMap
             !_lhsOallAttributes = rule304  () in
         let !__st_ = st55  ()
             !__result_ = T_Rules_vOut49 _lhsOallAttributes __st_
          in __result_ )
     in C_Rules_s28 k28
   {-# NOINLINE st43 #-}
   st43 = \  (_ :: ()) -> let
      v29 :: T_Rules_v29 
      v29 = \ !(T_Rules_vIn29 _lhsIchildInhs _lhsIchildSyns _lhsIdefs _lhsIforcedIrrefutables _lhsIoptions) -> (
         let _lhsOerrors :: Seq Error
             !_lhsOerrors = rule306  () in
         let !_output = rule307  () in
         let _lhsOoutput :: Rules
             !_lhsOoutput = rule308 _output in
         let !__result_ = T_Rules_vOut29 _lhsOerrors _lhsOoutput
          in __result_ )
     in C_Rules_s43 v29
   {-# NOINLINE st55 #-}
   st55 = \  (_ :: ()) -> let
      v50 :: T_Rules_v50 
      v50 = \ !(T_Rules_vIn50 ) -> (
         let _lhsOdefsCollect :: Set (Identifier, Identifier)
             !_lhsOdefsCollect = rule305  () in
         let !__st_ = st43  ()
             !__result_ = T_Rules_vOut50 _lhsOdefsCollect __st_
          in __result_ )
     in C_Rules_s55 v50
   {-# NOINLINE[1] rule304 #-}
   rule304 = \  (_ :: ()) ->
     Map.empty
   {-# NOINLINE[1] rule305 #-}
   rule305 = \  (_ :: ()) ->
     Set.empty
   {-# NOINLINE[1] rule306 #-}
   rule306 = \  (_ :: ()) ->
     Seq.empty
   {-# NOINLINE[1] rule307 #-}
   rule307 = \  (_ :: ()) ->
     []
   {-# NOINLINE[1] rule308 #-}
   rule308 = \ !_output ->
     _output

-- TypeSig -----------------------------------------------------
-- wrapper
data Inh_TypeSig  = Inh_TypeSig {  }
data Syn_TypeSig  = Syn_TypeSig { output_Syn_TypeSig :: !(TypeSig) }
{-# INLINABLE wrap_TypeSig #-}
wrap_TypeSig :: T_TypeSig  -> Inh_TypeSig  -> (Syn_TypeSig )
wrap_TypeSig !(T_TypeSig act) !(Inh_TypeSig ) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg15 = T_TypeSig_vIn15 
        !(T_TypeSig_vOut15 _lhsOoutput) <- return (inv_TypeSig_s30 sem arg15)
        return (Syn_TypeSig _lhsOoutput)
   )

-- cata
{-# INLINE sem_TypeSig #-}
sem_TypeSig :: TypeSig  -> T_TypeSig 
sem_TypeSig ( TypeSig !name_ !tp_ ) = sem_TypeSig_TypeSig name_ tp_

-- semantic domain
newtype T_TypeSig  = T_TypeSig {
                               attach_T_TypeSig :: Identity (T_TypeSig_s30 )
                               }
newtype T_TypeSig_s30  = C_TypeSig_s30 {
                                       inv_TypeSig_s30 :: (T_TypeSig_v15 )
                                       }
data T_TypeSig_s31  = C_TypeSig_s31
type T_TypeSig_v15  = (T_TypeSig_vIn15 ) -> (T_TypeSig_vOut15 )
data T_TypeSig_vIn15  = T_TypeSig_vIn15 
data T_TypeSig_vOut15  = T_TypeSig_vOut15 !(TypeSig)
{-# NOINLINE sem_TypeSig_TypeSig #-}
sem_TypeSig_TypeSig :: (Identifier) -> (Type) -> T_TypeSig 
sem_TypeSig_TypeSig !arg_name_ !arg_tp_ = T_TypeSig (return st30) where
   {-# NOINLINE st30 #-}
   !st30 = let
      v15 :: T_TypeSig_v15 
      v15 = \ !(T_TypeSig_vIn15 ) -> (
         let !_output = rule309 arg_name_ arg_tp_ in
         let _lhsOoutput :: TypeSig
             !_lhsOoutput = rule310 _output in
         let !__result_ = T_TypeSig_vOut15 _lhsOoutput
          in __result_ )
     in C_TypeSig_s30 v15
   {-# INLINE rule309 #-}
   rule309 = \ !name_ !tp_ ->
     TypeSig name_ tp_
   {-# INLINE rule310 #-}
   rule310 = \ !_output ->
     _output

-- TypeSigs ----------------------------------------------------
-- wrapper
data Inh_TypeSigs  = Inh_TypeSigs {  }
data Syn_TypeSigs  = Syn_TypeSigs { output_Syn_TypeSigs :: !(TypeSigs) }
{-# INLINABLE wrap_TypeSigs #-}
wrap_TypeSigs :: T_TypeSigs  -> Inh_TypeSigs  -> (Syn_TypeSigs )
wrap_TypeSigs !(T_TypeSigs act) !(Inh_TypeSigs ) =
   Control.Monad.Identity.runIdentity (
     do !sem <- act
        let arg16 = T_TypeSigs_vIn16 
        !(T_TypeSigs_vOut16 _lhsOoutput) <- return (inv_TypeSigs_s32 sem arg16)
        return (Syn_TypeSigs _lhsOoutput)
   )

-- cata
{-# NOINLINE sem_TypeSigs #-}
sem_TypeSigs :: TypeSigs  -> T_TypeSigs 
sem_TypeSigs list = Prelude.foldr sem_TypeSigs_Cons sem_TypeSigs_Nil (Prelude.map sem_TypeSig list)

-- semantic domain
newtype T_TypeSigs  = T_TypeSigs {
                                 attach_T_TypeSigs :: Identity (T_TypeSigs_s32 )
                                 }
newtype T_TypeSigs_s32  = C_TypeSigs_s32 {
                                         inv_TypeSigs_s32 :: (T_TypeSigs_v16 )
                                         }
data T_TypeSigs_s33  = C_TypeSigs_s33
type T_TypeSigs_v16  = (T_TypeSigs_vIn16 ) -> (T_TypeSigs_vOut16 )
data T_TypeSigs_vIn16  = T_TypeSigs_vIn16 
data T_TypeSigs_vOut16  = T_TypeSigs_vOut16 !(TypeSigs)
{-# NOINLINE sem_TypeSigs_Cons #-}
sem_TypeSigs_Cons :: T_TypeSig  -> T_TypeSigs  -> T_TypeSigs 
sem_TypeSigs_Cons arg_hd_ arg_tl_ = T_TypeSigs (return st32) where
   {-# NOINLINE st32 #-}
   !st32 = let
      v16 :: T_TypeSigs_v16 
      v16 = \ !(T_TypeSigs_vIn16 ) -> (
         let !_hdX30 = Control.Monad.Identity.runIdentity (attach_T_TypeSig (arg_hd_)) in
         let !_tlX32 = Control.Monad.Identity.runIdentity (attach_T_TypeSigs (arg_tl_)) in
         let !(T_TypeSig_vOut15 _hdIoutput) = inv_TypeSig_s30 _hdX30 (T_TypeSig_vIn15 ) in
         let !(T_TypeSigs_vOut16 _tlIoutput) = inv_TypeSigs_s32 _tlX32 (T_TypeSigs_vIn16 ) in
         let !_output = rule311 _hdIoutput _tlIoutput in
         let _lhsOoutput :: TypeSigs
             !_lhsOoutput = rule312 _output in
         let !__result_ = T_TypeSigs_vOut16 _lhsOoutput
          in __result_ )
     in C_TypeSigs_s32 v16
   {-# INLINE rule311 #-}
   rule311 = \ ((!_hdIoutput) :: TypeSig) ((!_tlIoutput) :: TypeSigs) ->
     (:) _hdIoutput _tlIoutput
   {-# INLINE rule312 #-}
   rule312 = \ !_output ->
     _output
{-# NOINLINE sem_TypeSigs_Nil #-}
sem_TypeSigs_Nil ::  T_TypeSigs 
sem_TypeSigs_Nil  = T_TypeSigs (return st32) where
   {-# NOINLINE st32 #-}
   !st32 = let
      v16 :: T_TypeSigs_v16 
      v16 = \ !(T_TypeSigs_vIn16 ) -> (
         let !_output = rule313  () in
         let _lhsOoutput :: TypeSigs
             !_lhsOoutput = rule314 _output in
         let !__result_ = T_TypeSigs_vOut16 _lhsOoutput
          in __result_ )
     in C_TypeSigs_s32 v16
   {-# INLINE rule313 #-}
   rule313 = \  (_ :: ()) ->
     []
   {-# INLINE rule314 #-}
   rule314 = \ !_output ->
     _output