@plylang/prelude 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +1818 -2
  2. package/dist/Alt.d.ply +16 -0
  3. package/dist/Alt.js +2 -0
  4. package/dist/Alternative.d.ply +13 -0
  5. package/dist/Alternative.js +16 -0
  6. package/dist/Applicative.d.ply +23 -0
  7. package/dist/Applicative.js +18 -0
  8. package/dist/Apply.d.ply +31 -0
  9. package/dist/Apply.js +37 -0
  10. package/dist/Bifunctor.d.ply +12 -0
  11. package/dist/Bifunctor.js +13 -0
  12. package/dist/Chain.d.ply +22 -0
  13. package/dist/Chain.js +9 -0
  14. package/dist/Composition.d.ply +16 -0
  15. package/dist/Composition.js +38 -0
  16. package/dist/Filterable.d.ply +28 -0
  17. package/dist/Filterable.js +14 -0
  18. package/dist/Foldable.d.ply +63 -0
  19. package/dist/Foldable.js +238 -0
  20. package/dist/Fractional.d.ply +31 -0
  21. package/dist/Fractional.js +11 -0
  22. package/dist/Functor.d.ply +17 -0
  23. package/dist/Functor.js +12 -0
  24. package/dist/Group.d.ply +10 -0
  25. package/dist/Logical.d.ply +37 -0
  26. package/dist/Logical.js +20 -0
  27. package/dist/Monad.d.ply +10 -0
  28. package/dist/Monoid.d.ply +32 -0
  29. package/dist/Monoid.js +21 -0
  30. package/dist/Number.d.ply +56 -0
  31. package/dist/Number.js +90 -0
  32. package/dist/Ord.d.ply +67 -0
  33. package/dist/Ord.js +106 -0
  34. package/dist/Plus.d.ply +16 -0
  35. package/dist/Plus.js +13 -0
  36. package/dist/Prelude.d.ply +51 -0
  37. package/dist/Prelude.js +17 -0
  38. package/dist/Remainder.d.ply +33 -0
  39. package/dist/Remainder.js +26 -0
  40. package/dist/Semigroup.d.ply +30 -0
  41. package/dist/Semigroup.js +19 -0
  42. package/dist/Setoid.d.ply +45 -0
  43. package/dist/Setoid.js +25 -0
  44. package/dist/Show.d.ply +45 -0
  45. package/dist/Show.js +34 -0
  46. package/dist/Traversable.d.ply +33 -0
  47. package/dist/Traversable.js +136 -0
  48. package/dist/Types.d.ply +39 -0
  49. package/dist/Types.js +8 -0
  50. package/foreign/Alt.js +3 -0
  51. package/foreign/Applicative.js +3 -0
  52. package/foreign/Apply.js +9 -0
  53. package/foreign/Chain.js +9 -0
  54. package/foreign/Filterable.js +13 -0
  55. package/foreign/Foldable.js +29 -0
  56. package/foreign/Fractional.js +23 -0
  57. package/foreign/Functor.js +3 -0
  58. package/foreign/Logical.js +11 -0
  59. package/foreign/Number.js +23 -0
  60. package/foreign/Ord.js +34 -0
  61. package/foreign/Remainder.js +32 -0
  62. package/foreign/Semigroup.js +7 -0
  63. package/foreign/Setoid.js +24 -0
  64. package/foreign/Show.js +20 -0
  65. package/foreign/Traversable.js +3 -0
  66. package/foreign/Types.js +52 -0
  67. package/package.json +131 -4
