@nakafa/aksara-contracts 8.10.0 → 8.13.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/dist/visual/biology/binomial.d.ts +139 -0
- package/dist/visual/biology/binomial.js +46 -0
- package/dist/visual/biology/bone.d.ts +141 -0
- package/dist/visual/biology/bone.js +46 -0
- package/dist/visual/biology/chromosome.d.ts +139 -0
- package/dist/visual/biology/chromosome.js +42 -0
- package/dist/visual/biology/control.d.ts +17 -0
- package/dist/visual/biology/control.js +21 -0
- package/dist/visual/biology/denature.d.ts +159 -0
- package/dist/visual/biology/denature.js +74 -0
- package/dist/visual/biology/drawing.d.ts +151 -0
- package/dist/visual/biology/drawing.js +69 -0
- package/dist/visual/biology/enzyme.d.ts +145 -0
- package/dist/visual/biology/enzyme.js +54 -0
- package/dist/visual/biology/equipment.d.ts +140 -0
- package/dist/visual/biology/equipment.js +64 -0
- package/dist/visual/biology/gametogenesis.d.ts +145 -0
- package/dist/visual/biology/gametogenesis.js +83 -0
- package/dist/visual/biology/implantation.d.ts +138 -0
- package/dist/visual/biology/implantation.js +44 -0
- package/dist/visual/biology/joint.d.ts +140 -0
- package/dist/visual/biology/joint.js +47 -0
- package/dist/visual/biology/key.d.ts +141 -0
- package/dist/visual/biology/key.js +58 -0
- package/dist/visual/biology/kingdom.d.ts +142 -0
- package/dist/visual/biology/kingdom.js +82 -0
- package/dist/visual/biology/lactase.d.ts +147 -0
- package/dist/visual/biology/lactase.js +48 -0
- package/dist/visual/biology/leaf.d.ts +436 -0
- package/dist/visual/biology/leaf.js +151 -0
- package/dist/visual/biology/limb.d.ts +139 -0
- package/dist/visual/biology/limb.js +44 -0
- package/dist/visual/biology/lipid.d.ts +144 -0
- package/dist/visual/biology/lipid.js +43 -0
- package/dist/visual/biology/locomotion.d.ts +141 -0
- package/dist/visual/biology/locomotion.js +48 -0
- package/dist/visual/biology/menstrual.d.ts +148 -0
- package/dist/visual/biology/menstrual.js +65 -0
- package/dist/visual/biology/metamorphosis.d.ts +140 -0
- package/dist/visual/biology/metamorphosis.js +34 -0
- package/dist/visual/biology/placenta.d.ts +139 -0
- package/dist/visual/biology/placenta.js +52 -0
- package/dist/visual/biology/planes.d.ts +145 -0
- package/dist/visual/biology/planes.js +62 -0
- package/dist/visual/biology/protein.d.ts +142 -0
- package/dist/visual/biology/protein.js +41 -0
- package/dist/visual/biology/saturation.d.ts +149 -0
- package/dist/visual/biology/saturation.js +40 -0
- package/dist/visual/biology/secretion.d.ts +149 -0
- package/dist/visual/biology/secretion.js +79 -0
- package/dist/visual/biology/spill.d.ts +165 -0
- package/dist/visual/biology/spill.js +58 -0
- package/dist/visual/biology/sugar.d.ts +152 -0
- package/dist/visual/biology/sugar.js +59 -0
- package/dist/visual/biology/taxon.d.ts +138 -0
- package/dist/visual/biology/taxon.js +50 -0
- package/dist/visual/biology/tissue.d.ts +424 -0
- package/dist/visual/biology/tissue.js +140 -0
- package/dist/visual/biology/twins.d.ts +144 -0
- package/dist/visual/biology/twins.js +60 -0
- package/dist/visual/biology/vernacular.d.ts +141 -0
- package/dist/visual/biology/vernacular.js +57 -0
- package/dist/visual/biology/vertebra.d.ts +141 -0
- package/dist/visual/biology/vertebra.js +59 -0
- package/dist/visual/biology/waste.d.ts +140 -0
- package/dist/visual/biology/waste.js +57 -0
- package/dist/visual/biology/water.d.ts +152 -0
- package/dist/visual/biology/water.js +54 -0
- package/dist/visual/card.d.ts +11 -0
- package/dist/visual/card.js +17 -1
- package/dist/visual/catalog.d.ts +6886 -754
- package/dist/visual/catalog.js +72 -0
- package/dist/visual/chemistry/equilibrium.d.ts +449 -0
- package/dist/visual/chemistry/equilibrium.js +135 -0
- package/dist/visual/mathematics/argument.d.ts +226 -0
- package/dist/visual/mathematics/argument.js +150 -0
- package/dist/visual/mathematics/counterexample.d.ts +340 -0
- package/dist/visual/mathematics/counterexample.js +157 -0
- package/package.json +1 -1
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { RichSlot } from "#contracts/visual/card";
|
|
3
|
+
/** The counterexample labs, where a claim is tested on every case. */
|
|
4
|
+
export declare function counterexampleVisuals<E>(rich: RichSlot<E>): {
|
|
5
|
+
CounterexampleGridLab: import("#contracts/visual/entry").VisualEntry<Schema.Struct<{
|
|
6
|
+
readonly description: RichSlot<E>;
|
|
7
|
+
readonly footer: Schema.optionalKey<Schema.Codec<readonly [{
|
|
8
|
+
readonly marks?: readonly [{
|
|
9
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
10
|
+
} | {
|
|
11
|
+
readonly attrs: {
|
|
12
|
+
readonly href: string;
|
|
13
|
+
};
|
|
14
|
+
readonly type: "link";
|
|
15
|
+
} | {
|
|
16
|
+
readonly attrs: {
|
|
17
|
+
readonly variant: "success" | "warning" | null;
|
|
18
|
+
};
|
|
19
|
+
readonly type: "highlight";
|
|
20
|
+
}, ...({
|
|
21
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
22
|
+
} | {
|
|
23
|
+
readonly attrs: {
|
|
24
|
+
readonly href: string;
|
|
25
|
+
};
|
|
26
|
+
readonly type: "link";
|
|
27
|
+
} | {
|
|
28
|
+
readonly attrs: {
|
|
29
|
+
readonly variant: "success" | "warning" | null;
|
|
30
|
+
};
|
|
31
|
+
readonly type: "highlight";
|
|
32
|
+
})[]];
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly type: "text";
|
|
35
|
+
} | {
|
|
36
|
+
readonly attrs: {
|
|
37
|
+
readonly latex: string;
|
|
38
|
+
};
|
|
39
|
+
readonly marks?: readonly [{
|
|
40
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
41
|
+
} | {
|
|
42
|
+
readonly attrs: {
|
|
43
|
+
readonly href: string;
|
|
44
|
+
};
|
|
45
|
+
readonly type: "link";
|
|
46
|
+
} | {
|
|
47
|
+
readonly attrs: {
|
|
48
|
+
readonly variant: "success" | "warning" | null;
|
|
49
|
+
};
|
|
50
|
+
readonly type: "highlight";
|
|
51
|
+
}, ...({
|
|
52
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
53
|
+
} | {
|
|
54
|
+
readonly attrs: {
|
|
55
|
+
readonly href: string;
|
|
56
|
+
};
|
|
57
|
+
readonly type: "link";
|
|
58
|
+
} | {
|
|
59
|
+
readonly attrs: {
|
|
60
|
+
readonly variant: "success" | "warning" | null;
|
|
61
|
+
};
|
|
62
|
+
readonly type: "highlight";
|
|
63
|
+
})[]];
|
|
64
|
+
readonly type: "mathInline";
|
|
65
|
+
}, ...({
|
|
66
|
+
readonly marks?: readonly [{
|
|
67
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
68
|
+
} | {
|
|
69
|
+
readonly attrs: {
|
|
70
|
+
readonly href: string;
|
|
71
|
+
};
|
|
72
|
+
readonly type: "link";
|
|
73
|
+
} | {
|
|
74
|
+
readonly attrs: {
|
|
75
|
+
readonly variant: "success" | "warning" | null;
|
|
76
|
+
};
|
|
77
|
+
readonly type: "highlight";
|
|
78
|
+
}, ...({
|
|
79
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
80
|
+
} | {
|
|
81
|
+
readonly attrs: {
|
|
82
|
+
readonly href: string;
|
|
83
|
+
};
|
|
84
|
+
readonly type: "link";
|
|
85
|
+
} | {
|
|
86
|
+
readonly attrs: {
|
|
87
|
+
readonly variant: "success" | "warning" | null;
|
|
88
|
+
};
|
|
89
|
+
readonly type: "highlight";
|
|
90
|
+
})[]];
|
|
91
|
+
readonly text: string;
|
|
92
|
+
readonly type: "text";
|
|
93
|
+
} | {
|
|
94
|
+
readonly attrs: {
|
|
95
|
+
readonly latex: string;
|
|
96
|
+
};
|
|
97
|
+
readonly marks?: readonly [{
|
|
98
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
99
|
+
} | {
|
|
100
|
+
readonly attrs: {
|
|
101
|
+
readonly href: string;
|
|
102
|
+
};
|
|
103
|
+
readonly type: "link";
|
|
104
|
+
} | {
|
|
105
|
+
readonly attrs: {
|
|
106
|
+
readonly variant: "success" | "warning" | null;
|
|
107
|
+
};
|
|
108
|
+
readonly type: "highlight";
|
|
109
|
+
}, ...({
|
|
110
|
+
readonly type: "bold" | "code" | "italic" | "subscript" | "superscript" | "underline";
|
|
111
|
+
} | {
|
|
112
|
+
readonly attrs: {
|
|
113
|
+
readonly href: string;
|
|
114
|
+
};
|
|
115
|
+
readonly type: "link";
|
|
116
|
+
} | {
|
|
117
|
+
readonly attrs: {
|
|
118
|
+
readonly variant: "success" | "warning" | null;
|
|
119
|
+
};
|
|
120
|
+
readonly type: "highlight";
|
|
121
|
+
})[]];
|
|
122
|
+
readonly type: "mathInline";
|
|
123
|
+
})[]], E, never, never>>;
|
|
124
|
+
readonly title: RichSlot<E>;
|
|
125
|
+
readonly claims: Schema.NonEmptyArray<Schema.Struct<{
|
|
126
|
+
readonly claim: Schema.Union<readonly [Schema.Struct<{
|
|
127
|
+
readonly kind: Schema.Literal<"all">;
|
|
128
|
+
readonly predicate: Schema.Struct<{
|
|
129
|
+
readonly name: Schema.Trimmed;
|
|
130
|
+
readonly test: Schema.Union<readonly [Schema.Struct<{
|
|
131
|
+
readonly kind: Schema.Literal<"odd">;
|
|
132
|
+
}>, Schema.Struct<{
|
|
133
|
+
readonly kind: Schema.Literal<"even">;
|
|
134
|
+
}>, Schema.Struct<{
|
|
135
|
+
readonly kind: Schema.Literal<"prime">;
|
|
136
|
+
}>, Schema.Struct<{
|
|
137
|
+
readonly kind: Schema.Literal<"square-number">;
|
|
138
|
+
}>, Schema.Struct<{
|
|
139
|
+
readonly kind: Schema.Literal<"multiple">;
|
|
140
|
+
readonly of: Schema.Int;
|
|
141
|
+
}>, Schema.Struct<{
|
|
142
|
+
readonly kind: Schema.Literal<"factor">;
|
|
143
|
+
readonly of: Schema.Int;
|
|
144
|
+
}>, Schema.Struct<{
|
|
145
|
+
readonly kind: Schema.Literal<"above">;
|
|
146
|
+
readonly than: Schema.Finite;
|
|
147
|
+
}>, Schema.Struct<{
|
|
148
|
+
readonly kind: Schema.Literal<"below">;
|
|
149
|
+
readonly than: Schema.Finite;
|
|
150
|
+
}>, Schema.Struct<{
|
|
151
|
+
readonly kind: Schema.Literal<"shape">;
|
|
152
|
+
readonly shape: Schema.Literals<readonly ["circle", "square", "triangle"]>;
|
|
153
|
+
}>, Schema.Struct<{
|
|
154
|
+
readonly color: Schema.Literals<readonly ["red", "blue", "yellow", "green"]>;
|
|
155
|
+
readonly kind: Schema.Literal<"color">;
|
|
156
|
+
}>]>;
|
|
157
|
+
}>;
|
|
158
|
+
readonly subject: Schema.optionalKey<Schema.Struct<{
|
|
159
|
+
readonly name: Schema.Trimmed;
|
|
160
|
+
readonly test: Schema.Union<readonly [Schema.Struct<{
|
|
161
|
+
readonly kind: Schema.Literal<"odd">;
|
|
162
|
+
}>, Schema.Struct<{
|
|
163
|
+
readonly kind: Schema.Literal<"even">;
|
|
164
|
+
}>, Schema.Struct<{
|
|
165
|
+
readonly kind: Schema.Literal<"prime">;
|
|
166
|
+
}>, Schema.Struct<{
|
|
167
|
+
readonly kind: Schema.Literal<"square-number">;
|
|
168
|
+
}>, Schema.Struct<{
|
|
169
|
+
readonly kind: Schema.Literal<"multiple">;
|
|
170
|
+
readonly of: Schema.Int;
|
|
171
|
+
}>, Schema.Struct<{
|
|
172
|
+
readonly kind: Schema.Literal<"factor">;
|
|
173
|
+
readonly of: Schema.Int;
|
|
174
|
+
}>, Schema.Struct<{
|
|
175
|
+
readonly kind: Schema.Literal<"above">;
|
|
176
|
+
readonly than: Schema.Finite;
|
|
177
|
+
}>, Schema.Struct<{
|
|
178
|
+
readonly kind: Schema.Literal<"below">;
|
|
179
|
+
readonly than: Schema.Finite;
|
|
180
|
+
}>, Schema.Struct<{
|
|
181
|
+
readonly kind: Schema.Literal<"shape">;
|
|
182
|
+
readonly shape: Schema.Literals<readonly ["circle", "square", "triangle"]>;
|
|
183
|
+
}>, Schema.Struct<{
|
|
184
|
+
readonly color: Schema.Literals<readonly ["red", "blue", "yellow", "green"]>;
|
|
185
|
+
readonly kind: Schema.Literal<"color">;
|
|
186
|
+
}>]>;
|
|
187
|
+
}>>;
|
|
188
|
+
}>, Schema.Struct<{
|
|
189
|
+
readonly kind: Schema.Literal<"some">;
|
|
190
|
+
readonly predicate: Schema.Struct<{
|
|
191
|
+
readonly name: Schema.Trimmed;
|
|
192
|
+
readonly test: Schema.Union<readonly [Schema.Struct<{
|
|
193
|
+
readonly kind: Schema.Literal<"odd">;
|
|
194
|
+
}>, Schema.Struct<{
|
|
195
|
+
readonly kind: Schema.Literal<"even">;
|
|
196
|
+
}>, Schema.Struct<{
|
|
197
|
+
readonly kind: Schema.Literal<"prime">;
|
|
198
|
+
}>, Schema.Struct<{
|
|
199
|
+
readonly kind: Schema.Literal<"square-number">;
|
|
200
|
+
}>, Schema.Struct<{
|
|
201
|
+
readonly kind: Schema.Literal<"multiple">;
|
|
202
|
+
readonly of: Schema.Int;
|
|
203
|
+
}>, Schema.Struct<{
|
|
204
|
+
readonly kind: Schema.Literal<"factor">;
|
|
205
|
+
readonly of: Schema.Int;
|
|
206
|
+
}>, Schema.Struct<{
|
|
207
|
+
readonly kind: Schema.Literal<"above">;
|
|
208
|
+
readonly than: Schema.Finite;
|
|
209
|
+
}>, Schema.Struct<{
|
|
210
|
+
readonly kind: Schema.Literal<"below">;
|
|
211
|
+
readonly than: Schema.Finite;
|
|
212
|
+
}>, Schema.Struct<{
|
|
213
|
+
readonly kind: Schema.Literal<"shape">;
|
|
214
|
+
readonly shape: Schema.Literals<readonly ["circle", "square", "triangle"]>;
|
|
215
|
+
}>, Schema.Struct<{
|
|
216
|
+
readonly color: Schema.Literals<readonly ["red", "blue", "yellow", "green"]>;
|
|
217
|
+
readonly kind: Schema.Literal<"color">;
|
|
218
|
+
}>]>;
|
|
219
|
+
}>;
|
|
220
|
+
readonly subject: Schema.optionalKey<Schema.Struct<{
|
|
221
|
+
readonly name: Schema.Trimmed;
|
|
222
|
+
readonly test: Schema.Union<readonly [Schema.Struct<{
|
|
223
|
+
readonly kind: Schema.Literal<"odd">;
|
|
224
|
+
}>, Schema.Struct<{
|
|
225
|
+
readonly kind: Schema.Literal<"even">;
|
|
226
|
+
}>, Schema.Struct<{
|
|
227
|
+
readonly kind: Schema.Literal<"prime">;
|
|
228
|
+
}>, Schema.Struct<{
|
|
229
|
+
readonly kind: Schema.Literal<"square-number">;
|
|
230
|
+
}>, Schema.Struct<{
|
|
231
|
+
readonly kind: Schema.Literal<"multiple">;
|
|
232
|
+
readonly of: Schema.Int;
|
|
233
|
+
}>, Schema.Struct<{
|
|
234
|
+
readonly kind: Schema.Literal<"factor">;
|
|
235
|
+
readonly of: Schema.Int;
|
|
236
|
+
}>, Schema.Struct<{
|
|
237
|
+
readonly kind: Schema.Literal<"above">;
|
|
238
|
+
readonly than: Schema.Finite;
|
|
239
|
+
}>, Schema.Struct<{
|
|
240
|
+
readonly kind: Schema.Literal<"below">;
|
|
241
|
+
readonly than: Schema.Finite;
|
|
242
|
+
}>, Schema.Struct<{
|
|
243
|
+
readonly kind: Schema.Literal<"shape">;
|
|
244
|
+
readonly shape: Schema.Literals<readonly ["circle", "square", "triangle"]>;
|
|
245
|
+
}>, Schema.Struct<{
|
|
246
|
+
readonly color: Schema.Literals<readonly ["red", "blue", "yellow", "green"]>;
|
|
247
|
+
readonly kind: Schema.Literal<"color">;
|
|
248
|
+
}>]>;
|
|
249
|
+
}>>;
|
|
250
|
+
}>, Schema.Struct<{
|
|
251
|
+
readonly kind: Schema.Literal<"if">;
|
|
252
|
+
readonly p: Schema.Struct<{
|
|
253
|
+
readonly name: Schema.Trimmed;
|
|
254
|
+
readonly test: Schema.Union<readonly [Schema.Struct<{
|
|
255
|
+
readonly kind: Schema.Literal<"odd">;
|
|
256
|
+
}>, Schema.Struct<{
|
|
257
|
+
readonly kind: Schema.Literal<"even">;
|
|
258
|
+
}>, Schema.Struct<{
|
|
259
|
+
readonly kind: Schema.Literal<"prime">;
|
|
260
|
+
}>, Schema.Struct<{
|
|
261
|
+
readonly kind: Schema.Literal<"square-number">;
|
|
262
|
+
}>, Schema.Struct<{
|
|
263
|
+
readonly kind: Schema.Literal<"multiple">;
|
|
264
|
+
readonly of: Schema.Int;
|
|
265
|
+
}>, Schema.Struct<{
|
|
266
|
+
readonly kind: Schema.Literal<"factor">;
|
|
267
|
+
readonly of: Schema.Int;
|
|
268
|
+
}>, Schema.Struct<{
|
|
269
|
+
readonly kind: Schema.Literal<"above">;
|
|
270
|
+
readonly than: Schema.Finite;
|
|
271
|
+
}>, Schema.Struct<{
|
|
272
|
+
readonly kind: Schema.Literal<"below">;
|
|
273
|
+
readonly than: Schema.Finite;
|
|
274
|
+
}>, Schema.Struct<{
|
|
275
|
+
readonly kind: Schema.Literal<"shape">;
|
|
276
|
+
readonly shape: Schema.Literals<readonly ["circle", "square", "triangle"]>;
|
|
277
|
+
}>, Schema.Struct<{
|
|
278
|
+
readonly color: Schema.Literals<readonly ["red", "blue", "yellow", "green"]>;
|
|
279
|
+
readonly kind: Schema.Literal<"color">;
|
|
280
|
+
}>]>;
|
|
281
|
+
}>;
|
|
282
|
+
readonly q: Schema.Struct<{
|
|
283
|
+
readonly name: Schema.Trimmed;
|
|
284
|
+
readonly test: Schema.Union<readonly [Schema.Struct<{
|
|
285
|
+
readonly kind: Schema.Literal<"odd">;
|
|
286
|
+
}>, Schema.Struct<{
|
|
287
|
+
readonly kind: Schema.Literal<"even">;
|
|
288
|
+
}>, Schema.Struct<{
|
|
289
|
+
readonly kind: Schema.Literal<"prime">;
|
|
290
|
+
}>, Schema.Struct<{
|
|
291
|
+
readonly kind: Schema.Literal<"square-number">;
|
|
292
|
+
}>, Schema.Struct<{
|
|
293
|
+
readonly kind: Schema.Literal<"multiple">;
|
|
294
|
+
readonly of: Schema.Int;
|
|
295
|
+
}>, Schema.Struct<{
|
|
296
|
+
readonly kind: Schema.Literal<"factor">;
|
|
297
|
+
readonly of: Schema.Int;
|
|
298
|
+
}>, Schema.Struct<{
|
|
299
|
+
readonly kind: Schema.Literal<"above">;
|
|
300
|
+
readonly than: Schema.Finite;
|
|
301
|
+
}>, Schema.Struct<{
|
|
302
|
+
readonly kind: Schema.Literal<"below">;
|
|
303
|
+
readonly than: Schema.Finite;
|
|
304
|
+
}>, Schema.Struct<{
|
|
305
|
+
readonly kind: Schema.Literal<"shape">;
|
|
306
|
+
readonly shape: Schema.Literals<readonly ["circle", "square", "triangle"]>;
|
|
307
|
+
}>, Schema.Struct<{
|
|
308
|
+
readonly color: Schema.Literals<readonly ["red", "blue", "yellow", "green"]>;
|
|
309
|
+
readonly kind: Schema.Literal<"color">;
|
|
310
|
+
}>]>;
|
|
311
|
+
}>;
|
|
312
|
+
}>]>;
|
|
313
|
+
readonly name: Schema.Trimmed;
|
|
314
|
+
readonly text: Schema.Trimmed;
|
|
315
|
+
}>>;
|
|
316
|
+
readonly tiles: Schema.NonEmptyArray<Schema.Struct<{
|
|
317
|
+
readonly name: Schema.Trimmed;
|
|
318
|
+
readonly tile: Schema.Union<readonly [Schema.Struct<{
|
|
319
|
+
readonly kind: Schema.Literal<"number">;
|
|
320
|
+
readonly value: Schema.Int;
|
|
321
|
+
}>, Schema.Struct<{
|
|
322
|
+
readonly color: Schema.Literals<readonly ["red", "blue", "yellow", "green"]>;
|
|
323
|
+
readonly kind: Schema.Literal<"shape">;
|
|
324
|
+
readonly shape: Schema.Literals<readonly ["circle", "square", "triangle"]>;
|
|
325
|
+
}>]>;
|
|
326
|
+
}>>;
|
|
327
|
+
readonly labels: Schema.Struct<{
|
|
328
|
+
readonly claim: RichSlot<E>;
|
|
329
|
+
readonly claims: Schema.Trimmed;
|
|
330
|
+
readonly false: Schema.Trimmed;
|
|
331
|
+
readonly none: RichSlot<E>;
|
|
332
|
+
readonly picked: RichSlot<E>;
|
|
333
|
+
readonly tile: Schema.Trimmed;
|
|
334
|
+
readonly true: Schema.Trimmed;
|
|
335
|
+
readonly verdicts: Schema.$Record<Schema.Literals<readonly ["breaks", "fits", "outside", "proves", "misses", "safe"]>, RichSlot<E>>;
|
|
336
|
+
readonly viewLabel: Schema.Trimmed;
|
|
337
|
+
}>;
|
|
338
|
+
readonly showAnswer: Schema.optionalKey<Schema.Boolean>;
|
|
339
|
+
}>, "figure">;
|
|
340
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Array as Arr, Schema } from "effect";
|
|
2
|
+
import { byIds, cardFields, TextSchema } from "#contracts/visual/card";
|
|
3
|
+
import { answerAt, figure } from "#contracts/visual/entry";
|
|
4
|
+
/** The shapes and paints a shape tile can carry. */
|
|
5
|
+
const TILE_SHAPES = ["circle", "square", "triangle"];
|
|
6
|
+
const TILE_COLORS = ["red", "blue", "yellow", "green"];
|
|
7
|
+
/** The most tiles the table holds, and the widest whole number a tile prints. */
|
|
8
|
+
const TILE_LIMIT = 20;
|
|
9
|
+
const TILE_VALUE = { maximum: 9999, minimum: -999 };
|
|
10
|
+
/** The most claims the toolbar offers, and the longest claim text the card prints. */
|
|
11
|
+
const CLAIM_LIMIT = 3;
|
|
12
|
+
const CLAIM_TEXT_LIMIT = 90;
|
|
13
|
+
/** What one tile shows: a whole number printed on it, or a painted shape standing on it. */
|
|
14
|
+
const TileSchema = Schema.Union([
|
|
15
|
+
Schema.Struct({ kind: Schema.Literal("number"), value: Schema.Int }),
|
|
16
|
+
Schema.Struct({
|
|
17
|
+
color: Schema.Literals(TILE_COLORS),
|
|
18
|
+
kind: Schema.Literal("shape"),
|
|
19
|
+
shape: Schema.Literals(TILE_SHAPES),
|
|
20
|
+
}),
|
|
21
|
+
]);
|
|
22
|
+
/**
|
|
23
|
+
* A test a tile passes or fails. The number tests read a number tile: odd,
|
|
24
|
+
* even, prime, a square number, a multiple of `of`, a factor of `of`, more
|
|
25
|
+
* than `than` or less than `than`. The shape tests read a shape tile: its
|
|
26
|
+
* shape or its color.
|
|
27
|
+
*/
|
|
28
|
+
const TileTestSchema = Schema.Union([
|
|
29
|
+
Schema.Struct({ kind: Schema.Literal("odd") }),
|
|
30
|
+
Schema.Struct({ kind: Schema.Literal("even") }),
|
|
31
|
+
Schema.Struct({ kind: Schema.Literal("prime") }),
|
|
32
|
+
Schema.Struct({ kind: Schema.Literal("square-number") }),
|
|
33
|
+
Schema.Struct({ kind: Schema.Literal("multiple"), of: Schema.Int }),
|
|
34
|
+
Schema.Struct({ kind: Schema.Literal("factor"), of: Schema.Int }),
|
|
35
|
+
Schema.Struct({ kind: Schema.Literal("above"), than: Schema.Finite }),
|
|
36
|
+
Schema.Struct({ kind: Schema.Literal("below"), than: Schema.Finite }),
|
|
37
|
+
Schema.Struct({
|
|
38
|
+
kind: Schema.Literal("shape"),
|
|
39
|
+
shape: Schema.Literals(TILE_SHAPES),
|
|
40
|
+
}),
|
|
41
|
+
Schema.Struct({
|
|
42
|
+
color: Schema.Literals(TILE_COLORS),
|
|
43
|
+
kind: Schema.Literal("color"),
|
|
44
|
+
}),
|
|
45
|
+
]);
|
|
46
|
+
/** A test with the words the footer names it by, such as "Odd number". */
|
|
47
|
+
const NamedTestSchema = Schema.Struct({
|
|
48
|
+
name: TextSchema,
|
|
49
|
+
test: TileTestSchema,
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* A claim about the tiles. `all` says every tile that passes `subject` (every
|
|
53
|
+
* tile, without one) passes `predicate`, and `some` says at least one does.
|
|
54
|
+
* `if` says every tile that passes `p` passes `q`.
|
|
55
|
+
*/
|
|
56
|
+
const TileClaimSchema = Schema.Union([
|
|
57
|
+
Schema.Struct({
|
|
58
|
+
kind: Schema.Literal("all"),
|
|
59
|
+
predicate: NamedTestSchema,
|
|
60
|
+
subject: Schema.optionalKey(NamedTestSchema),
|
|
61
|
+
}),
|
|
62
|
+
Schema.Struct({
|
|
63
|
+
kind: Schema.Literal("some"),
|
|
64
|
+
predicate: NamedTestSchema,
|
|
65
|
+
subject: Schema.optionalKey(NamedTestSchema),
|
|
66
|
+
}),
|
|
67
|
+
Schema.Struct({
|
|
68
|
+
kind: Schema.Literal("if"),
|
|
69
|
+
p: NamedTestSchema,
|
|
70
|
+
q: NamedTestSchema,
|
|
71
|
+
}),
|
|
72
|
+
]);
|
|
73
|
+
/**
|
|
74
|
+
* What one tile does to a claim, each named in the footer's key: a tile that
|
|
75
|
+
* `breaks` or `fits` a claim about all or an implication, `proves` or
|
|
76
|
+
* `misses` a claim about some, is `outside` a claim's subject, or is `safe`
|
|
77
|
+
* because its condition is false.
|
|
78
|
+
*/
|
|
79
|
+
const TILE_VERDICTS = [
|
|
80
|
+
"breaks",
|
|
81
|
+
"fits",
|
|
82
|
+
"outside",
|
|
83
|
+
"proves",
|
|
84
|
+
"misses",
|
|
85
|
+
"safe",
|
|
86
|
+
];
|
|
87
|
+
/** The tests a claim makes: its subject or condition, when it has one, then its predicate or conclusion. */
|
|
88
|
+
function testsOf(claim) {
|
|
89
|
+
if (claim.kind === "if") {
|
|
90
|
+
return [claim.p.test, claim.q.test];
|
|
91
|
+
}
|
|
92
|
+
return claim.subject === undefined
|
|
93
|
+
? [claim.predicate.test]
|
|
94
|
+
: [claim.subject.test, claim.predicate.test];
|
|
95
|
+
}
|
|
96
|
+
/** Whether a test reads a shape tile; every other test reads a number tile. */
|
|
97
|
+
function readsShape(test) {
|
|
98
|
+
return test.kind === "shape" || test.kind === "color";
|
|
99
|
+
}
|
|
100
|
+
/** The tiles on the table and the claims made about them. */
|
|
101
|
+
const TileTableSchema = Schema.Struct({
|
|
102
|
+
claims: Schema.NonEmptyArray(Schema.Struct({
|
|
103
|
+
claim: TileClaimSchema,
|
|
104
|
+
name: TextSchema,
|
|
105
|
+
text: TextSchema.check(Schema.isMaxLength(CLAIM_TEXT_LIMIT)),
|
|
106
|
+
})).check(Schema.isMaxLength(CLAIM_LIMIT)),
|
|
107
|
+
tiles: Schema.NonEmptyArray(Schema.Struct({ name: TextSchema, tile: TileSchema })).check(Schema.isMaxLength(TILE_LIMIT)),
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* Whether the table is one kind of tile, every number prints on its tile,
|
|
111
|
+
* every test of every claim reads that kind, and each claim has its own name.
|
|
112
|
+
*/
|
|
113
|
+
function isTileTable({ claims, tiles }) {
|
|
114
|
+
const shapes = Arr.every(tiles, ({ tile }) => tile.kind === "shape");
|
|
115
|
+
const numbers = Arr.every(tiles, ({ tile }) => tile.kind === "number" &&
|
|
116
|
+
tile.value >= TILE_VALUE.minimum &&
|
|
117
|
+
tile.value <= TILE_VALUE.maximum);
|
|
118
|
+
const names = Arr.map(claims, ({ name }) => name);
|
|
119
|
+
return ((shapes || numbers) &&
|
|
120
|
+
Arr.dedupe(names).length === names.length &&
|
|
121
|
+
Arr.every(claims, ({ claim }) => Arr.every(testsOf(claim), (test) => readsShape(test) === shapes)));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Props of `CounterexampleGridLab`: the `tiles` of a set lie in a grid, and
|
|
125
|
+
* a card stands behind them with one of the `claims` about them, such as
|
|
126
|
+
* "All odd numbers here are prime". Play checks the tiles one at a time, and
|
|
127
|
+
* the learner can pick any tile to check it. A claim about all or an
|
|
128
|
+
* implication falls at its first counterexample, and a claim about some
|
|
129
|
+
* stands at its first example; with an implication, the tiles are carried
|
|
130
|
+
* into a board of the four cases of p and q. With `showAnswer`, each checked
|
|
131
|
+
* tile shows its verdict, the card is stamped true or false at the tile that
|
|
132
|
+
* settles it, and the footer reads the claim's truth, so it is answer state.
|
|
133
|
+
*/
|
|
134
|
+
function counterexampleGridLab(rich) {
|
|
135
|
+
return figure(Schema.Struct({
|
|
136
|
+
...cardFields(rich),
|
|
137
|
+
...TileTableSchema.fields,
|
|
138
|
+
labels: Schema.Struct({
|
|
139
|
+
claim: rich,
|
|
140
|
+
claims: TextSchema,
|
|
141
|
+
false: TextSchema,
|
|
142
|
+
none: rich,
|
|
143
|
+
picked: rich,
|
|
144
|
+
tile: TextSchema,
|
|
145
|
+
true: TextSchema,
|
|
146
|
+
verdicts: byIds(TILE_VERDICTS, rich),
|
|
147
|
+
viewLabel: TextSchema,
|
|
148
|
+
}),
|
|
149
|
+
showAnswer: Schema.optionalKey(Schema.Boolean),
|
|
150
|
+
}).check(Schema.makeFilter(isTileTable, {
|
|
151
|
+
message: "Expected tiles of one kind with printable numbers, claims whose tests read that kind of tile, and a different name for each claim.",
|
|
152
|
+
})), answerAt(["showAnswer"]));
|
|
153
|
+
}
|
|
154
|
+
/** The counterexample labs, where a claim is tested on every case. */
|
|
155
|
+
export function counterexampleVisuals(rich) {
|
|
156
|
+
return { CounterexampleGridLab: counterexampleGridLab(rich) };
|
|
157
|
+
}
|
package/package.json
CHANGED