-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepl.js
1702 lines (1670 loc) · 58.7 KB
/
repl.js
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
// Generated by purs bundle 0.13.3
var PS = {};
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Alt"] = $PS["Control.Alt"] || {};
var exports = $PS["Control.Alt"];
var Alt = function (Functor0, alt) {
this.Functor0 = Functor0;
this.alt = alt;
};
var alt = function (dict) {
return dict.alt;
};
exports["Alt"] = Alt;
exports["alt"] = alt;
})(PS);
(function(exports) {
"use strict";
exports.arrayApply = function (fs) {
return function (xs) {
var l = fs.length;
var k = xs.length;
var result = new Array(l*k);
var n = 0;
for (var i = 0; i < l; i++) {
var f = fs[i];
for (var j = 0; j < k; j++) {
result[n++] = f(xs[j]);
}
}
return result;
};
};
})(PS["Control.Apply"] = PS["Control.Apply"] || {});
(function(exports) {
"use strict";
exports.arrayMap = function (f) {
return function (arr) {
var l = arr.length;
var result = new Array(l);
for (var i = 0; i < l; i++) {
result[i] = f(arr[i]);
}
return result;
};
};
})(PS["Data.Functor"] = PS["Data.Functor"] || {});
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Functor"] = $PS["Data.Functor"] || {};
var exports = $PS["Data.Functor"];
var $foreign = $PS["Data.Functor"];
var Functor = function (map) {
this.map = map;
};
var map = function (dict) {
return dict.map;
};
var functorArray = new Functor($foreign.arrayMap);
exports["Functor"] = Functor;
exports["map"] = map;
exports["functorArray"] = functorArray;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Apply"] = $PS["Control.Apply"] || {};
var exports = $PS["Control.Apply"];
var $foreign = $PS["Control.Apply"];
var Data_Functor = $PS["Data.Functor"];
var Apply = function (Functor0, apply) {
this.Functor0 = Functor0;
this.apply = apply;
};
var applyArray = new Apply(function () {
return Data_Functor.functorArray;
}, $foreign.arrayApply);
var apply = function (dict) {
return dict.apply;
};
exports["Apply"] = Apply;
exports["apply"] = apply;
exports["applyArray"] = applyArray;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Applicative"] = $PS["Control.Applicative"] || {};
var exports = $PS["Control.Applicative"];
var Control_Apply = $PS["Control.Apply"];
var Applicative = function (Apply0, pure) {
this.Apply0 = Apply0;
this.pure = pure;
};
var pure = function (dict) {
return dict.pure;
};
var liftA1 = function (dictApplicative) {
return function (f) {
return function (a) {
return Control_Apply.apply(dictApplicative.Apply0())(pure(dictApplicative)(f))(a);
};
};
};
var applicativeArray = new Applicative(function () {
return Control_Apply.applyArray;
}, function (x) {
return [ x ];
});
exports["Applicative"] = Applicative;
exports["pure"] = pure;
exports["liftA1"] = liftA1;
exports["applicativeArray"] = applicativeArray;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Bind"] = $PS["Control.Bind"] || {};
var exports = $PS["Control.Bind"];
var Bind = function (Apply0, bind) {
this.Apply0 = Apply0;
this.bind = bind;
};
var bind = function (dict) {
return dict.bind;
};
var composeKleisli = function (dictBind) {
return function (f) {
return function (g) {
return function (a) {
return bind(dictBind)(f(a))(g);
};
};
};
};
exports["Bind"] = Bind;
exports["bind"] = bind;
exports["composeKleisli"] = composeKleisli;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Semigroupoid"] = $PS["Control.Semigroupoid"] || {};
var exports = $PS["Control.Semigroupoid"];
var Semigroupoid = function (compose) {
this.compose = compose;
};
var semigroupoidFn = new Semigroupoid(function (f) {
return function (g) {
return function (x) {
return f(g(x));
};
};
});
exports["semigroupoidFn"] = semigroupoidFn;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Category"] = $PS["Control.Category"] || {};
var exports = $PS["Control.Category"];
var Control_Semigroupoid = $PS["Control.Semigroupoid"];
var Category = function (Semigroupoid0, identity) {
this.Semigroupoid0 = Semigroupoid0;
this.identity = identity;
};
var identity = function (dict) {
return dict.identity;
};
var categoryFn = new Category(function () {
return Control_Semigroupoid.semigroupoidFn;
}, function (x) {
return x;
});
exports["identity"] = identity;
exports["categoryFn"] = categoryFn;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Monad"] = $PS["Control.Monad"] || {};
var exports = $PS["Control.Monad"];
var Control_Applicative = $PS["Control.Applicative"];
var Control_Bind = $PS["Control.Bind"];
var Monad = function (Applicative0, Bind1) {
this.Applicative0 = Applicative0;
this.Bind1 = Bind1;
};
var ap = function (dictMonad) {
return function (f) {
return function (a) {
return Control_Bind.bind(dictMonad.Bind1())(f)(function (v) {
return Control_Bind.bind(dictMonad.Bind1())(a)(function (v1) {
return Control_Applicative.pure(dictMonad.Applicative0())(v(v1));
});
});
};
};
};
exports["Monad"] = Monad;
exports["ap"] = ap;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Monad.Error.Class"] = $PS["Control.Monad.Error.Class"] || {};
var exports = $PS["Control.Monad.Error.Class"];
var MonadThrow = function (Monad0, throwError) {
this.Monad0 = Monad0;
this.throwError = throwError;
};
var throwError = function (dict) {
return dict.throwError;
};
exports["throwError"] = throwError;
exports["MonadThrow"] = MonadThrow;
})(PS);
(function(exports) {
"use strict";
exports.foldrArray = function (f) {
return function (init) {
return function (xs) {
var acc = init;
var len = xs.length;
for (var i = len - 1; i >= 0; i--) {
acc = f(xs[i])(acc);
}
return acc;
};
};
};
exports.foldlArray = function (f) {
return function (init) {
return function (xs) {
var acc = init;
var len = xs.length;
for (var i = 0; i < len; i++) {
acc = f(acc)(xs[i]);
}
return acc;
};
};
};
})(PS["Data.Foldable"] = PS["Data.Foldable"] || {});
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Maybe"] = $PS["Data.Maybe"] || {};
var exports = $PS["Data.Maybe"];
var Nothing = (function () {
function Nothing() {
};
Nothing.value = new Nothing();
return Nothing;
})();
var Just = (function () {
function Just(value0) {
this.value0 = value0;
};
Just.create = function (value0) {
return new Just(value0);
};
return Just;
})();
exports["Nothing"] = Nothing;
exports["Just"] = Just;
})(PS);
(function(exports) {
"use strict";
exports.concatString = function (s1) {
return function (s2) {
return s1 + s2;
};
};
})(PS["Data.Semigroup"] = PS["Data.Semigroup"] || {});
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Semigroup"] = $PS["Data.Semigroup"] || {};
var exports = $PS["Data.Semigroup"];
var $foreign = $PS["Data.Semigroup"];
var Semigroup = function (append) {
this.append = append;
};
var semigroupString = new Semigroup($foreign.concatString);
var append = function (dict) {
return dict.append;
};
exports["Semigroup"] = Semigroup;
exports["append"] = append;
exports["semigroupString"] = semigroupString;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Monoid"] = $PS["Data.Monoid"] || {};
var exports = $PS["Data.Monoid"];
var Data_Semigroup = $PS["Data.Semigroup"];
var Monoid = function (Semigroup0, mempty) {
this.Semigroup0 = Semigroup0;
this.mempty = mempty;
};
var monoidString = new Monoid(function () {
return Data_Semigroup.semigroupString;
}, "");
var mempty = function (dict) {
return dict.mempty;
};
exports["Monoid"] = Monoid;
exports["mempty"] = mempty;
exports["monoidString"] = monoidString;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Foldable"] = $PS["Data.Foldable"] || {};
var exports = $PS["Data.Foldable"];
var $foreign = $PS["Data.Foldable"];
var Data_Maybe = $PS["Data.Maybe"];
var Data_Monoid = $PS["Data.Monoid"];
var Data_Semigroup = $PS["Data.Semigroup"];
var Foldable = function (foldMap, foldl, foldr) {
this.foldMap = foldMap;
this.foldl = foldl;
this.foldr = foldr;
};
var foldr = function (dict) {
return dict.foldr;
};
var foldl = function (dict) {
return dict.foldl;
};
var intercalate = function (dictFoldable) {
return function (dictMonoid) {
return function (sep) {
return function (xs) {
var go = function (v) {
return function (x) {
if (v.init) {
return {
init: false,
acc: x
};
};
return {
init: false,
acc: Data_Semigroup.append(dictMonoid.Semigroup0())(v.acc)(Data_Semigroup.append(dictMonoid.Semigroup0())(sep)(x))
};
};
};
return (foldl(dictFoldable)(go)({
init: true,
acc: Data_Monoid.mempty(dictMonoid)
})(xs)).acc;
};
};
};
};
var foldableMaybe = new Foldable(function (dictMonoid) {
return function (f) {
return function (v) {
if (v instanceof Data_Maybe.Nothing) {
return Data_Monoid.mempty(dictMonoid);
};
if (v instanceof Data_Maybe.Just) {
return f(v.value0);
};
throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 135, column 27): " + [ f.constructor.name, v.constructor.name ]);
};
};
}, function (v) {
return function (z) {
return function (v1) {
if (v1 instanceof Data_Maybe.Nothing) {
return z;
};
if (v1 instanceof Data_Maybe.Just) {
return v(z)(v1.value0);
};
throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 135, column 27): " + [ v.constructor.name, z.constructor.name, v1.constructor.name ]);
};
};
}, function (v) {
return function (z) {
return function (v1) {
if (v1 instanceof Data_Maybe.Nothing) {
return z;
};
if (v1 instanceof Data_Maybe.Just) {
return v(v1.value0)(z);
};
throw new Error("Failed pattern match at Data.Foldable (line 129, column 1 - line 135, column 27): " + [ v.constructor.name, z.constructor.name, v1.constructor.name ]);
};
};
});
var foldMapDefaultR = function (dictFoldable) {
return function (dictMonoid) {
return function (f) {
return foldr(dictFoldable)(function (x) {
return function (acc) {
return Data_Semigroup.append(dictMonoid.Semigroup0())(f(x))(acc);
};
})(Data_Monoid.mempty(dictMonoid));
};
};
};
var foldableArray = new Foldable(function (dictMonoid) {
return foldMapDefaultR(foldableArray)(dictMonoid);
}, $foreign.foldlArray, $foreign.foldrArray);
var foldMap = function (dict) {
return dict.foldMap;
};
exports["Foldable"] = Foldable;
exports["foldr"] = foldr;
exports["foldl"] = foldl;
exports["foldMap"] = foldMap;
exports["intercalate"] = intercalate;
exports["foldableArray"] = foldableArray;
exports["foldableMaybe"] = foldableMaybe;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Either"] = $PS["Data.Either"] || {};
var exports = $PS["Data.Either"];
var Data_Foldable = $PS["Data.Foldable"];
var Data_Functor = $PS["Data.Functor"];
var Data_Monoid = $PS["Data.Monoid"];
var Left = (function () {
function Left(value0) {
this.value0 = value0;
};
Left.create = function (value0) {
return new Left(value0);
};
return Left;
})();
var Right = (function () {
function Right(value0) {
this.value0 = value0;
};
Right.create = function (value0) {
return new Right(value0);
};
return Right;
})();
var functorEither = new Data_Functor.Functor(function (f) {
return function (m) {
if (m instanceof Left) {
return new Left(m.value0);
};
if (m instanceof Right) {
return new Right(f(m.value0));
};
throw new Error("Failed pattern match at Data.Either (line 38, column 1 - line 38, column 52): " + [ m.constructor.name ]);
};
});
var foldableEither = new Data_Foldable.Foldable(function (dictMonoid) {
return function (f) {
return function (v) {
if (v instanceof Left) {
return Data_Monoid.mempty(dictMonoid);
};
if (v instanceof Right) {
return f(v.value0);
};
throw new Error("Failed pattern match at Data.Either (line 187, column 1 - line 193, column 28): " + [ f.constructor.name, v.constructor.name ]);
};
};
}, function (v) {
return function (z) {
return function (v1) {
if (v1 instanceof Left) {
return z;
};
if (v1 instanceof Right) {
return v(z)(v1.value0);
};
throw new Error("Failed pattern match at Data.Either (line 187, column 1 - line 193, column 28): " + [ v.constructor.name, z.constructor.name, v1.constructor.name ]);
};
};
}, function (v) {
return function (z) {
return function (v1) {
if (v1 instanceof Left) {
return z;
};
if (v1 instanceof Right) {
return v(v1.value0)(z);
};
throw new Error("Failed pattern match at Data.Either (line 187, column 1 - line 193, column 28): " + [ v.constructor.name, z.constructor.name, v1.constructor.name ]);
};
};
});
var either = function (v) {
return function (v1) {
return function (v2) {
if (v2 instanceof Left) {
return v(v2.value0);
};
if (v2 instanceof Right) {
return v1(v2.value0);
};
throw new Error("Failed pattern match at Data.Either (line 238, column 1 - line 238, column 64): " + [ v.constructor.name, v1.constructor.name, v2.constructor.name ]);
};
};
};
exports["Left"] = Left;
exports["Right"] = Right;
exports["either"] = either;
exports["functorEither"] = functorEither;
exports["foldableEither"] = foldableEither;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Monad.Except.Trans"] = $PS["Control.Monad.Except.Trans"] || {};
var exports = $PS["Control.Monad.Except.Trans"];
var Control_Alt = $PS["Control.Alt"];
var Control_Applicative = $PS["Control.Applicative"];
var Control_Apply = $PS["Control.Apply"];
var Control_Bind = $PS["Control.Bind"];
var Control_Monad = $PS["Control.Monad"];
var Control_Monad_Error_Class = $PS["Control.Monad.Error.Class"];
var Data_Either = $PS["Data.Either"];
var Data_Functor = $PS["Data.Functor"];
var Data_Semigroup = $PS["Data.Semigroup"];
var ExceptT = function (x) {
return x;
};
var runExceptT = function (v) {
return v;
};
var mapExceptT = function (f) {
return function (v) {
return f(v);
};
};
var functorExceptT = function (dictFunctor) {
return new Data_Functor.Functor(function (f) {
return mapExceptT(Data_Functor.map(dictFunctor)(Data_Functor.map(Data_Either.functorEither)(f)));
});
};
var monadExceptT = function (dictMonad) {
return new Control_Monad.Monad(function () {
return applicativeExceptT(dictMonad);
}, function () {
return bindExceptT(dictMonad);
});
};
var bindExceptT = function (dictMonad) {
return new Control_Bind.Bind(function () {
return applyExceptT(dictMonad);
}, function (v) {
return function (k) {
return Control_Bind.bind(dictMonad.Bind1())(v)(Data_Either.either((function () {
var $98 = Control_Applicative.pure(dictMonad.Applicative0());
return function ($99) {
return $98(Data_Either.Left.create($99));
};
})())(function (a) {
var v1 = k(a);
return v1;
}));
};
});
};
var applyExceptT = function (dictMonad) {
return new Control_Apply.Apply(function () {
return functorExceptT(((dictMonad.Bind1()).Apply0()).Functor0());
}, Control_Monad.ap(monadExceptT(dictMonad)));
};
var applicativeExceptT = function (dictMonad) {
return new Control_Applicative.Applicative(function () {
return applyExceptT(dictMonad);
}, (function () {
var $100 = Control_Applicative.pure(dictMonad.Applicative0());
return function ($101) {
return ExceptT($100(Data_Either.Right.create($101)));
};
})());
};
var monadThrowExceptT = function (dictMonad) {
return new Control_Monad_Error_Class.MonadThrow(function () {
return monadExceptT(dictMonad);
}, (function () {
var $110 = Control_Applicative.pure(dictMonad.Applicative0());
return function ($111) {
return ExceptT($110(Data_Either.Left.create($111)));
};
})());
};
var altExceptT = function (dictSemigroup) {
return function (dictMonad) {
return new Control_Alt.Alt(function () {
return functorExceptT(((dictMonad.Bind1()).Apply0()).Functor0());
}, function (v) {
return function (v1) {
return Control_Bind.bind(dictMonad.Bind1())(v)(function (v2) {
if (v2 instanceof Data_Either.Right) {
return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Either.Right(v2.value0));
};
if (v2 instanceof Data_Either.Left) {
return Control_Bind.bind(dictMonad.Bind1())(v1)(function (v3) {
if (v3 instanceof Data_Either.Right) {
return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Either.Right(v3.value0));
};
if (v3 instanceof Data_Either.Left) {
return Control_Applicative.pure(dictMonad.Applicative0())(new Data_Either.Left(Data_Semigroup.append(dictSemigroup)(v2.value0)(v3.value0)));
};
throw new Error("Failed pattern match at Control.Monad.Except.Trans (line 86, column 9 - line 88, column 49): " + [ v3.constructor.name ]);
});
};
throw new Error("Failed pattern match at Control.Monad.Except.Trans (line 82, column 5 - line 88, column 49): " + [ v2.constructor.name ]);
});
};
});
};
};
exports["runExceptT"] = runExceptT;
exports["functorExceptT"] = functorExceptT;
exports["applyExceptT"] = applyExceptT;
exports["applicativeExceptT"] = applicativeExceptT;
exports["bindExceptT"] = bindExceptT;
exports["altExceptT"] = altExceptT;
exports["monadThrowExceptT"] = monadThrowExceptT;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Newtype"] = $PS["Data.Newtype"] || {};
var exports = $PS["Data.Newtype"];
var Newtype = function (unwrap, wrap) {
this.unwrap = unwrap;
this.wrap = wrap;
};
var unwrap = function (dict) {
return dict.unwrap;
};
exports["unwrap"] = unwrap;
exports["Newtype"] = Newtype;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Identity"] = $PS["Data.Identity"] || {};
var exports = $PS["Data.Identity"];
var Control_Applicative = $PS["Control.Applicative"];
var Control_Apply = $PS["Control.Apply"];
var Control_Bind = $PS["Control.Bind"];
var Control_Monad = $PS["Control.Monad"];
var Data_Functor = $PS["Data.Functor"];
var Data_Newtype = $PS["Data.Newtype"];
var Identity = function (x) {
return x;
};
var newtypeIdentity = new Data_Newtype.Newtype(function (n) {
return n;
}, Identity);
var functorIdentity = new Data_Functor.Functor(function (f) {
return function (m) {
return f(m);
};
});
var applyIdentity = new Control_Apply.Apply(function () {
return functorIdentity;
}, function (v) {
return function (v1) {
return v(v1);
};
});
var bindIdentity = new Control_Bind.Bind(function () {
return applyIdentity;
}, function (v) {
return function (f) {
return f(v);
};
});
var applicativeIdentity = new Control_Applicative.Applicative(function () {
return applyIdentity;
}, Identity);
var monadIdentity = new Control_Monad.Monad(function () {
return applicativeIdentity;
}, function () {
return bindIdentity;
});
exports["newtypeIdentity"] = newtypeIdentity;
exports["functorIdentity"] = functorIdentity;
exports["monadIdentity"] = monadIdentity;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Monad.Except"] = $PS["Control.Monad.Except"] || {};
var exports = $PS["Control.Monad.Except"];
var Control_Monad_Except_Trans = $PS["Control.Monad.Except.Trans"];
var Data_Identity = $PS["Data.Identity"];
var Data_Newtype = $PS["Data.Newtype"];
var runExcept = (function () {
var $0 = Data_Newtype.unwrap(Data_Identity.newtypeIdentity);
return function ($1) {
return $0(Control_Monad_Except_Trans.runExceptT($1));
};
})();
exports["runExcept"] = runExcept;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Control.Plus"] = $PS["Control.Plus"] || {};
var exports = $PS["Control.Plus"];
var Plus = function (Alt0, empty) {
this.Alt0 = Alt0;
this.empty = empty;
};
var empty = function (dict) {
return dict.empty;
};
exports["Plus"] = Plus;
exports["empty"] = empty;
})(PS);
(function(exports) {
"use strict";
//------------------------------------------------------------------------------
// Transformations -------------------------------------------------------------
//------------------------------------------------------------------------------
exports.reverse = function (l) {
return l.slice().reverse();
};
})(PS["Data.Array"] = PS["Data.Array"] || {});
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Array"] = $PS["Data.Array"] || {};
var exports = $PS["Data.Array"];
var $foreign = $PS["Data.Array"];
exports["reverse"] = $foreign.reverse;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Boolean"] = $PS["Data.Boolean"] || {};
var exports = $PS["Data.Boolean"];
var otherwise = true;
exports["otherwise"] = otherwise;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Function"] = $PS["Data.Function"] || {};
var exports = $PS["Data.Function"];
var flip = function (f) {
return function (b) {
return function (a) {
return f(a)(b);
};
};
};
exports["flip"] = flip;
})(PS);
(function(exports) {
"use strict";
exports.showIntImpl = function (n) {
return n.toString();
};
exports.showStringImpl = function (s) {
var l = s.length;
return "\"" + s.replace(
/[\0-\x1F\x7F"\\]/g, // eslint-disable-line no-control-regex
function (c, i) {
switch (c) {
case "\"":
case "\\":
return "\\" + c;
case "\x07": return "\\a";
case "\b": return "\\b";
case "\f": return "\\f";
case "\n": return "\\n";
case "\r": return "\\r";
case "\t": return "\\t";
case "\v": return "\\v";
}
var k = i + 1;
var empty = k < l && s[k] >= "0" && s[k] <= "9" ? "\\&" : "";
return "\\" + c.charCodeAt(0).toString(10) + empty;
}
) + "\"";
};
exports.showArrayImpl = function (f) {
return function (xs) {
var ss = [];
for (var i = 0, l = xs.length; i < l; i++) {
ss[i] = f(xs[i]);
}
return "[" + ss.join(",") + "]";
};
};
})(PS["Data.Show"] = PS["Data.Show"] || {});
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.Show"] = $PS["Data.Show"] || {};
var exports = $PS["Data.Show"];
var $foreign = $PS["Data.Show"];
var Show = function (show) {
this.show = show;
};
var showString = new Show($foreign.showStringImpl);
var showInt = new Show($foreign.showIntImpl);
var show = function (dict) {
return dict.show;
};
var showArray = function (dictShow) {
return new Show($foreign.showArrayImpl(show(dictShow)));
};
exports["Show"] = Show;
exports["show"] = show;
exports["showInt"] = showInt;
exports["showString"] = showString;
exports["showArray"] = showArray;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.NonEmpty"] = $PS["Data.NonEmpty"] || {};
var exports = $PS["Data.NonEmpty"];
var Control_Plus = $PS["Control.Plus"];
var Data_Show = $PS["Data.Show"];
var NonEmpty = (function () {
function NonEmpty(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
NonEmpty.create = function (value0) {
return function (value1) {
return new NonEmpty(value0, value1);
};
};
return NonEmpty;
})();
var singleton = function (dictPlus) {
return function (a) {
return new NonEmpty(a, Control_Plus.empty(dictPlus));
};
};
var showNonEmpty = function (dictShow) {
return function (dictShow1) {
return new Data_Show.Show(function (v) {
return "(NonEmpty " + (Data_Show.show(dictShow)(v.value0) + (" " + (Data_Show.show(dictShow1)(v.value1) + ")")));
});
};
};
exports["NonEmpty"] = NonEmpty;
exports["singleton"] = singleton;
exports["showNonEmpty"] = showNonEmpty;
})(PS);
(function($PS) {
// Generated by purs version 0.13.3
"use strict";
$PS["Data.List.Types"] = $PS["Data.List.Types"] || {};
var exports = $PS["Data.List.Types"];
var Control_Alt = $PS["Control.Alt"];
var Control_Plus = $PS["Control.Plus"];
var Data_Foldable = $PS["Data.Foldable"];
var Data_Function = $PS["Data.Function"];
var Data_Functor = $PS["Data.Functor"];
var Data_Monoid = $PS["Data.Monoid"];
var Data_NonEmpty = $PS["Data.NonEmpty"];
var Data_Semigroup = $PS["Data.Semigroup"];
var Data_Show = $PS["Data.Show"];
var Nil = (function () {
function Nil() {
};
Nil.value = new Nil();
return Nil;
})();
var Cons = (function () {
function Cons(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
Cons.create = function (value0) {
return function (value1) {
return new Cons(value0, value1);
};
};
return Cons;
})();
var NonEmptyList = function (x) {
return x;
};
var toList = function (v) {
return new Cons(v.value0, v.value1);
};
var listMap = function (f) {
var chunkedRevMap = function ($copy_chunksAcc) {
return function ($copy_v) {
var $tco_var_chunksAcc = $copy_chunksAcc;
var $tco_done = false;
var $tco_result;
function $tco_loop(chunksAcc, v) {
if (v instanceof Cons && (v.value1 instanceof Cons && v.value1.value1 instanceof Cons)) {
$tco_var_chunksAcc = new Cons(v, chunksAcc);
$copy_v = v.value1.value1.value1;
return;
};
var unrolledMap = function (v1) {
if (v1 instanceof Cons && (v1.value1 instanceof Cons && v1.value1.value1 instanceof Nil)) {
return new Cons(f(v1.value0), new Cons(f(v1.value1.value0), Nil.value));
};
if (v1 instanceof Cons && v1.value1 instanceof Nil) {
return new Cons(f(v1.value0), Nil.value);
};
return Nil.value;
};
var reverseUnrolledMap = function ($copy_v1) {
return function ($copy_acc) {
var $tco_var_v1 = $copy_v1;
var $tco_done = false;
var $tco_result;
function $tco_loop(v1, acc) {
if (v1 instanceof Cons && (v1.value0 instanceof Cons && (v1.value0.value1 instanceof Cons && v1.value0.value1.value1 instanceof Cons))) {
$tco_var_v1 = v1.value1;
$copy_acc = new Cons(f(v1.value0.value0), new Cons(f(v1.value0.value1.value0), new Cons(f(v1.value0.value1.value1.value0), acc)));
return;
};
$tco_done = true;
return acc;
};
while (!$tco_done) {
$tco_result = $tco_loop($tco_var_v1, $copy_acc);
};
return $tco_result;
};
};
$tco_done = true;
return reverseUnrolledMap(chunksAcc)(unrolledMap(v));
};
while (!$tco_done) {
$tco_result = $tco_loop($tco_var_chunksAcc, $copy_v);
};
return $tco_result;
};
};
return chunkedRevMap(Nil.value);
};
var functorList = new Data_Functor.Functor(listMap);
var foldableList = new Data_Foldable.Foldable(function (dictMonoid) {
return function (f) {
return Data_Foldable.foldl(foldableList)(function (acc) {
var $202 = Data_Semigroup.append(dictMonoid.Semigroup0())(acc);
return function ($203) {
return $202(f($203));
};
})(Data_Monoid.mempty(dictMonoid));
};
}, function (f) {
var go = function ($copy_b) {
return function ($copy_v) {
var $tco_var_b = $copy_b;
var $tco_done = false;
var $tco_result;
function $tco_loop(b, v) {
if (v instanceof Nil) {
$tco_done = true;
return b;
};
if (v instanceof Cons) {
$tco_var_b = f(b)(v.value0);
$copy_v = v.value1;
return;
};
throw new Error("Failed pattern match at Data.List.Types (line 109, column 12 - line 111, column 30): " + [ v.constructor.name ]);
};
while (!$tco_done) {
$tco_result = $tco_loop($tco_var_b, $copy_v);
};
return $tco_result;
};
};
return go;
}, function (f) {
return function (b) {
var rev = Data_Foldable.foldl(foldableList)(Data_Function.flip(Cons.create))(Nil.value);
var $204 = Data_Foldable.foldl(foldableList)(Data_Function.flip(f))(b);
return function ($205) {