@@ -0,0 +1,12 @@
1
+ import { map_array } from "../foreign/Functor.js";
2
+ export { map_array };
3
+
4
+ export function flip(v0, v1, v2) {
5
+ const v7 = (v3) => {
6
+ const v6 = v3(v1);
7
+ return v6;
8
+ };
9
+ const v8 = v0.map;
10
+ const v9 = v8(v2, v7);
11
+ return v9;
12
+ }
@@ -0,0 +1,10 @@
1
+ language 1
2
+
3
+ @ Group, invert
4
+
5
+ ~ "Monoid" Monoid
6
+
7
+ .. A monoid whose concat has an inverse. No prelude type is an instance.
8
+ & Monoid g => Group g
9
+ .. The value that concats back to empty.
10
+ invert ( g -- g )
@@ -0,0 +1,37 @@
1
+ language 1
2
+
3
+ @ Logical, and, or, not, truth, falsity, implies
4
+
5
+ .. Conjunction, disjunction, negation, and implication.
6
+ .. truth and falsity are the constants, because true and false are keywords.
7
+ & Logical a
8
+ .. Conjunction.
9
+ and ( a a -- a )
10
+ .. Disjunction.
11
+ or ( a a -- a )
12
+ .. The opposite value.
13
+ not ( a -- a )
14
+ .. The constant that and leaves unchanged.
15
+ truth ( -- a )
16
+ .. The constant that or leaves unchanged.
17
+ falsity ( -- a )
18
+
19
+ .. The lower value implies the upper one.
20
+ : implies ( Logical a => a a -- a )
21
+
22
+ # Logical Bool
23
+ and = and_bool
24
+ or = or_bool
25
+ not = not_bool
26
+ truth = truth_bool
27
+ falsity = falsity_bool
28
+
29
+ : foreign and_bool ( Bool Bool -- Bool )
30
+
31
+ : foreign or_bool ( Bool Bool -- Bool )
32
+
33
+ : foreign not_bool ( Bool -- Bool )
34
+
35
+ : truth_bool ( -- Bool )
36
+
37
+ : falsity_bool ( -- Bool )
@@ -0,0 +1,20 @@
1
+ import { and_bool, or_bool, not_bool } from "../foreign/Logical.js";
2
+ export { and_bool, or_bool, not_bool };
3
+
4
+ export function implies(v0, v1, v2) {
5
+ const v3 = v0.not;
6
+ const v4 = v3(v1);
7
+ const v5 = v0.or;
8
+ const v6 = v5(v4, v2);
9
+ return v6;
10
+ }
11
+
12
+ export function truth_bool() {
13
+ const v7 = true;
14
+ return v7;
15
+ }
16
+
17
+ export function falsity_bool() {
18
+ const v8 = false;
19
+ return v8;
20
+ }
@@ -0,0 +1,10 @@
1
+ language 1
2
+
3
+ @ Monad
4
+
5
+ ~ "Applicative" Applicative
6
+
7
+ ~ "Chain" Chain
8
+
9
+ .. One constraint brings both of and chain.
10
+ & Applicative m, Chain m => Monad m
@@ -0,0 +1,32 @@
1
+ language 1
2
+
3
+ @ Monoid, empty
4
+
5
+ ~ "Semigroup" Semigroup
6
+
7
+ ~ "Types" Ordering, EQ
8
+
9
+ .. The empty value of a semigroup. Concat with empty changes nothing.
10
+ & Semigroup a => Monoid a
11
+ .. The value concat leaves unchanged.
12
+ empty ( -- a )
13
+
14
+ # Monoid Str
15
+ empty = empty_str
16
+
17
+ : empty_str ( -- Str )
18
+
19
+ # Monoid Unit
20
+ empty = empty_unit
21
+
22
+ : empty_unit ( -- Unit )
23
+
24
+ # Monoid (Array a)
25
+ empty = empty_array
26
+
27
+ : empty_array ( -- (Array a) )
28
+
29
+ # Monoid Ordering
30
+ empty = empty_ordering
31
+
32
+ : empty_ordering ( -- Ordering )
package/dist/Monoid.js ADDED
@@ -0,0 +1,21 @@
1
+ import { EQ } from "./Types.js";
2
+
3
+ export function empty_str() {
4
+ const v0 = "";
5
+ return v0;
6
+ }
7
+
8
+ export function empty_unit() {
9
+ const v1 = undefined;
10
+ return v1;
11
+ }
12
+
13
+ export function empty_array() {
14
+ const v2 = [];
15
+ return v2;
16
+ }
17
+
18
+ export function empty_ordering() {
19
+ const v3 = EQ;
20
+ return v3;
21
+ }
@@ -0,0 +1,56 @@
1
+ language 1
2
+
3
+ @ Number, add, sub, mul, sign, zero, one, negate, abs, inc, dec
4
+
5
+ ~ "Ord" Ord, lt, gt
6
+
7
+ & Number a
8
+ add ( a a -- a )
9
+ sub ( a a -- a )
10
+ mul ( a a -- a )
11
+ zero ( -- a )
12
+ one ( -- a )
13
+
14
+ : inc ( Number a => a -- a )
15
+
16
+ : dec ( Number a => a -- a )
17
+
18
+ : negate ( Number a => a -- a )
19
+
20
+ : sign ( Number a => Ord a => a -- a )
21
+
22
+ : abs ( Number a => Ord a => a -- a )
23
+
24
+ # Number Int
25
+ add = add_int
26
+ sub = sub_int
27
+ mul = mul_int
28
+ zero = zero_int
29
+ one = one_int
30
+
31
+ : foreign add_int ( Int Int -- Int )
32
+
33
+ : foreign sub_int ( Int Int -- Int )
34
+
35
+ : foreign mul_int ( Int Int -- Int )
36
+
37
+ : zero_int ( -- Int )
38
+
39
+ : one_int ( -- Int )
40
+
41
+ # Number Num
42
+ add = add_num
43
+ sub = sub_num
44
+ mul = mul_num
45
+ zero = zero_num
46
+ one = one_num
47
+
48
+ : foreign add_num ( Num Num -- Num )
49
+
50
+ : foreign sub_num ( Num Num -- Num )
51
+
52
+ : foreign mul_num ( Num Num -- Num )
53
+
54
+ : zero_num ( -- Num )
55
+
56
+ : one_num ( -- Num )
package/dist/Number.js ADDED
@@ -0,0 +1,90 @@
1
+ import { lt, gt } from "./Ord.js";
2
+ import { add_int, sub_int, mul_int, add_num, sub_num, mul_num } from "../foreign/Number.js";
3
+ export { add_int, sub_int, mul_int, add_num, sub_num, mul_num };
4
+
5
+ export function inc(v5, v6) {
6
+ const v7 = v5.one;
7
+ const v8 = v7();
8
+ const v9 = v5.add;
9
+ const v10 = v9(v6, v8);
10
+ return v10;
11
+ }
12
+
13
+ export function dec(v16, v17) {
14
+ const v18 = v16.one;
15
+ const v19 = v18();
16
+ const v20 = v16.sub;
17
+ const v21 = v20(v17, v19);
18
+ return v21;
19
+ }
20
+
21
+ export function negate(v27, v28) {
22
+ const v29 = v27.zero;
23
+ const v30 = v29();
24
+ const v31 = v27.sub;
25
+ const v32 = v31(v30, v28);
26
+ return v32;
27
+ }
28
+
29
+ export function sign(v68, v69, v70) {
30
+ const v71 = v68.zero;
31
+ const v72 = v71();
32
+ const v73 = gt(v69, v70, v72);
33
+ let v119;
34
+ if (v73) {
35
+ const v108 = v68.one;
36
+ const v109 = v108();
37
+ v119 = v109;
38
+ } else {
39
+ const v110 = v68.zero;
40
+ const v111 = v110();
41
+ const v112 = lt(v69, v70, v111);
42
+ let v113;
43
+ if (v112) {
44
+ const v114 = v68.one;
45
+ const v115 = v114();
46
+ const v116 = negate(v68, v115);
47
+ v113 = v116;
48
+ } else {
49
+ const v117 = v68.zero;
50
+ const v118 = v117();
51
+ v113 = v118;
52
+ }
53
+ v119 = v113;
54
+ }
55
+ return v119;
56
+ }
57
+
58
+ export function abs(v131, v132, v133) {
59
+ const v134 = v131.zero;
60
+ const v135 = v134();
61
+ const v136 = lt(v132, v133, v135);
62
+ let v142;
63
+ if (v136) {
64
+ const v141 = negate(v131, v133);
65
+ v142 = v141;
66
+ } else {
67
+ v142 = v133;
68
+ }
69
+ return v142;
70
+ }
71
+
72
+ export function zero_int() {
73
+ const v143 = 0n;
74
+ return v143;
75
+ }
76
+
77
+ export function one_int() {
78
+ const v144 = 1n;
79
+ return v144;
80
+ }
81
+
82
+ export function zero_num() {
83
+ const v145 = 0;
84
+ return v145;
85
+ }
86
+
87
+ export function one_num() {
88
+ const v146 = 1;
89
+ return v146;
90
+ }
package/dist/Ord.d.ply ADDED
@@ -0,0 +1,67 @@
1
+ language 1
2
+
3
+ @ Ord, lte, lt, gt, gte, min, max, clamp, compare
4
+
5
+ ~ "Setoid" Setoid, equal
6
+
7
+ ~ "Types" Ordering, LT, EQ, GT
8
+
9
+ .. A total order. The lower value is compared with the upper one.
10
+ & Setoid a => Ord a
11
+ .. True when the lower value is below the upper one, or they match.
12
+ lte ( a a -- Bool )
13
+
14
+ .. True when the lower value is below the upper one.
15
+ : lt ( Ord a => a a -- Bool )
16
+
17
+ .. True when the lower value is above the upper one.
18
+ : gt ( Ord a => a a -- Bool )
19
+
20
+ .. True when the lower value is above the upper one, or they match.
21
+ : gte ( Ord a => a a -- Bool )
22
+
23
+ .. The smaller value. The lower one stays when they match.
24
+ : min ( Ord a => a a -- a )
25
+
26
+ .. The larger value. The upper one stays when they match.
27
+ : max ( Ord a => a a -- a )
28
+
29
+ .. Lower bound, upper bound, then the value. A value outside the bounds becomes the nearer bound.
30
+ : clamp ( Ord a => a a a -- a )
31
+
32
+ : compare ( Ord a => a a -- Ordering )
33
+
34
+ # Ord Str
35
+ lte = lte_str
36
+
37
+ : foreign lte_str ( Str Str -- Bool )
38
+
39
+ # Ord Num
40
+ lte = lte_num
41
+
42
+ : foreign lte_num ( Num Num -- Bool )
43
+
44
+ # Ord Int
45
+ lte = lte_int
46
+
47
+ : foreign lte_int ( Int Int -- Bool )
48
+
49
+ # Ord Bool
50
+ lte = lte_bool
51
+
52
+ : foreign lte_bool ( Bool Bool -- Bool )
53
+
54
+ # Ord Unit
55
+ lte = lte_unit
56
+
57
+ : foreign lte_unit ( Unit Unit -- Bool )
58
+
59
+ # Ord (Array a)
60
+ lte = lte_array
61
+
62
+ : foreign lte_array ( Ord a => (Array a) (Array a) -- Bool )
63
+
64
+ # Ord Ordering
65
+ lte = lte_ordering
66
+
67
+ : lte_ordering ( Ordering Ordering -- Bool )
package/dist/Ord.js ADDED
@@ -0,0 +1,106 @@
1
+ import { LT, EQ, GT } from "./Types.js";
2
+ import { equal_ordering } from "./Setoid.js";
3
+ import { lte_str, lte_num, lte_int, lte_bool, lte_unit, lte_array } from "../foreign/Ord.js";
4
+ export { lte_str, lte_num, lte_int, lte_bool, lte_unit, lte_array };
5
+
6
+ export function lt(v0, v1, v2) {
7
+ const v3 = v0.lte;
8
+ const v4 = v3(v2, v1);
9
+ let v11;
10
+ if (v4) {
11
+ const v9 = false;
12
+ v11 = v9;
13
+ } else {
14
+ const v10 = true;
15
+ v11 = v10;
16
+ }
17
+ return v11;
18
+ }
19
+
20
+ export function gt(v12, v13, v14) {
21
+ const v15 = lt(v12, v14, v13);
22
+ return v15;
23
+ }
24
+
25
+ export function gte(v16, v17, v18) {
26
+ const v19 = v16.lte;
27
+ const v20 = v19(v18, v17);
28
+ return v20;
29
+ }
30
+
31
+ export function min(v21, v22, v23) {
32
+ const v24 = v21.lte;
33
+ const v25 = v24(v22, v23);
34
+ let v30;
35
+ if (v25) {
36
+ v30 = v22;
37
+ } else {
38
+ v30 = v23;
39
+ }
40
+ return v30;
41
+ }
42
+
43
+ export function max(v31, v32, v33) {
44
+ const v34 = v31.lte;
45
+ const v35 = v34(v32, v33);
46
+ let v40;
47
+ if (v35) {
48
+ v40 = v33;
49
+ } else {
50
+ v40 = v32;
51
+ }
52
+ return v40;
53
+ }
54
+
55
+ export function clamp(v41, v42, v43, v44) {
56
+ const v45 = min(v41, v43, v44);
57
+ const v46 = max(v41, v42, v45);
58
+ return v46;
59
+ }
60
+
61
+ export function compare(v47, v48, v49) {
62
+ const v50 = v47.lte;
63
+ const v51 = v50(v48, v49);
64
+ let v81;
65
+ if (v51) {
66
+ const v74 = v47.Setoid;
67
+ const v75 = v74.equal;
68
+ const v76 = v75(v48, v49);
69
+ let v77;
70
+ if (v76) {
71
+ const v78 = EQ;
72
+ v77 = v78;
73
+ } else {
74
+ const v79 = LT;
75
+ v77 = v79;
76
+ }
77
+ v81 = v77;
78
+ } else {
79
+ const v80 = GT;
80
+ v81 = v80;
81
+ }
82
+ return v81;
83
+ }
84
+
85
+ export function lte_ordering(v82, v83) {
86
+ const v84 = equal_ordering(v82, v83);
87
+ let v118;
88
+ if (v84) {
89
+ const v111 = true;
90
+ v118 = v111;
91
+ } else {
92
+ const v112 = LT;
93
+ const v113 = equal_ordering(v82, v112);
94
+ let v114;
95
+ if (v113) {
96
+ const v115 = true;
97
+ v114 = v115;
98
+ } else {
99
+ const v116 = GT;
100
+ const v117 = equal_ordering(v83, v116);
101
+ v114 = v117;
102
+ }
103
+ v118 = v114;
104
+ }
105
+ return v118;
106
+ }
@@ -0,0 +1,16 @@
1
+ language 1
2
+
3
+ @ Plus, init, oneOf
4
+
5
+ ~ "Alt" Alt, alt
6
+
7
+ ~ "Foldable" Foldable, fold
8
+
9
+ .. The value that loses to every other one. alt with it changes nothing.
10
+ & Alt f => Plus f
11
+ .. The value that loses. alt with it changes nothing.
12
+ init ( -- (f a) )
13
+
14
+ .. Folds with alt, starting from init.
15
+ .. Maybe keeps the first Just. Array appends every piece, lower first.
16
+ : oneOf ( Foldable t => Plus f => (t (f a)) -- (f a) )
package/dist/Plus.js ADDED
@@ -0,0 +1,13 @@
1
+ export function oneOf(v15, v16, v17) {
2
+ const v18 = v16.init;
3
+ const v19 = v18();
4
+ const v28 = (v20, v21) => {
5
+ const v25 = v16.Alt;
6
+ const v26 = v25.alt;
7
+ const v27 = v26(v20, v21);
8
+ return v27;
9
+ };
10
+ const v29 = v15.fold;
11
+ const v30 = v29(v17, v19, v28);
12
+ return v30;
13
+ }
@@ -0,0 +1,51 @@
1
+ language 1
2
+
3
+ @ Alt, alt, Alternative, guard, Applicative, of, append, prepend, Apply, ap, lift2, lift3, apFirst, apSecond, Bifunctor, bimap, mapLeft, mapRight, Chain, chain, join, compose, id, curry2, curry3, Filterable, filter, partition, reject, Foldable, fold, size, all, any, none, elem, intercalate, foldMap, reverse, sortBy, sort, Fractional, fdiv, floor, ceil, round, trunc, recip, Functor, map, flip, Group, invert, Logical, and, or, not, truth, falsity, implies, Monad, Monoid, empty, Number, add, sub, mul, sign, zero, one, negate, abs, inc, dec, Ord, lte, lt, gt, gte, min, max, clamp, compare, Plus, init, oneOf, Remainder, quotRem, quot, rem, divMod, div, mod, Semigroup, concat, Setoid, equal, Show, show, Traversable, traverse, sequence, Ordering, LT, EQ, GT
4
+
5
+ ~ "Alt" Alt, alt
6
+
7
+ ~ "Alternative" Alternative, guard
8
+
9
+ ~ "Applicative" Applicative, of, append, prepend
10
+
11
+ ~ "Apply" Apply, ap, lift2, lift3, apFirst, apSecond
12
+
13
+ ~ "Bifunctor" Bifunctor, bimap, mapLeft, mapRight
14
+
15
+ ~ "Chain" Chain, chain, join
16
+
17
+ ~ "Composition" compose, id, curry2, curry3
18
+
19
+ ~ "Filterable" Filterable, filter, partition, reject
20
+
21
+ ~ "Foldable" Foldable, fold, size, all, any, none, elem, intercalate, foldMap, reverse, sortBy, sort
22
+
23
+ ~ "Fractional" Fractional, fdiv, floor, ceil, round, trunc, recip
24
+
25
+ ~ "Functor" Functor, map, flip
26
+
27
+ ~ "Group" Group, invert
28
+
29
+ ~ "Logical" Logical, and, or, not, truth, falsity, implies
30
+
31
+ ~ "Monad" Monad
32
+
33
+ ~ "Monoid" Monoid, empty
34
+
35
+ ~ "Number" Number, add, sub, mul, sign, zero, one, negate, abs, inc, dec
36
+
37
+ ~ "Ord" Ord, lte, lt, gt, gte, min, max, clamp, compare
38
+
39
+ ~ "Plus" Plus, init, oneOf
40
+
41
+ ~ "Remainder" Remainder, quotRem, quot, rem, divMod, div, mod
42
+
43
+ ~ "Semigroup" Semigroup, concat
44
+
45
+ ~ "Setoid" Setoid, equal
46
+
47
+ ~ "Show" Show, show
48
+
49
+ ~ "Traversable" Traversable, traverse, sequence
50
+
51
+ ~ "Types" Ordering, LT, EQ, GT
@@ -0,0 +1,17 @@
1
+ export { guard } from "./Alternative.js";
2
+ export { append, prepend } from "./Applicative.js";
3
+ export { lift2, lift3, apFirst, apSecond } from "./Apply.js";
4
+ export { mapLeft, mapRight } from "./Bifunctor.js";
5
+ export { join } from "./Chain.js";
6
+ export { compose, id, curry2, curry3 } from "./Composition.js";
7
+ export { reject } from "./Filterable.js";
8
+ export { size, all, any, none, elem, intercalate, foldMap, reverse, sortBy, sort } from "./Foldable.js";
9
+ export { recip } from "./Fractional.js";
10
+ export { flip } from "./Functor.js";
11
+ export { implies } from "./Logical.js";
12
+ export { sign, negate, abs, inc, dec } from "./Number.js";
13
+ export { lt, gt, gte, min, max, clamp, compare } from "./Ord.js";
14
+ export { oneOf } from "./Plus.js";
15
+ export { quot, rem, div, mod } from "./Remainder.js";
16
+ export { sequence } from "./Traversable.js";
17
+ export { LT, EQ, GT } from "./Types.js";
@@ -0,0 +1,33 @@
1
+ language 1
2
+
3
+ @ Remainder, quotRem, quot, rem, divMod, div, mod
4
+
5
+ ~ "Number" Number
6
+
7
+ & Number a => Remainder a
8
+ quotRem ( a a -- a a )
9
+ divMod ( a a -- a a )
10
+
11
+ : quot ( Remainder a => a a -- a )
12
+
13
+ : rem ( Remainder a => a a -- a )
14
+
15
+ : div ( Remainder a => a a -- a )
16
+
17
+ : mod ( Remainder a => a a -- a )
18
+
19
+ # Remainder Int
20
+ quotRem = quotRem_int
21
+ divMod = divMod_int
22
+
23
+ : foreign quotRem_int ( Int Int -- Int Int )
24
+
25
+ : foreign divMod_int ( Int Int -- Int Int )
26
+
27
+ # Remainder Num
28
+ quotRem = quotRem_num
29
+ divMod = divMod_num
30
+
31
+ : foreign quotRem_num ( Num Num -- Num Num )
32
+
33
+ : foreign divMod_num ( Num Num -- Num Num )
@@ -0,0 +1,26 @@
1
+ import { quotRem_int, divMod_int, quotRem_num, divMod_num } from "../foreign/Remainder.js";
2
+ export { quotRem_int, divMod_int, quotRem_num, divMod_num };
3
+
4
+ export function quot(v0, v1, v2) {
5
+ const v3 = v0.quotRem;
6
+ const [v4, v5] = v3(v1, v2);
7
+ return v4;
8
+ }
9
+
10
+ export function rem(v6, v7, v8) {
11
+ const v9 = v6.quotRem;
12
+ const [v10, v11] = v9(v7, v8);
13
+ return v11;
14
+ }
15
+
16
+ export function div(v12, v13, v14) {
17
+ const v15 = v12.divMod;
18
+ const [v16, v17] = v15(v13, v14);
19
+ return v16;
20
+ }
21
+
22
+ export function mod(v18, v19, v20) {
23
+ const v21 = v18.divMod;
24
+ const [v22, v23] = v21(v19, v20);
25
+ return v23;
26
+ }
@@ -0,0 +1,30 @@
1
+ language 1
2
+
3
+ @ Semigroup, concat
4
+
5
+ ~ "Types" Ordering, LT, EQ, GT
6
+
7
+ .. Join the lower value with the upper one.
8
+ & Semigroup a
9
+ .. The lower value joined with the upper one.
10
+ concat ( a a -- a )
11
+
12
+ # Semigroup Str
13
+ concat = concat_str
14
+
15
+ : foreign concat_str ( Str Str -- Str )
16
+
17
+ # Semigroup Unit
18
+ concat = concat_unit
19
+
20
+ : concat_unit ( Unit Unit -- Unit )
21
+
22
+ # Semigroup (Array a)
23
+ concat = concat_array
24
+
25
+ : foreign concat_array ( (Array a) (Array a) -- (Array a) )
26
+
27
+ # Semigroup Ordering
28
+ concat = concat_ordering
29
+
30
+ : concat_ordering ( Ordering Ordering -- Ordering )
@@ -0,0 +1,19 @@
1
+ import { concat_str, concat_array } from "../foreign/Semigroup.js";
2
+ export { concat_str, concat_array };
3
+
4
+ export function concat_unit(v0, v1) {
5
+ const v2 = undefined;
6
+ return v2;
7
+ }
8
+
9
+ export function concat_ordering(v3, v4) {
10
+ let v5;
11
+ if (v3.$$tag === "LT") {
12
+ v5 = v3;
13
+ } else if (v3.$$tag === "GT") {
14
+ v5 = v3;
15
+ } else {
16
+ v5 = v4;
17
+ }
18
+ return v5;
19
+ }