@plylang/prelude 0.0.0-stage → 1.0.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.
- package/README.md +1679 -2
- package/dist/Alt.d.ply +16 -0
- package/dist/Alt.js +2 -0
- package/dist/Alternative.d.ply +13 -0
- package/dist/Alternative.js +16 -0
- package/dist/Applicative.d.ply +23 -0
- package/dist/Applicative.js +18 -0
- package/dist/Apply.d.ply +31 -0
- package/dist/Apply.js +37 -0
- package/dist/Arithmetic.d.ply +83 -0
- package/dist/Arithmetic.js +54 -0
- package/dist/Bifunctor.d.ply +12 -0
- package/dist/Bifunctor.js +13 -0
- package/dist/Chain.d.ply +22 -0
- package/dist/Chain.js +9 -0
- package/dist/Composition.d.ply +16 -0
- package/dist/Composition.js +38 -0
- package/dist/Filterable.d.ply +28 -0
- package/dist/Filterable.js +14 -0
- package/dist/Foldable.d.ply +63 -0
- package/dist/Foldable.js +238 -0
- package/dist/Functor.d.ply +17 -0
- package/dist/Functor.js +12 -0
- package/dist/Group.d.ply +10 -0
- package/dist/Logical.d.ply +37 -0
- package/dist/Logical.js +20 -0
- package/dist/Monad.d.ply +10 -0
- package/dist/Monoid.d.ply +32 -0
- package/dist/Monoid.js +21 -0
- package/dist/Ord.d.ply +67 -0
- package/dist/Ord.js +106 -0
- package/dist/Plus.d.ply +16 -0
- package/dist/Plus.js +13 -0
- package/dist/Prelude.d.ply +47 -0
- package/dist/Prelude.js +15 -0
- package/dist/Semigroup.d.ply +30 -0
- package/dist/Semigroup.js +19 -0
- package/dist/Setoid.d.ply +45 -0
- package/dist/Setoid.js +25 -0
- package/dist/Show.d.ply +45 -0
- package/dist/Show.js +34 -0
- package/dist/Traversable.d.ply +31 -0
- package/dist/Traversable.js +134 -0
- package/dist/Types.d.ply +39 -0
- package/dist/Types.js +8 -0
- package/foreign/Alt.js +3 -0
- package/foreign/Applicative.js +3 -0
- package/foreign/Apply.js +9 -0
- package/foreign/Arithmetic.js +57 -0
- package/foreign/Chain.js +9 -0
- package/foreign/Filterable.js +13 -0
- package/foreign/Foldable.js +29 -0
- package/foreign/Functor.js +3 -0
- package/foreign/Logical.js +11 -0
- package/foreign/Ord.js +34 -0
- package/foreign/Semigroup.js +7 -0
- package/foreign/Setoid.js +24 -0
- package/foreign/Show.js +20 -0
- package/foreign/Traversable.js +3 -0
- package/foreign/Types.js +52 -0
- package/package.json +131 -4
package/dist/Foldable.js
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { append, prepend, of_array } from "./Applicative.js";
|
|
2
|
+
import { inc, add_num, div_num, mod_num, mult_num, negate_num, one_num, sub_num, zero_num } from "./Arithmetic.js";
|
|
3
|
+
import { and_bool, not_bool, or_bool } from "./Logical.js";
|
|
4
|
+
import { ap_array } from "./Apply.js";
|
|
5
|
+
import { concat_array } from "./Semigroup.js";
|
|
6
|
+
import { is_array } from "./Types.js";
|
|
7
|
+
import { map_array } from "./Functor.js";
|
|
8
|
+
import { size_array, all_array, any_array, reverse_array, sort_array, fold_array } from "../foreign/Foldable.js";
|
|
9
|
+
export { fold_array };
|
|
10
|
+
|
|
11
|
+
export const Store = (v0, v1) => ({ $$tag: "Store", empty: v0, value: v1 });
|
|
12
|
+
|
|
13
|
+
export const Keyed = (v0, v1, v2) => ({ $$tag: "Keyed", idx: v0, item: v1, key: v2 });
|
|
14
|
+
|
|
15
|
+
const v6 = ({ add: add_num, sub: sub_num, mult: mult_num, div: div_num, mod: mod_num, negate: negate_num, zero: zero_num, one: one_num });
|
|
16
|
+
const v274 = ({ fold: fold_array });
|
|
17
|
+
const v279 = ({ map: map_array });
|
|
18
|
+
const v280 = ({ ap: ap_array, Functor: v279 });
|
|
19
|
+
const v281 = ({ of: of_array, Apply: v280 });
|
|
20
|
+
const v282 = ({ concat: concat_array });
|
|
21
|
+
|
|
22
|
+
export function size(v0, v1) {
|
|
23
|
+
let v12;
|
|
24
|
+
if (is_array(v1)) {
|
|
25
|
+
const v2 = size_array(v1);
|
|
26
|
+
v12 = v2;
|
|
27
|
+
} else {
|
|
28
|
+
const v3 = 0;
|
|
29
|
+
const v9 = (v4, v5) => {
|
|
30
|
+
const v8 = inc(v6, v4);
|
|
31
|
+
return v8;
|
|
32
|
+
};
|
|
33
|
+
const v10 = v0.fold;
|
|
34
|
+
const v11 = v10(v1, v3, v9);
|
|
35
|
+
v12 = v11;
|
|
36
|
+
}
|
|
37
|
+
return v12;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function all(v13, v14, v15) {
|
|
41
|
+
let v28;
|
|
42
|
+
if (is_array(v14)) {
|
|
43
|
+
const v16 = all_array(v14, v15);
|
|
44
|
+
v28 = v16;
|
|
45
|
+
} else {
|
|
46
|
+
const v17 = true;
|
|
47
|
+
const v25 = (v18, v19) => {
|
|
48
|
+
const v23 = v15(v19);
|
|
49
|
+
const v24 = and_bool(v18, v23);
|
|
50
|
+
return v24;
|
|
51
|
+
};
|
|
52
|
+
const v26 = v13.fold;
|
|
53
|
+
const v27 = v26(v14, v17, v25);
|
|
54
|
+
v28 = v27;
|
|
55
|
+
}
|
|
56
|
+
return v28;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function any(v29, v30, v31) {
|
|
60
|
+
let v44;
|
|
61
|
+
if (is_array(v30)) {
|
|
62
|
+
const v32 = any_array(v30, v31);
|
|
63
|
+
v44 = v32;
|
|
64
|
+
} else {
|
|
65
|
+
const v33 = false;
|
|
66
|
+
const v41 = (v34, v35) => {
|
|
67
|
+
const v39 = v31(v35);
|
|
68
|
+
const v40 = or_bool(v34, v39);
|
|
69
|
+
return v40;
|
|
70
|
+
};
|
|
71
|
+
const v42 = v29.fold;
|
|
72
|
+
const v43 = v42(v30, v33, v41);
|
|
73
|
+
v44 = v43;
|
|
74
|
+
}
|
|
75
|
+
return v44;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function none(v45, v46, v47) {
|
|
79
|
+
const v48 = any(v45, v46, v47);
|
|
80
|
+
const v49 = not_bool(v48);
|
|
81
|
+
return v49;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function elem(v50, v51, v52, v53) {
|
|
85
|
+
const v60 = (v54) => {
|
|
86
|
+
const v58 = v50.equal;
|
|
87
|
+
const v59 = v58(v54, v53);
|
|
88
|
+
return v59;
|
|
89
|
+
};
|
|
90
|
+
const v61 = any(v51, v52, v60);
|
|
91
|
+
return v61;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function intercalate(v76, v77, v78, v79) {
|
|
95
|
+
const v80 = emptyStore(v76);
|
|
96
|
+
const v86 = (v81, v82) => {
|
|
97
|
+
const v85 = step(v76, v81, v82, v79);
|
|
98
|
+
return v85;
|
|
99
|
+
};
|
|
100
|
+
const v87 = v77.fold;
|
|
101
|
+
const v88 = v87(v78, v80, v86);
|
|
102
|
+
const v89 = v88.value;
|
|
103
|
+
return v89;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function emptyStore(v94) {
|
|
107
|
+
const v95 = true;
|
|
108
|
+
const v96 = v94.empty;
|
|
109
|
+
const v97 = v96();
|
|
110
|
+
const v98 = Store(v95, v97);
|
|
111
|
+
return v98;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function step(v99, v100, v101, v102) {
|
|
115
|
+
const v106 = v100.value;
|
|
116
|
+
const v110 = v100.empty;
|
|
117
|
+
let v129;
|
|
118
|
+
let v130;
|
|
119
|
+
if (v110) {
|
|
120
|
+
v129 = v106;
|
|
121
|
+
v130 = v101;
|
|
122
|
+
} else {
|
|
123
|
+
const v126 = v99.Semigroup;
|
|
124
|
+
const v127 = v126.concat;
|
|
125
|
+
const v128 = v127(v102, v101);
|
|
126
|
+
v129 = v106;
|
|
127
|
+
v130 = v128;
|
|
128
|
+
}
|
|
129
|
+
const v131 = v99.Semigroup;
|
|
130
|
+
const v132 = v131.concat;
|
|
131
|
+
const v133 = v132(v129, v130);
|
|
132
|
+
const v134 = false;
|
|
133
|
+
const v135 = Store(v134, v133);
|
|
134
|
+
return v135;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function foldMap(v155, v156, v157, v158) {
|
|
138
|
+
const v159 = v155.empty;
|
|
139
|
+
const v160 = v159();
|
|
140
|
+
const v172 = (v161, v162) => {
|
|
141
|
+
const v168 = v158(v162);
|
|
142
|
+
const v169 = v155.Semigroup;
|
|
143
|
+
const v170 = v169.concat;
|
|
144
|
+
const v171 = v170(v161, v168);
|
|
145
|
+
return v171;
|
|
146
|
+
};
|
|
147
|
+
const v173 = v156.fold;
|
|
148
|
+
const v174 = v173(v157, v160, v172);
|
|
149
|
+
return v174;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function reverse(v189, v190, v191, v192) {
|
|
153
|
+
let v205;
|
|
154
|
+
if (is_array(v192)) {
|
|
155
|
+
const v193 = reverse_array(v192);
|
|
156
|
+
v205 = v193;
|
|
157
|
+
} else {
|
|
158
|
+
const v194 = v191.empty;
|
|
159
|
+
const v195 = v194();
|
|
160
|
+
const v202 = (v196, v197) => {
|
|
161
|
+
const v200 = v191.Semigroup;
|
|
162
|
+
const v201 = prepend(v189, v200, v196, v197);
|
|
163
|
+
return v201;
|
|
164
|
+
};
|
|
165
|
+
const v203 = v190.fold;
|
|
166
|
+
const v204 = v203(v192, v195, v202);
|
|
167
|
+
v205 = v204;
|
|
168
|
+
}
|
|
169
|
+
return v205;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function sortBy(v236, v237, v238, v239, v240, v241) {
|
|
173
|
+
const v242 = [];
|
|
174
|
+
const v248 = (v243, v244) => {
|
|
175
|
+
const v247 = keyed(v243, v244, v241);
|
|
176
|
+
return v247;
|
|
177
|
+
};
|
|
178
|
+
const v249 = v238.fold;
|
|
179
|
+
const v250 = v249(v240, v242, v248);
|
|
180
|
+
const v255 = (v251, v252) => {
|
|
181
|
+
const v254 = compareKeyed(v236, v251, v252);
|
|
182
|
+
return v254;
|
|
183
|
+
};
|
|
184
|
+
const v256 = sort_array(v250, v255);
|
|
185
|
+
const v257 = v239.empty;
|
|
186
|
+
const v258 = v257();
|
|
187
|
+
const v267 = (v259, v260) => {
|
|
188
|
+
const v264 = v260.item;
|
|
189
|
+
const v265 = v239.Semigroup;
|
|
190
|
+
const v266 = append(v237, v265, v259, v264);
|
|
191
|
+
return v266;
|
|
192
|
+
};
|
|
193
|
+
const v268 = fold_array(v256, v258, v267);
|
|
194
|
+
return v268;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function keyed(v269, v270, v271) {
|
|
198
|
+
const v272 = v271(v270);
|
|
199
|
+
const v277 = size(v274, v269);
|
|
200
|
+
const v278 = Keyed(v277, v270, v272);
|
|
201
|
+
const v283 = append(v281, v282, v269, v278);
|
|
202
|
+
return v283;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function compareKeyed(v284, v285, v286) {
|
|
206
|
+
const v290 = v285.key;
|
|
207
|
+
const v291 = v286.key;
|
|
208
|
+
const v292 = v284.lte;
|
|
209
|
+
const v293 = v292(v290, v291);
|
|
210
|
+
let v346;
|
|
211
|
+
if (v293) {
|
|
212
|
+
const v336 = v285.key;
|
|
213
|
+
const v337 = v286.key;
|
|
214
|
+
const v338 = v284.lte;
|
|
215
|
+
const v339 = v338(v337, v336);
|
|
216
|
+
let v340;
|
|
217
|
+
if (v339) {
|
|
218
|
+
const v341 = v285.idx;
|
|
219
|
+
const v342 = v286.idx;
|
|
220
|
+
const v343 = sub_num(v341, v342);
|
|
221
|
+
v340 = v343;
|
|
222
|
+
} else {
|
|
223
|
+
const v344 = -1;
|
|
224
|
+
v340 = v344;
|
|
225
|
+
}
|
|
226
|
+
v346 = v340;
|
|
227
|
+
} else {
|
|
228
|
+
const v345 = 1;
|
|
229
|
+
v346 = v345;
|
|
230
|
+
}
|
|
231
|
+
return v346;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function sort(v347, v348, v349, v350, v351) {
|
|
235
|
+
const v353 = (v352) => v352;
|
|
236
|
+
const v354 = sortBy(v347, v348, v349, v350, v351, v353);
|
|
237
|
+
return v354;
|
|
238
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
language 1
|
|
2
|
+
|
|
3
|
+
@ Functor, map, flip
|
|
4
|
+
|
|
5
|
+
~ "Arithmetic" mult, add
|
|
6
|
+
|
|
7
|
+
.. Apply a quotation inside the container. The quotation is on top.
|
|
8
|
+
& Functor f
|
|
9
|
+
.. The container of results. The quotation is on top.
|
|
10
|
+
map ( (f a) (a -- b) -- (f b) )
|
|
11
|
+
|
|
12
|
+
: flip ( Functor f => a (f (a -- b)) -- (f b) )
|
|
13
|
+
|
|
14
|
+
# Functor Array
|
|
15
|
+
map = map_array
|
|
16
|
+
|
|
17
|
+
: foreign map_array ( (Array a) (a -- b) -- (Array b) )
|
package/dist/Functor.js
ADDED
package/dist/Group.d.ply
ADDED
|
@@ -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 )
|
package/dist/Logical.js
ADDED
|
@@ -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
|
+
}
|
package/dist/Monad.d.ply
ADDED
|
@@ -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
|
+
}
|
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
|
+
}
|
package/dist/Plus.d.ply
ADDED
|
@@ -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,47 @@
|
|
|
1
|
+
language 1
|
|
2
|
+
|
|
3
|
+
@ Alt, alt, Alternative, guard, Applicative, of, append, prepend, Apply, ap, lift2, lift3, apFirst, apSecond, Arithmetic, add, sub, mult, div, mod, negate, zero, one, inc, dec, abs, 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, Functor, map, flip, Group, invert, Logical, and, or, not, truth, falsity, implies, Monad, Monoid, empty, Ord, lte, lt, gt, gte, min, max, clamp, compare, Plus, init, oneOf, 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
|
+
~ "Arithmetic" Arithmetic, add, sub, mult, div, mod, negate, zero, one, inc, dec, abs
|
|
14
|
+
|
|
15
|
+
~ "Bifunctor" Bifunctor, bimap, mapLeft, mapRight
|
|
16
|
+
|
|
17
|
+
~ "Chain" Chain, chain, join
|
|
18
|
+
|
|
19
|
+
~ "Composition" compose, id, curry2, curry3
|
|
20
|
+
|
|
21
|
+
~ "Filterable" Filterable, filter, partition, reject
|
|
22
|
+
|
|
23
|
+
~ "Foldable" Foldable, fold, size, all, any, none, elem, intercalate, foldMap, reverse, sortBy, sort
|
|
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
|
+
~ "Ord" Ord, lte, lt, gt, gte, min, max, clamp, compare
|
|
36
|
+
|
|
37
|
+
~ "Plus" Plus, init, oneOf
|
|
38
|
+
|
|
39
|
+
~ "Semigroup" Semigroup, concat
|
|
40
|
+
|
|
41
|
+
~ "Setoid" Setoid, equal
|
|
42
|
+
|
|
43
|
+
~ "Show" Show, show
|
|
44
|
+
|
|
45
|
+
~ "Traversable" Traversable, traverse, sequence
|
|
46
|
+
|
|
47
|
+
~ "Types" Ordering, LT, EQ, GT
|
package/dist/Prelude.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { guard } from "./Alternative.js";
|
|
2
|
+
export { append, prepend } from "./Applicative.js";
|
|
3
|
+
export { lift2, lift3, apFirst, apSecond } from "./Apply.js";
|
|
4
|
+
export { inc, dec, abs } from "./Arithmetic.js";
|
|
5
|
+
export { mapLeft, mapRight } from "./Bifunctor.js";
|
|
6
|
+
export { join } from "./Chain.js";
|
|
7
|
+
export { compose, id, curry2, curry3 } from "./Composition.js";
|
|
8
|
+
export { reject } from "./Filterable.js";
|
|
9
|
+
export { size, all, any, none, elem, intercalate, foldMap, reverse, sortBy, sort } from "./Foldable.js";
|
|
10
|
+
export { flip } from "./Functor.js";
|
|
11
|
+
export { implies } from "./Logical.js";
|
|
12
|
+
export { lt, gt, gte, min, max, clamp, compare } from "./Ord.js";
|
|
13
|
+
export { oneOf } from "./Plus.js";
|
|
14
|
+
export { sequence } from "./Traversable.js";
|
|
15
|
+
export { LT, EQ, GT } from "./Types.js";
|
|
@@ -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 )
|