lawspec 0.8.0 → 0.10.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 (61) hide show
  1. package/API-MIGRATION.md +180 -3
  2. package/GO.md +144 -0
  3. package/HASKELL.md +171 -0
  4. package/JAVA.md +113 -0
  5. package/KOTLIN.md +214 -0
  6. package/LANGUAGE.md +240 -12
  7. package/NATIVE-BINDINGS.md +1046 -0
  8. package/PRIMITIVES.md +1 -1
  9. package/PYTHON.md +152 -0
  10. package/README.md +86 -23
  11. package/REFINEMENTS.md +289 -3
  12. package/RELEASE-0.10.md +60 -0
  13. package/RELEASE-0.9.md +61 -0
  14. package/RUST.md +115 -1
  15. package/WEB.md +144 -0
  16. package/api.mjs +28 -2
  17. package/bin/lawspec.mjs +23 -7
  18. package/build.json +199 -37
  19. package/core.wasm +0 -0
  20. package/examples/native-payments/go/example/payments/domain.go +38 -0
  21. package/examples/native-payments/go/example/payments/native_generators_test.go +13 -0
  22. package/examples/native-payments/go/lawspec.json +136 -0
  23. package/examples/native-payments/haskell/lawspec.json +149 -0
  24. package/examples/native-payments/haskell/src/PaymentsDomain.hs +21 -0
  25. package/examples/native-payments/haskell/test/PaymentGenerators.hs +12 -0
  26. package/examples/native-payments/java/lawspec.json +165 -0
  27. package/examples/native-payments/java/src/main/java/domain/PaymentsDomain.java +32 -0
  28. package/examples/native-payments/java/src/test/java/domain/PaymentGenerators.java +16 -0
  29. package/examples/native-payments/javascript/lawspec.json +149 -0
  30. package/examples/native-payments/javascript/src/payments_domain.mjs +44 -0
  31. package/examples/native-payments/javascript/test/lawspec_generators.mjs +6 -0
  32. package/examples/native-payments/kotlin/lawspec.json +165 -0
  33. package/examples/native-payments/kotlin/src/main/kotlin/domain/PaymentsDomain.kt +17 -0
  34. package/examples/native-payments/kotlin/src/test/kotlin/domain/PaymentGenerators.kt +12 -0
  35. package/examples/native-payments/python/lawspec.json +149 -0
  36. package/examples/native-payments/python/src/payments_domain.py +60 -0
  37. package/examples/native-payments/python/tests/lawspec_generators.py +15 -0
  38. package/examples/native-payments/rust/lawspec.json +167 -0
  39. package/examples/native-payments/rust/src/domain.rs +37 -0
  40. package/examples/native-payments/rust/src/lib.rs +2 -0
  41. package/examples/native-payments/rust/tests/support/lawspec_generators.rs +11 -0
  42. package/examples/native-payments/typescript/lawspec.json +149 -0
  43. package/examples/native-payments/typescript/src/payments_domain.ts +42 -0
  44. package/examples/native-payments/typescript/test/lawspec_generators.ts +8 -0
  45. package/examples/specs/collections.lawspec +67 -0
  46. package/examples/specs/data_types.lawspec +66 -0
  47. package/examples/specs/finite_data.lawspec +37 -0
  48. package/examples/specs/list_contracts.lawspec +136 -0
  49. package/examples/specs/list_refinements.lawspec +51 -0
  50. package/examples/specs/matching.lawspec +49 -0
  51. package/examples/specs/payments.lawspec +76 -0
  52. package/examples/specs/recursive_refinements.lawspec +41 -0
  53. package/examples/specs/refined_definitions.lawspec +44 -0
  54. package/examples/specs/sum_refinements.lawspec +49 -0
  55. package/examples/specs/total_functions.lawspec +101 -0
  56. package/examples-command.mjs +11 -1
  57. package/files.mjs +16 -7
  58. package/index.d.ts +297 -27
  59. package/native-examples.mjs +81 -0
  60. package/package.json +2 -2
  61. package/templates.mjs +107 -17
package/WEB.md ADDED
@@ -0,0 +1,144 @@
1
+ # JavaScript and TypeScript backends
2
+
3
+ LawSpec emits ES modules. JavaScript uses `.mjs`; TypeScript uses `.ts` with `.js`
4
+ import paths for NodeNext compilation. Generated data and numeric support belong
5
+ in source directories and do not depend on fast-check. Generated properties use
6
+ fast-check's native generators and shrinkers.
7
+
8
+ ## Native structural values
9
+
10
+ `List a` uses `Array<A>`. `Maybe a` and `Either a b` use named classes and, in
11
+ TypeScript, generic unions from `lawspec_data`. User products and sums likewise
12
+ have named native variant classes. TypeScript retains payload types and nominal
13
+ variant identity, including recursive fields and phantom parameters.
14
+
15
+ `Nullable a` and `Optional a` use tagged `data.Presence<A>` values, preserving
16
+ nested states separately from algebraic `Maybe`. Runtime checks enforce the
17
+ presence kind and payload domain. Scalar and structural presence values both use
18
+ the schema bridge when crossing native adapter boundaries.
19
+
20
+ Checked conversions copy containers, reject sparse arrays and invalid fields,
21
+ validate numeric ranges and machine profiles, and preserve raw text and bytes.
22
+ LawSpec equality follows the schema: NaN differs from itself, signed zeros compare
23
+ equal, and Symbols compare by identity. Ordinary JavaScript object equality is
24
+ not a replacement for structural LawSpec equality.
25
+
26
+ ## Total definitions
27
+
28
+ Checked definitions produce reusable source functions:
29
+
30
+ ```lawspec
31
+ unit example.total
32
+
33
+ definition increment (x :: Int8) :: BigInt is x + 1 end
34
+ ```
35
+
36
+ ```javascript
37
+ import {increment} from './lawspec_definitions/example/total.mjs';
38
+
39
+ const symbols = new Map();
40
+ const result = increment(symbols, 127); // 128n
41
+ ```
42
+
43
+ The TypeScript entry point has `symbols: Map<string, symbol>`, `value0: number`,
44
+ and a `bigint` result. Native signatures preserve lists, products, sums, and
45
+ nested presence payloads. Runtime validation also rejects invalid number ranges,
46
+ fractional primitive inputs, and malformed values from JavaScript callers.
47
+ Failures identify the resolved definition.
48
+
49
+ The first argument shares Symbol fixture identity across calls within an example.
50
+ Equal descriptions in separate contexts do not create equal Symbols. Exact
51
+ integers use bigint; exact Decimal and Rational operations use the scalar runtime
52
+ without passing through Number arithmetic.
53
+
54
+ Public modules live under `lawspec_definitions/`, grouped by unit. Checked logical
55
+ bodies live in `lawspec_definition_bodies`. Both are generated-owned source.
56
+ Properties call the implementations directly; a definition never becomes an
57
+ adapter stub. Ordinary adapters remain user-owned. Support-module collisions and
58
+ bindings that shadow generated global access are rejected before output.
59
+
60
+ Definitions and properties share typed Core expression rendering. Match inputs
61
+ are evaluated once, only the selected branch runs, and Boolean guards
62
+ short-circuit. Totality validation checks structural descent and potentially
63
+ failing operations. Generic definitions specialize to concrete uses. Refined signatures become
64
+ checked contracts, and refinement predicates may call checked definitions.
65
+
66
+ ## Formatting and verification
67
+
68
+ Definition output uses two-space blocks, four-space continuations, single-quoted
69
+ strings, and an 80-column layout. String tokens preserve escaped and raw payloads
70
+ in readable and compact modes. Compact mode removes optional document breaks.
71
+ The public `--minify` path covers runtime, declaration, definition, adapter, and
72
+ test artifacts. `tools/web-formatting-integration.mjs` checks the full bundled
73
+ corpus for formatting rules and readable/compact syntax-tree equivalence. It
74
+ records Prettier differences separately: Prettier's continuation layout is not
75
+ the Google four-space continuation rule used here.
76
+
77
+ `tools/web-definitions-integration.mjs` checks both targets and machine profiles,
78
+ strict TypeScript entry points and rejected assignments, source-only execution,
79
+ recursive properties, incorrect adapters, compact output, custom directories,
80
+ and regeneration protection. The implementation modules pass strict TypeScript
81
+ without `any` or `@ts-nocheck`. Existing schema and numeric runtime TypeScript
82
+ files still use `@ts-nocheck`; their public data declarations and definition
83
+ entry points are checked separately.
84
+
85
+ ## Runtime source formatting
86
+
87
+ The checked-in JavaScript scalar runtime, schema runtime, and fast-check helpers
88
+ use two-space indentation, single quotes, and an 80-column target, formatted with
89
+ Prettier 3.6.2. `node tools/format-web-runtimes.mjs` checks these sources;
90
+ `--write` formats them. Set `LAWSPEC_PRETTIER` to the formatter's `index.mjs` when
91
+ it is not in `.artifacts/formatter-deps/prettier/`. This development tool never
92
+ runs in generated projects or during compiler requests.
93
+
94
+ Run `python3 tools/embed-runtimes.py` after runtime edits, then use `--check` to
95
+ verify that native/WASM source embedding is current. Both JavaScript and
96
+ TypeScript receive the reviewed runtime source, with the existing typed-schema
97
+ constructor annotation and module-extension adjustments for TypeScript.
98
+
99
+
100
+ Internal checked Core definition contracts now run at native and logical entry
101
+ points. Emission proves the obligations first; argument validation precedes
102
+ ordered preconditions, and result validation precedes postconditions. Contract
103
+ binders map explicitly to body inputs and the checked result. Refined source
104
+ signatures now produce these contracts through template proof and specialization.
105
+
106
+ `tools/portable-definition-contract-integration.mjs` exercises Python, JavaScript
107
+ and strict TypeScript with both machine profiles and layouts, without property
108
+ frameworks. It also verifies that deliberately corrupted results are rejected.
109
+ The fixture in `test/DefinitionContractFixture.hs` is shared with the JVM checks.
110
+
111
+
112
+ ## Generated source style checks
113
+
114
+ JavaScript and TypeScript emitters use two-space blocks and four-space
115
+ continuations. The latter follows the [Google JavaScript line-wrapping guide](https://google.github.io/styleguide/jsguide.html#s4.5-line-wrapping).
116
+ Binary operators remain on the preceding line when an expression wraps.
117
+ Generated adapter error messages and tagged scalar values use the shared
118
+ single-quoted JavaScript literal renderer.
119
+
120
+ `tools/web-formatting-integration.mjs` independently parses both output modes
121
+ with TypeScript, compares their syntax trees and literal contents, and checks
122
+ quote choice, binary-operator breaks, continuation and statement-block indentation,
123
+ the 80-column limit, tabs, and trailing
124
+ whitespace. Module imports/re-exports and indivisible source excerpts on their
125
+ own comment line are explicit column exceptions. Ordinary prose and code remain
126
+ subject to the limit. Long scalar string values use escaped concatenated chunks;
127
+ property names remain single tokens. It runs
128
+ both machine profiles for the bundled examples and total-definition fixture.
129
+ Set `LAWSPEC_CORE` to the native compiler; optional `LAWSPEC_TYPESCRIPT` and
130
+ `LAWSPEC_PRETTIER` paths select the cached development tools. Prettier must be
131
+ version 3.6.2. Positional arguments select specification files.
132
+
133
+ Prettier differences are saved for inspection, not treated as an exact Google
134
+ style oracle: its continuation indentation differs from Google's. These checks
135
+ are partial style evidence. Additional indentation cases (such as switch bodies
136
+ and type declarations) and Kotlin formatter acceptance remain tracked in the 0.9 plan; passing this script alone does not
137
+ establish complete style conformance.
138
+
139
+ The development-only runtime formatter (`tools/format-web-runtimes.mjs`) applies
140
+ Prettier layout and then syntax-tree-directed continuation indentation. It verifies
141
+ that JavaScript tokens remain unchanged, retains relative callback block indentation,
142
+ and rejects adjustments inside multiline template literals. It is idempotent and
143
+ checks the resulting 80-column limit. Reviewed runtime source is embedded at build
144
+ time; generated projects never download or invoke these development tools.
package/api.mjs CHANGED
@@ -1,6 +1,32 @@
1
1
  // Generated from LawSpec.Gen. Do not edit.
2
- import { loadCore } from './launcher.mjs';
2
+ import {loadCore} from './launcher.mjs';
3
+
3
4
  export async function createCompiler() {
4
5
  const call = await loadCore();
5
- return { check: (input) => call({ schemaVersion: 3, ...input, method: 'check' }), expand: (input) => call({ schemaVersion: 3, ...input, method: 'expand' }), planGeneration: (input) => call({ schemaVersion: 3, ...input, method: 'planGeneration' }) };
6
+ return {
7
+ check: (input) =>
8
+ call(
9
+ {
10
+ schemaVersion: input.nativeBindings === undefined ? 3 : 4,
11
+ ...input,
12
+ method: 'check',
13
+ }
14
+ ),
15
+ expand: (input) =>
16
+ call(
17
+ {
18
+ schemaVersion: input.nativeBindings === undefined ? 3 : 4,
19
+ ...input,
20
+ method: 'expand',
21
+ }
22
+ ),
23
+ planGeneration: (input) =>
24
+ call(
25
+ {
26
+ schemaVersion: input.nativeBindings === undefined ? 3 : 4,
27
+ ...input,
28
+ method: 'planGeneration',
29
+ }
30
+ ),
31
+ };
6
32
  }
package/bin/lawspec.mjs CHANGED
@@ -19,11 +19,11 @@ const options = {};
19
19
  const positional = [];
20
20
  for (let i = 0; i < args.length; i++) {
21
21
  const arg = args[i];
22
- if (["--target", "--project", "--config", "--output", "--machine-bits"].includes(arg)) {
22
+ if (["--target", "--project", "--config", "--output", "--machine-bits", "--example"].includes(arg)) {
23
23
  if (!args[i + 1] || args[i + 1].startsWith("--"))
24
24
  throw new Error(`Missing value for ${arg}`);
25
25
  options[arg.slice(2)] = args[++i];
26
- } else if (["--dry-run", "--check", "--json"].includes(arg))
26
+ } else if (["--dry-run", "--check", "--json", "--minify"].includes(arg))
27
27
  options[arg.slice(2)] = true;
28
28
  else if (arg.startsWith("--")) throw new Error(`Unknown option: ${arg}`);
29
29
  else positional.push(arg);
@@ -118,7 +118,7 @@ async function init() {
118
118
  const hasBuild = (await readdir(root)).some(
119
119
  (f) => buildFiles.includes(f) || f.endsWith(".cabal"),
120
120
  );
121
- const additions = hasBuild ? {} : templates(language);
121
+ const additions = hasBuild ? {} : templates(language, {minify: options.minify === true});
122
122
  for (const name of Object.keys(additions)) {
123
123
  const file = await safePath(root, name);
124
124
  if ((await readOptional(file)) !== null)
@@ -147,7 +147,7 @@ async function init() {
147
147
  });
148
148
  await atomicWrite(
149
149
  configFile,
150
- JSON.stringify(config, null, 2) + "\n",
150
+ JSON.stringify(config, null, options.minify ? undefined : 2) + "\n",
151
151
  current === null,
152
152
  );
153
153
  output(
@@ -173,13 +173,13 @@ async function main() {
173
173
  }
174
174
  if (!verb || ["help", "--help", "-h"].includes(verb)) {
175
175
  output(
176
- "LawSpec 0.8.0\nUsage: lawspec init --target <language> [--project <directory>]\n lawspec check | doctor | explain <unit>::<law> | generate\n lawspec examples [--target <language>] [--output example_artifacts]\nOptions: --config <path>, --target <language>, --machine-bits <32|64>, --json\nGeneration: --dry-run, --check\nTargets: " +
176
+ "LawSpec 0.10.0\nUsage: lawspec init --target <language> [--project <directory>] [--minify]\n lawspec check | doctor | explain <unit>::<law> | generate\n lawspec examples [--example payments] [--target <language>] [--output <directory>]\nOptions: --config <path>, --target <language>, --machine-bits <32|64>, --json\nGeneration: --dry-run, --check, --minify\nTargets: " +
177
177
  targets.join(", "),
178
178
  );
179
179
  return;
180
180
  }
181
181
  if (verb === "--version") {
182
- output("0.8.0");
182
+ output("0.10.0");
183
183
  return;
184
184
  }
185
185
  if (positional.length > (verb === "explain" ? 1 : 0))
@@ -191,8 +191,15 @@ async function main() {
191
191
  options["dry-run"] ||
192
192
  options.check
193
193
  )
194
- throw new Error("examples supports --target, --output and --json only");
194
+ throw new Error("examples supports --example, --target, --output, --machine-bits, --json and --minify only");
195
195
  const result = await generateExamples(options);
196
+ if (options.example) {
197
+ output(options.json ? result : result.map(r =>
198
+ `${r.target}: payment project in ${r.directory}; ${r.preservedAdapters.length} user files preserved.` +
199
+ (r.adapterUpdates.length ? `\nReview changed example files: ${r.adapterUpdates.map(a => a.path).join(", ")}` : "")
200
+ ).join("\n") + "\nOpen each project's README.md, run lawspec generate, then its native test command.");
201
+ return;
202
+ }
196
203
  output(
197
204
  options.json
198
205
  ? result
@@ -207,6 +214,9 @@ async function main() {
207
214
  return;
208
215
  }
209
216
  if (options.output) throw new Error("--output is only supported by examples");
217
+ if (options.example) throw new Error("--example is only supported by examples");
218
+ if (options.minify && !["init", "generate", "examples"].includes(verb))
219
+ throw new Error("--minify applies to init, generate and examples");
210
220
  if (verb === "init") return init();
211
221
  if (!["check", "doctor", "explain", "generate"].includes(verb))
212
222
  throw new Error(`Unknown command: ${verb}`);
@@ -249,6 +259,10 @@ async function main() {
249
259
  const compiler = await createCompiler();
250
260
  if (verb === "check") {
251
261
  const result = diagnostics(await compiler.check(input));
262
+ for (const target of selected) {
263
+ if (target.nativeBindings !== undefined)
264
+ diagnostics(await compiler.check({...input, nativeBindings: target.nativeBindings}));
265
+ }
252
266
  output(
253
267
  options.json
254
268
  ? result
@@ -287,6 +301,8 @@ async function main() {
287
301
  target: target.language,
288
302
  sourceDir: target.sourceDir,
289
303
  testDir: target.testDir,
304
+ nativeBindings: target.nativeBindings,
305
+ minify: options.minify === true,
290
306
  }),
291
307
  ).files,
292
308
  );
package/build.json CHANGED
@@ -1,41 +1,122 @@
1
1
  {
2
2
  "version": 1,
3
3
  "compilerSources": [
4
+ "lawspec.cabal",
4
5
  "package.yaml",
6
+ "runtime/LawSpecCodecs.hs",
7
+ "runtime/LawSpecDataStrategies.hs",
8
+ "runtime/LawSpecDataStrategies.java",
9
+ "runtime/LawSpecKotlin.kt",
10
+ "runtime/LawSpecKotlinCodecs.kt",
11
+ "runtime/LawSpecKotlinStrategies.kt",
5
12
  "runtime/LawSpecRuntime.hs",
6
13
  "runtime/LawSpecRuntime.java",
14
+ "runtime/LawSpecSchema.hs",
15
+ "runtime/LawSpecSchema.java",
16
+ "runtime/LawSpecStrategies.kt",
17
+ "runtime/lawspec_codecs.go",
18
+ "runtime/lawspec_data_strategies.go",
19
+ "runtime/lawspec_data_strategies.mjs",
20
+ "runtime/lawspec_data_strategies.py",
7
21
  "runtime/lawspec_runtime.go",
8
22
  "runtime/lawspec_runtime.mjs",
9
23
  "runtime/lawspec_runtime.py",
10
24
  "runtime/lawspec_runtime.rs",
25
+ "runtime/lawspec_schema.go",
26
+ "runtime/lawspec_schema.mjs",
27
+ "runtime/lawspec_schema.py",
11
28
  "runtime/lawspec_strategies.rs",
12
29
  "runtime/rust/Cargo.lock",
13
30
  "runtime/rust/Cargo.toml",
14
31
  "src/LawSpec/Api.hs",
15
32
  "src/LawSpec/Backend.hs",
33
+ "src/LawSpec/Capabilities.hs",
34
+ "src/LawSpec/Code/Doc.hs",
35
+ "src/LawSpec/Code/JavaScript.hs",
16
36
  "src/LawSpec/Common.hs",
17
37
  "src/LawSpec/Compile.hs",
18
38
  "src/LawSpec/Core.hs",
39
+ "src/LawSpec/Core/DefinitionContracts.hs",
40
+ "src/LawSpec/Core/Definitions.hs",
19
41
  "src/LawSpec/Core/Eval.hs",
42
+ "src/LawSpec/Core/Expression.hs",
43
+ "src/LawSpec/Core/Payload.hs",
44
+ "src/LawSpec/Core/PayloadPlan.hs",
45
+ "src/LawSpec/Core/RefinementProof.hs",
46
+ "src/LawSpec/Core/Schema.hs",
20
47
  "src/LawSpec/Core/Semantics.hs",
48
+ "src/LawSpec/Core/Total.hs",
49
+ "src/LawSpec/Core/Totality.hs",
50
+ "src/LawSpec/Core/Types.hs",
21
51
  "src/LawSpec/Core/Validate.hs",
52
+ "src/LawSpec/Core/Value.hs",
22
53
  "src/LawSpec/CoreEmit.hs",
23
54
  "src/LawSpec/CoreNativeScalarEmit.hs",
24
55
  "src/LawSpec/CoreScalarEmit.hs",
56
+ "src/LawSpec/Data.hs",
57
+ "src/LawSpec/DefinitionTotality.hs",
25
58
  "src/LawSpec/Domain.hs",
59
+ "src/LawSpec/Elaboration.hs",
26
60
  "src/LawSpec/Emit.hs",
27
61
  "src/LawSpec/Eval.hs",
28
62
  "src/LawSpec/Frontend.hs",
29
63
  "src/LawSpec/Gen.hs",
64
+ "src/LawSpec/GoData.hs",
65
+ "src/LawSpec/GoDefinitions.hs",
66
+ "src/LawSpec/GoExpr.hs",
67
+ "src/LawSpec/GoNativeBinding.hs",
68
+ "src/LawSpec/GoProperties.hs",
69
+ "src/LawSpec/GoTestHelpers.hs",
70
+ "src/LawSpec/GoTypeRefs.hs",
71
+ "src/LawSpec/HaskellData.hs",
72
+ "src/LawSpec/HaskellDefinitions.hs",
73
+ "src/LawSpec/HaskellExpr.hs",
74
+ "src/LawSpec/HaskellNativeBinding.hs",
75
+ "src/LawSpec/HaskellProperties.hs",
76
+ "src/LawSpec/HaskellTestHelpers.hs",
77
+ "src/LawSpec/HaskellTypeRefs.hs",
78
+ "src/LawSpec/Inference.hs",
79
+ "src/LawSpec/JavaData.hs",
80
+ "src/LawSpec/JavaDefinitions.hs",
81
+ "src/LawSpec/JavaExpr.hs",
82
+ "src/LawSpec/JavaNativeBinding.hs",
83
+ "src/LawSpec/JavaProperties.hs",
84
+ "src/LawSpec/JavaTestHelpers.hs",
85
+ "src/LawSpec/KotlinData.hs",
86
+ "src/LawSpec/KotlinDefinitions.hs",
87
+ "src/LawSpec/KotlinExpr.hs",
88
+ "src/LawSpec/KotlinNativeBinding.hs",
89
+ "src/LawSpec/KotlinProperties.hs",
90
+ "src/LawSpec/KotlinTestHelpers.hs",
30
91
  "src/LawSpec/Model.hs",
92
+ "src/LawSpec/NativeBinding.hs",
93
+ "src/LawSpec/NativeRequest.hs",
31
94
  "src/LawSpec/Parser.hs",
95
+ "src/LawSpec/PortableGenerator.hs",
96
+ "src/LawSpec/PortableTestHelpers.hs",
32
97
  "src/LawSpec/Prelude.hs",
33
98
  "src/LawSpec/Public.hs",
99
+ "src/LawSpec/PythonData.hs",
100
+ "src/LawSpec/PythonDefinitions.hs",
101
+ "src/LawSpec/PythonExpr.hs",
102
+ "src/LawSpec/PythonNativeBinding.hs",
103
+ "src/LawSpec/PythonTypes.hs",
34
104
  "src/LawSpec/Refinement.hs",
35
105
  "src/LawSpec/RuntimeSources.hs",
106
+ "src/LawSpec/RustData.hs",
107
+ "src/LawSpec/RustDefinitions.hs",
36
108
  "src/LawSpec/RustEmit.hs",
109
+ "src/LawSpec/RustExpr.hs",
110
+ "src/LawSpec/RustNativeBinding.hs",
111
+ "src/LawSpec/RustNativeGenerators.hs",
37
112
  "src/LawSpec/Scalar.hs",
113
+ "src/LawSpec/SpecializeDefinitions.hs",
38
114
  "src/LawSpec/Testing.hs",
115
+ "src/LawSpec/WebData.hs",
116
+ "src/LawSpec/WebDefinitions.hs",
117
+ "src/LawSpec/WebExpr.hs",
118
+ "src/LawSpec/WebNativeBinding.hs",
119
+ "src/LawSpec/WebTypes.hs",
39
120
  "stack.yaml",
40
121
  "stack.yaml.lock",
41
122
  "tools/embed-runtimes.py",
@@ -45,51 +126,132 @@
45
126
  "wasm/lawspec-wasm.cabal"
46
127
  ],
47
128
  "digests": {
48
- "package.yaml": "90923d07cf41977f62a201faf26667ae4fd76de84c6f25ce47917ac92a6a1f4b",
49
- "runtime/LawSpecRuntime.hs": "1c3ca22232c64227717d836a57d375d906f748ecde6b79705944a2319ce5064d",
50
- "runtime/LawSpecRuntime.java": "5637914bd491f75ad0c75fb19d1bec798164295b7bcf9d23e1549e8ebf780d01",
51
- "runtime/lawspec_runtime.go": "62d2041c33760b67db619e0a803501768a505c4dfd9837bca85e158fff81fda9",
52
- "runtime/lawspec_runtime.mjs": "7d0abd53fa45dd9828c10ff2ffa7876162e965e7bb4913f4c460af13e06142fa",
53
- "runtime/lawspec_runtime.py": "7541353effebd133e50cd00a3f4d8999651c93ba751a6d951164b1f390ce0c15",
54
- "runtime/lawspec_runtime.rs": "bf9cf5fa546346a59c85248936395fe11946974ce0bad053aeeaf4e26b6a829d",
55
- "runtime/lawspec_strategies.rs": "a5dcee400574a69a5d2aa066bb8959e366728b3f21a578de84f50feadadf6641",
56
- "runtime/rust/Cargo.lock": "91533e20939436e117c0f09ded695a8a05a86e79efc29fe4b4b93ad8ef1771c8",
57
- "runtime/rust/Cargo.toml": "7ec66cf82dcc73a4a0b4a44d6048b6c3a340897c488aaaace9e8d4bac90b5e0a",
58
- "src/LawSpec/Api.hs": "4810c05d53e370daf7520b9116c34997b7b4ba9c8d3f1a349e2afdb7b1424552",
59
- "src/LawSpec/Backend.hs": "15ba04b69739e3891f73757d9cdc0a29acca6b7f7e067fd11d83d718474d0f20",
60
- "src/LawSpec/Common.hs": "baa849dad0cc6227af334fdc7488389df50c0fe3a74a2ba1d84eb60c6b6edd6e",
61
- "src/LawSpec/Compile.hs": "6c8bcea938f2ec3f83afb348c5ca932d96ce070f4e916fc9233a3a02ffcc89f2",
62
- "src/LawSpec/Core.hs": "27ce2bb1274485cc190e10f8520118d5b381c90ac4ab6343223c46fb3cd10869",
63
- "src/LawSpec/Core/Eval.hs": "87bf2acfdfff1431f1358947044c0474df40b5bc601076f5e5051e089f1d2fa4",
129
+ "lawspec.cabal": "b38f73ab83f833725b64ae4d0df07783efbdeacf367e99e378c18dddbb864f9d",
130
+ "package.yaml": "c682a129e7fdec4ae5d60d229c622ad05714fd52c6d83a3c44815b232fb4459d",
131
+ "runtime/LawSpecCodecs.hs": "90cb1ed15d7ab664a17a054580c849408d77cfd2b2adcb4a3228b05132caeaca",
132
+ "runtime/LawSpecDataStrategies.hs": "0b6639d200101bfc3c850278133a7f686bfc3423c81ccc7d82f161847700c914",
133
+ "runtime/LawSpecDataStrategies.java": "ade2e132f116d261c6e8c198c6f87515193ceda8ab83b1006627eebb72321ed1",
134
+ "runtime/LawSpecKotlin.kt": "0cf3b7de0406155225ccca33ee3dfdf8f0456c47d577f6be8f1265c13df838cb",
135
+ "runtime/LawSpecKotlinCodecs.kt": "6210f77dbbe24ba2088db48dae5415abf0993fe552fb3a57d29430807efbc297",
136
+ "runtime/LawSpecKotlinStrategies.kt": "73deed2d5d13529220147b530743a5f9bee72467e940bb357b2c3152ee6ec4ee",
137
+ "runtime/LawSpecRuntime.hs": "5ced6a6a86a892ae63a544d4c4a4429bf756a730ea786478d820c8070cc96402",
138
+ "runtime/LawSpecRuntime.java": "c7b7cfc9b7c22b082edee14a52d95ef80ebe01ee56988c22702f629ea24b8a4f",
139
+ "runtime/LawSpecSchema.hs": "9912d9f525426a598f9c03c29cfc7bacf80218f73c9d537d8c1257bae245aa33",
140
+ "runtime/LawSpecSchema.java": "885f5f17a9ea1bdb86915dc184aea25b72c3062d6ddb9605530310540b1cc166",
141
+ "runtime/LawSpecStrategies.kt": "569f7775c0ac44765d05567cbf62d026558ac193c080ca71681ec6ee49c21794",
142
+ "runtime/lawspec_codecs.go": "b3024fe60b3b66df9ebffe995ab5bb0294a609a82c611d54957e092eac29f2f5",
143
+ "runtime/lawspec_data_strategies.go": "cbddf44fbd222ad39bda3278dd433c6592a90c1808a5c157e02d8be931244c9a",
144
+ "runtime/lawspec_data_strategies.mjs": "f2e04a8d1b418afa6b8b6a993e222bdd5d84fca800e7f5071157b7888af0907c",
145
+ "runtime/lawspec_data_strategies.py": "685212fa4ecdde0139336d9fb9a6b8aca15ed5d3eab02c33b4cca4b39ad21eb5",
146
+ "runtime/lawspec_runtime.go": "af6ef660387b625b3bb5fcd57f06260c821d4f65eda158db44ad12d66e1d70f8",
147
+ "runtime/lawspec_runtime.mjs": "3b7877c1ee523afba30ed24cd452e2a6126d9e741c7675600e867600d7a73f46",
148
+ "runtime/lawspec_runtime.py": "2f780bc92762eb1115f734a36cc224ae34504929b4ff0ec506735cfa9e3ab02b",
149
+ "runtime/lawspec_runtime.rs": "7ae8afaad638a3d9d6973eebc7cd6daecc8012ec57f3f12ff50cca16e23e15b6",
150
+ "runtime/lawspec_schema.go": "bdfb6f2552bfccf56073d52f7cdbe1d784cba2d956c29762d77df7ad6bba8d67",
151
+ "runtime/lawspec_schema.mjs": "60eb4204461eaa2c207fc7c3394014e2a814e4383b7045c065b4dae7c7a202c2",
152
+ "runtime/lawspec_schema.py": "b6967ef1a33fe6a1a180d5573ec37cd8bb2079c06e961ac2eeb05f23cffcdd07",
153
+ "runtime/lawspec_strategies.rs": "ee2d42c4bc86bf1ccfcd3a8efc5628475829ea2551c4321e217485fca63433fa",
154
+ "runtime/rust/Cargo.lock": "03b17464317ee1e91281576aab67007cd8956e58a9d22665bc29045acdbbfa4e",
155
+ "runtime/rust/Cargo.toml": "615f3f40d2901e36b8ca5f2c105863264c93327c939a04f61469c658d352255f",
156
+ "src/LawSpec/Api.hs": "392f6e8c1a9ae81a95e219ac071e5b4bea03ee330d63b829036f8f54b2eda8a7",
157
+ "src/LawSpec/Backend.hs": "03c3b0cd62467ca677c88d29d7b12b2ab505cc0076d93d1f48fbddb0e9bcf133",
158
+ "src/LawSpec/Capabilities.hs": "e43d4fc3a4481fbb8aa3ff1c3f41f7e7fca5db01bfe256a30162a45d75a00c1c",
159
+ "src/LawSpec/Code/Doc.hs": "9e3b70f85deb1dcbce385af1d0cd4bea2dfa8a2d806d54745d4bb437406673e5",
160
+ "src/LawSpec/Code/JavaScript.hs": "77bf27dcc210216e4739f68c4709f556f80130ab83b3b9387ac4a2421e790910",
161
+ "src/LawSpec/Common.hs": "107612a8aaa787488413acf9c1a56622004d3bff251db89b99928343e6070883",
162
+ "src/LawSpec/Compile.hs": "0260f0f1dc3d18d2f2e172ab47d603b6e3029ce2948cc0a237ad8277fc64707f",
163
+ "src/LawSpec/Core.hs": "ec081c49e5ccce95f84ded6073f1d8f30298f061dd8b94437d4b00410c57f27c",
164
+ "src/LawSpec/Core/DefinitionContracts.hs": "b7f60f038b231187ecf898e585ae1a8fb1fc113bb55bad6d1bb2660350fd969e",
165
+ "src/LawSpec/Core/Definitions.hs": "52f024fca59661142f70f9aa7dd2cbdb4892e5d3b1ca8079c878c5a1ba667112",
166
+ "src/LawSpec/Core/Eval.hs": "e1ad8af5b240dd99c3b1126408d2be5f9b42b86ca6189ecd3868680a5119d931",
167
+ "src/LawSpec/Core/Expression.hs": "84985f4f685126253d3af7b6b605d80d28fc9aa115bd5e2946f989eeb1355224",
168
+ "src/LawSpec/Core/Payload.hs": "df6a2b250c27c12bb6ac16b84847c52546081d066a3dca7575ed0d743cc13d50",
169
+ "src/LawSpec/Core/PayloadPlan.hs": "f2a7d2dc58c6a0f79707bdc24773bd3aad3a3b8eea2735a8284b2a9f3a4af4a8",
170
+ "src/LawSpec/Core/RefinementProof.hs": "c19fc03e68488357a59897ec38ce3d2efd320c35b405b632af17425d6a18447a",
171
+ "src/LawSpec/Core/Schema.hs": "9a4ec3967803913e6ff43d33e00a1b4b3b8ec0c79dbdbd80ae98101c85bf430f",
64
172
  "src/LawSpec/Core/Semantics.hs": "a9d019433e3b9731f8cd0f65ec0ccc53179824bea58247b72df26760b878c2b6",
65
- "src/LawSpec/Core/Validate.hs": "bd67926c872e190279f3758ad57b45c0f80d5be8381cedc8ac56a5b88b115201",
66
- "src/LawSpec/CoreEmit.hs": "7ba225a262372f61edd6fe2ba0f2dbade44dfa2f767cdbcdd3f4c323eb5e9e7b",
67
- "src/LawSpec/CoreNativeScalarEmit.hs": "f20382952f5854605ae617609c1ff9f5627e5acb134417cf3a67b97054844acb",
68
- "src/LawSpec/CoreScalarEmit.hs": "db564e0cb07c69dee63b7dcb9cd524c30d4e7d658264d72f834adcc9fa05899d",
69
- "src/LawSpec/Domain.hs": "8ad50ad3a37aacb3a429c2d7924279e2a3b973204ce3c5c04c634c1b9ada0151",
173
+ "src/LawSpec/Core/Total.hs": "95d2b19ba7fbfd033295504d31f786815384003b3b4d370776860b423cf079dd",
174
+ "src/LawSpec/Core/Totality.hs": "8f5b5d69f4baaba45301899ef568cbe90133943c3771ba78d492424e9725e7a7",
175
+ "src/LawSpec/Core/Types.hs": "48ed1d197ce7089737895b7279f93437301fcfacff8b3a8dd98ecd7f1cb32b37",
176
+ "src/LawSpec/Core/Validate.hs": "0f045241215e068081d6cd7cf451f0166671bae5fffafda71a2e2320e8014c27",
177
+ "src/LawSpec/Core/Value.hs": "f2b2e4d82491e184d60b1217922b25c57a06cbbaecb2cb6f31174af50268fbc9",
178
+ "src/LawSpec/CoreEmit.hs": "075f06ef1be2437542967b171c535686f33ed4645f6525a93c1024a9fbf68582",
179
+ "src/LawSpec/CoreNativeScalarEmit.hs": "6caf801922e8969eac7926bef641d950aebf5cd32b2e4b7ce3f6f32f91f41d99",
180
+ "src/LawSpec/CoreScalarEmit.hs": "ea87bcf97a7be02cb4e83728b9dd4f5fa5a0c461e3f31f89e4d28242c148b43c",
181
+ "src/LawSpec/Data.hs": "9dbeafa120276b114dad790ec69e617f7ad0c632e3c718962f2f7faf8ca327f4",
182
+ "src/LawSpec/DefinitionTotality.hs": "7671b7efb0cac5d796b074d48b2c10940e5bd0b5df082b926aee694903285efa",
183
+ "src/LawSpec/Domain.hs": "222d15f0012ae630802238a6d7e1ee78d1e718b599f5ebb5a1ddc4e8d29d68c3",
184
+ "src/LawSpec/Elaboration.hs": "86e3ef77a977cb1b55985e2939648135acd0c2c015afe76e34e09615d555f53e",
70
185
  "src/LawSpec/Emit.hs": "9f34f5765915a2a12a66a6dca647ddaef9289372956802c6d99cf0cfec447c7a",
71
- "src/LawSpec/Eval.hs": "bbaa50d3febee690c3b09ceb3f2592964cdb458dd1b4c38b6ec68a80f3e077ea",
72
- "src/LawSpec/Frontend.hs": "b483732416f23960f0f03c30079a6db3ba630cf013b38fd6beede08b186585b8",
73
- "src/LawSpec/Gen.hs": "f0a153e05fb0599a7cb2303dd62a269b2561738466c7211efc1927af2d5604b0",
74
- "src/LawSpec/Model.hs": "75cedd730b8e8f7bff2dd39cfe3c1ed8f64e74471f6231248474957df446328f",
75
- "src/LawSpec/Parser.hs": "e64356888d78f02572ff8c0a39b782248dd6a4bb9f0b1e30900f9dc12c3cd946",
186
+ "src/LawSpec/Eval.hs": "b0872ba8a6974463b32776653c2939826a6be87318c15641401f913f6b139de2",
187
+ "src/LawSpec/Frontend.hs": "fbf091b9c96f5b5361dbf4f65819634c0f8526ff98550d97c434c0d47af7839e",
188
+ "src/LawSpec/Gen.hs": "c76d00fb1f7e9ed2eed7d387f1cd86cf4d12cc57f007abb0e479043b0ed377e6",
189
+ "src/LawSpec/GoData.hs": "35efbfdc1079e777d4760069fa2405a9700bbabab7dc7e3c2c5e0757312ea201",
190
+ "src/LawSpec/GoDefinitions.hs": "09e9e4b60cfea893d35589cd18bc8a6099789d81e0f57ae5cb018bd95bd4838b",
191
+ "src/LawSpec/GoExpr.hs": "da3a7cc0e3d2906886dc44f6b990e72098bb351558bbb31ee335da7382fac58a",
192
+ "src/LawSpec/GoNativeBinding.hs": "1ad8ea4cec6187c7e6005651c0edeec69e196eb329fb958c833da7751225aa1b",
193
+ "src/LawSpec/GoProperties.hs": "b0b92af071b70058802627bfb971e1b64e05847f27ef0645b2d7325a3867fe1d",
194
+ "src/LawSpec/GoTestHelpers.hs": "dee55ee8505370e932773b8c685f4a1f380129e6f43f8806bf1e82efb99451b1",
195
+ "src/LawSpec/GoTypeRefs.hs": "7f239f5ac3ac8bd21c8f76c328049f7715d8562ee1382befa0a58abd4f15f726",
196
+ "src/LawSpec/HaskellData.hs": "51374f35de2b1d6c78d15597e41e6f0695fe5fdb040cbb35a7d03d23fa3a3179",
197
+ "src/LawSpec/HaskellDefinitions.hs": "535a8d644d5ddb98c22fa6bdf34cf2baa787aa1f5b900815c621d0d65ede0f0f",
198
+ "src/LawSpec/HaskellExpr.hs": "f4144cf2022ef0a3bec6d796ebe7d2f42563e9d25758b9f362cd5545b47e802b",
199
+ "src/LawSpec/HaskellNativeBinding.hs": "9f98aa0c8659b572bd6486a0e29c4692bc6432db8639fa74a09bbf1b771bbfa6",
200
+ "src/LawSpec/HaskellProperties.hs": "4a7c2aafbb3418e7e926d420d59e810a70e80b8e61a5efaad73d3282038c9d3c",
201
+ "src/LawSpec/HaskellTestHelpers.hs": "51e59b2abc9e85455e3c8e2c6baadb27e5d319081cb730d2ce56be5dc8053897",
202
+ "src/LawSpec/HaskellTypeRefs.hs": "2225b2a5e2ab3662e7202d23b24f4d6db48353b35ae28df8acd2b92fd2b97574",
203
+ "src/LawSpec/Inference.hs": "78285145897f03c3c4adc37acf0f490ea779bab3975fb2830628dae3a152fe38",
204
+ "src/LawSpec/JavaData.hs": "177713377f7a38d69fbfd7891899357fc55782cf1d361f2e9dd5baf8725d4067",
205
+ "src/LawSpec/JavaDefinitions.hs": "9c0fe11bd4849af09bbe3d941d89ba609a2dabecdc1c8b09b6ddbf69671c8f92",
206
+ "src/LawSpec/JavaExpr.hs": "6f237b0fc1eabe2d53c160f4cb781f8b77b478383f1a77ca4ccc8f08ac0dbcd0",
207
+ "src/LawSpec/JavaNativeBinding.hs": "8abbae78959a5cb61b7c6ae1c9071e43d10e26c2f421766d431fa18031f87173",
208
+ "src/LawSpec/JavaProperties.hs": "ecc1c94bb212d214f1eb8b2897204b65390aad7be858afd8e118e71e28d46bf2",
209
+ "src/LawSpec/JavaTestHelpers.hs": "e6f4b9bbb7e5f07ece6ab1845e12aa661e62e8b926680b11454223fc3ec1523d",
210
+ "src/LawSpec/KotlinData.hs": "7785fc0c091e50010bce3002355f01c1d237fce05bca6a7ce6de6d207737e228",
211
+ "src/LawSpec/KotlinDefinitions.hs": "97d7d407d4bbdb4ce16035d607dbbcb8e3d6f5db513f2123a2c269e3dc6d2b38",
212
+ "src/LawSpec/KotlinExpr.hs": "20312f0774f1d0832a21a19b93c8103e2791ecd32a827d8e9c4f2b4830a996a0",
213
+ "src/LawSpec/KotlinNativeBinding.hs": "1aec7854758f07a4d2288de13931fbb88ef32220f85d3c84fe8233ad67b6d095",
214
+ "src/LawSpec/KotlinProperties.hs": "9d71af0bd05db95ab4cbd80210730c126f235d5b16dc07ca76c6230119b788c6",
215
+ "src/LawSpec/KotlinTestHelpers.hs": "74810d65faafc6ed4d64b1fb0596cda4186e586b7144a7441641b798795bc324",
216
+ "src/LawSpec/Model.hs": "1d7ceb7bd66e3d496eef89eaa86403e6896472317ca9a4be86e0c933a7cce403",
217
+ "src/LawSpec/NativeBinding.hs": "33959b0fd432ad4150f3b685f6438e284b801c2a59d9ef3132486a1cc7c8925a",
218
+ "src/LawSpec/NativeRequest.hs": "fb2dc88f42424ca520533700eab68c407a5de83807d1b0d8c976e6c4f3d65212",
219
+ "src/LawSpec/Parser.hs": "ad11e8f06371e98f295fae0245edceac8142320f054d0c3cb5600bc72588e17e",
220
+ "src/LawSpec/PortableGenerator.hs": "69d457e39f539c77fc7a4c08205e75352bbecd9dfdff031a283a39bf44b22d49",
221
+ "src/LawSpec/PortableTestHelpers.hs": "8ba4d87183c8c11f6ef1ce21c170127335797154f29fb97ad3429f032a167fd3",
76
222
  "src/LawSpec/Prelude.hs": "b1e155c12f58e7c346551a0c65c5d5af76d045b3f1625977ca2a5d1c97cb8c46",
77
- "src/LawSpec/Public.hs": "eec6c9684b3c5cb42fa882f89460104856cb02f963822b66d9b9583dc011dfeb",
78
- "src/LawSpec/Refinement.hs": "9902897edc0a803c2d440cf6d5a1d44e524f94b7384ea55a6f9dcd16dbfa8957",
79
- "src/LawSpec/RuntimeSources.hs": "69dadd138bb784eaebd74869d03e30079e6d73e1724179794d8ec32be178e171",
80
- "src/LawSpec/RustEmit.hs": "702652cc590c5db148f35d2e591d90e45270eee47e78c31772749943509aafe7",
81
- "src/LawSpec/Scalar.hs": "2907d94b72e66584b762b5ab33da64adb26f9bf84b885151ef408dc3de1a440d",
82
- "src/LawSpec/Testing.hs": "a5dc1c15a45539bb72d1c7cb24cbd04888bbb8ef2f066c829654c3bdbf32c609",
223
+ "src/LawSpec/Public.hs": "1b5e6031983cdc81559faea8a9a7e9a7bfab835de90fbf8c89f26844c411563a",
224
+ "src/LawSpec/PythonData.hs": "07e9bb54a1515f3f4744b7b9bb43633cbdbf07b3f9e35efef511753f97e216d5",
225
+ "src/LawSpec/PythonDefinitions.hs": "bc7b971be97339f2d9e4962ad98100878266176aeccd2a9dfd014e2db9550bd8",
226
+ "src/LawSpec/PythonExpr.hs": "23d7d24b5fb4efff9cb63d38c02a93d95744ec79b4565daf1412088fc7c4ba59",
227
+ "src/LawSpec/PythonNativeBinding.hs": "6b7d7f34ce97fb518aef7413d3f72a3a199c2202f0c25a922d860a21c93acc62",
228
+ "src/LawSpec/PythonTypes.hs": "ef928bfeb4324eb6e53c99cae247cc2fa84816075d81de4589d14abaa326656a",
229
+ "src/LawSpec/Refinement.hs": "8058a9f7e433b4b00ef0966a9ea2be3c91ae93b591ed58a1ffcb792d316193d3",
230
+ "src/LawSpec/RuntimeSources.hs": "27ee0e26827a9f6fe9bdbaf29447980b0fd3289aa8350fda9996d59218718e79",
231
+ "src/LawSpec/RustData.hs": "8fda864335ccb5478c39f56cb714d5275edf36fcbdc2d152bbe94960b644ad98",
232
+ "src/LawSpec/RustDefinitions.hs": "5d0328a8b17e0cb5067f65d23f0f2cd2a96b92e4b1c3d6e22b7cb08255697177",
233
+ "src/LawSpec/RustEmit.hs": "e01be4504cde6ebfeae0327a1304e149bd49e2ef5ff96ec0cb9cf718c7041888",
234
+ "src/LawSpec/RustExpr.hs": "04b2ef81417b811c7b98a98acdadab4e588ca8757964a63ba8dc5936c36479e6",
235
+ "src/LawSpec/RustNativeBinding.hs": "9d08348da571ac335e335e48c1ad4a67108f7bca54119f5960480e97a6d1da84",
236
+ "src/LawSpec/RustNativeGenerators.hs": "a3b1484d9ff0008e4f961aa81d0aa51da57ec0cd7909124e80c98d56aacc8ce9",
237
+ "src/LawSpec/Scalar.hs": "52e61fec81a337bb5b35e9e6f501446cf0b18bffa6c6af2ddc5aeac2d6e07131",
238
+ "src/LawSpec/SpecializeDefinitions.hs": "08f2fe674a5e00d1be396d9edab0dd2c948b7beb12fa99f2a6aba00cbdf01e33",
239
+ "src/LawSpec/Testing.hs": "db1a427ac2197e447faf2a36eccfe965c58eaa0ba07bc494bf1ba24e4af43ad4",
240
+ "src/LawSpec/WebData.hs": "919af27be12f63f17762e0c052341ab82dcee5d45951a4fd9c66abead98d1ee0",
241
+ "src/LawSpec/WebDefinitions.hs": "fd985db70c778c8014b780666ac327018e05260be610fa717b8c5477ba9638b4",
242
+ "src/LawSpec/WebExpr.hs": "0389dcd5cf7479dd23ef034b1012de6ebd70bf1dc9e3d90981dfb0ba2702596f",
243
+ "src/LawSpec/WebNativeBinding.hs": "512c224b8fbe979eac3f490bb035f9371097eb13399bd361c016b397f8c2c777",
244
+ "src/LawSpec/WebTypes.hs": "f77ffee1e0c7929964a889fb252c1c5d0977afed94664ffcb0f8770c37b98c70",
83
245
  "stack.yaml": "20ccf4d599e355e60b7aa4f814a7cd4299fe2048616cc2e6dbdc22a7bd8cec73",
84
246
  "stack.yaml.lock": "ae222b9c81af920c56e50fa4596fa57786e7fa5a7b461390362b2b2ff63818c7",
85
- "tools/embed-runtimes.py": "26dda6ecf944ac065d10165d84ecdf44f134945fabbd48492a67d2495b5faba4",
247
+ "tools/embed-runtimes.py": "91a05197fc542a65387f3ccf4614a4817c850031eb4b84196c621b8baf344865",
86
248
  "wasm/app/Exports.hs": "4ecbdac8faa2449e6fc61b93c82e6278fa14374154f29b4dacf0eef433f06a47",
87
249
  "wasm/cabal.project": "021e560afdc5eb4cb7169e7119ecb8f92c9ee170245af909c94b612941bff5cc",
88
250
  "wasm/cabal.project.freeze": "733dbed3d2ecccb26e874fd58f136296dad772184deb1658c196b5d54a0814dc",
89
- "wasm/lawspec-wasm.cabal": "22590b2a6fcd384ef8957bd179e04a055e90535f7eaaa2b5ac3d314fd0b686ed",
90
- "npm/core.wasm": "09efa9e767c3d33e718a8a0909cdf23b24d158813570cc610f56e72d37a59fa3",
251
+ "wasm/lawspec-wasm.cabal": "3915e30a899fa1aaaa811c225965bd8b39a25bc639299ae6077587cd09020688",
252
+ "npm/core.wasm": "6424553b1a5df71da4f7bb54acdd09fd15d6335954df76035e0015de18124faf",
91
253
  "npm/core_jsffi.js": "88d136efe92f7cff5758c8fec8d9b6bbc9707fe37741cebeeb415fe34ce3d72b",
92
- "npm/api.mjs": "7415fc057ea5f4da68f9d255ce862152d6bc45d6b0053d44f61f9110911ac64b",
93
- "npm/index.d.ts": "d19ecaea0be4ca01c8667a76e1bcfe758fd200d728ef67a44ad14e1b1dd15b72"
254
+ "npm/api.mjs": "e93251db289ff0609abaff78ad67f0a9af82508c1141c6a999604f67c56b6e7d",
255
+ "npm/index.d.ts": "2674f8830bd20a2b9ef7dfa99e183598125b6bcc17e8d454e8f7cca1bbd2c9fe"
94
256
  }
95
257
  }
package/core.wasm CHANGED
Binary file
@@ -0,0 +1,38 @@
1
+ package payments
2
+
3
+ import "math/big"
4
+
5
+ // Application-owned domain types, separate from generated canonical types.
6
+ type CurrencyCode int
7
+
8
+ const (
9
+ Dollars CurrencyCode = iota
10
+ Euros
11
+ Pounds
12
+ )
13
+
14
+ type Price struct {
15
+ Major LawSpecDecimal
16
+ Unit CurrencyCode
17
+ }
18
+
19
+ type PaymentStatus interface{ payment() }
20
+ type Settled struct{ Price Price }
21
+ type Rejected struct{ Explanation string }
22
+
23
+ func (Settled) payment() {}
24
+ func (Rejected) payment() {}
25
+
26
+ // AddFee uses independent exact integer arithmetic, without ambient rounding.
27
+ func AddFee(price Price) Price {
28
+ exponent := min(price.Major.exponent, -1)
29
+ power := func(n int) *big.Int {
30
+ return new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(n)), nil)
31
+ }
32
+ amount := new(big.Int).Mul(price.Major.coefficient, power(price.Major.exponent-exponent))
33
+ fee := new(big.Int).Mul(big.NewInt(2), power(-1-exponent))
34
+ return Price{LawSpecDecimal{new(big.Int).Add(amount, fee), exponent}, price.Unit}
35
+ }
36
+
37
+ func Restore(value PaymentStatus) PaymentStatus { return value }
38
+ func Store(values []LawSpecMaybe[PaymentStatus]) []LawSpecMaybe[PaymentStatus] { return values }
@@ -0,0 +1,13 @@
1
+ package payments
2
+
3
+ import (
4
+ "math/big"
5
+
6
+ "pgregory.net/rapid"
7
+ )
8
+
9
+ func NativePrices() *rapid.Generator[Price] {
10
+ return rapid.Map(rapid.IntRange(100, 200), func(cents int) Price {
11
+ return Price{LawSpecDecimal{big.NewInt(int64(cents)), -2}, Euros}
12
+ })
13
+ }