lawspec 0.18.0 → 0.19.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,112 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.19.1
6
+
7
+ - A handle's Kotlin type binding can give the native class's type
8
+ `arguments` (`["kotlin.Int"]`), so generated Kotlin names the handle's type
9
+ in full instead of `kotlin.Any`.
10
+ - A Haskell method binding on a handle with no type binding names the handle
11
+ and the `lawspec.json` entry to add.
12
+ - The sessions example's adapters are asynchronous, so the JavaScript and
13
+ TypeScript ones await each receive instead of using `receiveNow`.
14
+
15
+ ## 0.19.0
16
+
17
+ ### Stateful models
18
+
19
+ - A `model` pairs a system's commands with a reference: a model state and a
20
+ checked definition per command. LawSpec generates runs of commands from the
21
+ model, runs them against the adapters, and checks every result, abstracted
22
+ state and invariant. See [models](docs/reference/language/models.md).
23
+ - **Linear** models thread a flow-typed state, and each command's typestate
24
+ comes from its flow signature, so runs never take a step the types forbid.
25
+ **Shared** models share one handle; `when` preconditions come from the
26
+ model state.
27
+ - Generation and shrinking are portable: a SplitMix64 generator over type
28
+ descriptors gives the same runs and the same shrinks on every target for
29
+ the same seed. A failing run is shrunk by dropping commands and shrinking
30
+ arguments.
31
+ - Shared models also run in parallel: a short prefix, then a branch per
32
+ thread, run at the same time with random yields, repeated, and each history
33
+ must be linearizable. Sets and maps are checked key by key.
34
+ - `consistency sequential`, `causal` or `eventual` relaxes what a shared
35
+ model's histories must satisfy, for replicated systems.
36
+ - `behaves like Queue a` (and `Stack`, `Deque`, `Set`, `KeyVal`) checks a
37
+ model against a built-in collection, with no reference definitions to write.
38
+ - `handle Name` declares a type only adapters create. With native bindings,
39
+ a handle can be a target's own class, such as a concurrent queue, and
40
+ commands can call its methods and constructors directly.
41
+
42
+ ### Protocols, scenarios and typed channels
43
+
44
+ - A `protocol` lists what one end of a channel sends and receives. A
45
+ `scenario` runs a shared model's commands from processes (`par ... with ...
46
+ end`) that talk over channels (`send`, `receive`, `expect`). LawSpec proves
47
+ each scenario deadlock-free (its channels form a tree) and race-free (every
48
+ channel end has one owner; sending it gives it up), then runs it on many
49
+ schedules. See [scenarios](docs/reference/language/scenarios.md).
50
+ - Every protocol becomes typed channel ends on every target, for
51
+ implementation code: a type per step, so an out-of-order send does not
52
+ compile. A used end fails if used again (in Rust, it does not compile).
53
+ `spawn` and `par` run processes on the target's own concurrency.
54
+
55
+ ### Actors and supervision
56
+
57
+ - An `actor` owns a state and handles one message at a time. Handlers are
58
+ plain functions from the state to a reply and the next state. Actors are
59
+ checked like shared models, with injected crashes, and generated as typed
60
+ actor classes on every target. See
61
+ [actors](docs/reference/language/actors.md).
62
+ - A failing handler crashes the actor. `restart from f by g` says how it
63
+ restarts. A `supervisor` restarts its children one for one, one for all or
64
+ rest for one. Children are permanent, transient or temporary, within a
65
+ restart limit that escalates to the parent supervisor. Actors also have
66
+ links and monitors.
67
+ - Failures are affine in scenarios: a receive from a failed process fails,
68
+ or runs its `or else`, instead of blocking. One run in three crashes a
69
+ process. Typed channel ends raise `PeerFailed` when the other end gives up.
70
+
71
+ ### Mailboxes
72
+
73
+ - `mailbox jobs of Job` declares a typed queue with many senders and one
74
+ receiver. Every target generates `JobsMailbox`, which can also be served on
75
+ a node and sent to from others.
76
+ - In scenarios, `mailbox m of T` sits beside `channel`. One process receives,
77
+ every message sent must be received, and senders join the receiver in the
78
+ deadlock-freedom tree. A receive whose senders have all failed fails, or
79
+ runs its `or else`.
80
+
81
+ ### Distribution
82
+
83
+ - Nodes talk over a transport: in memory (with loss, duplication, delay and
84
+ partitions, for testing), TCP or HTTP. Actors can be served and called
85
+ across nodes, protocols can listen and dial, and checked definitions can be
86
+ evaluated on another node by content hash. See
87
+ [distribution](docs/reference/language/distribution.md).
88
+ - Values cross the network in one canonical encoding, the same bytes on every
89
+ target, checked against shared vectors.
90
+ - Calls and mailbox sends across nodes are resent until answered and run once.
91
+ Channels number, acknowledge and resend their messages, so loss,
92
+ duplication and reordering are repaired.
93
+ - A channel end sent to another node keeps working there: the sending node
94
+ relays the conversation. Every protocol can `listen` and `dial`.
95
+ - One scenario run in three sends every channel over a faulty network.
96
+
97
+ ### Generation
98
+
99
+ - A refinement's constant integer bounds narrow generation on every target,
100
+ so `(amount :: Int32 where amount >= 1 && amount <= 1000)` is drawn from
101
+ `1..1000` instead of being filtered out of every `Int32`.
102
+ - Generated Python property tests no longer have a per-example deadline, since
103
+ adapters may wait on networks or timers.
104
+
105
+ ### Evidence
106
+
107
+ - `lawspec evidence` lists models, consistency, restarts and supervision as
108
+ property-tested, and each scenario as proved deadlock-free and race-free.
109
+
3
110
  ## 0.18.0
4
111
 
5
112
  ### Railway combinators
package/README.md CHANGED
@@ -30,7 +30,7 @@ Node 22+ and the selected target's build tools are required. No Haskell
30
30
  toolchain is needed. The reference platforms are macOS and Linux.
31
31
 
32
32
  ```sh
33
- npm install --save-dev lawspec@0.18.0
33
+ npm install --save-dev lawspec@0.19.1
34
34
  npx lawspec --version
35
35
  ```
36
36
 
@@ -40,8 +40,8 @@ LawSpec can create `package.json` and its test script:
40
40
  ```sh
41
41
  mkdir lawspec-example
42
42
  cd lawspec-example
43
- npm exec --package=lawspec@0.18.0 -- lawspec init --target javascript
44
- npm install --save-dev lawspec@0.18.0
43
+ npm exec --package=lawspec@0.19.1 -- lawspec init --target javascript
44
+ npm install --save-dev lawspec@0.19.1
45
45
  npx lawspec check
46
46
  npx lawspec explain 'example.atoi_codec::itoa and then atoi yields a'
47
47
  npx lawspec doctor
package/bin/lawspec.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  atomicWrite,
18
18
  safePath,
19
19
  } from "../files.mjs";
20
- const VERSION = "0.18.0";
20
+ const VERSION = "0.19.1";
21
21
  const args = process.argv.slice(2);
22
22
  const verb = args.shift();
23
23
  const options = {};
package/build.json CHANGED
@@ -16,6 +16,7 @@
16
16
  "runtime/LawSpecSchema.hs",
17
17
  "runtime/LawSpecSchema.java",
18
18
  "runtime/LawSpecStrategies.kt",
19
+ "runtime/LawSpecTransports.hs",
19
20
  "runtime/lawspec_codecs.go",
20
21
  "runtime/lawspec_data_strategies.go",
21
22
  "runtime/lawspec_data_strategies.mjs",
@@ -30,8 +31,17 @@
30
31
  "runtime/lawspec_strategies.rs",
31
32
  "runtime/rust/Cargo.lock",
32
33
  "runtime/rust/Cargo.toml",
34
+ "src/LawSpec/Actors.hs",
35
+ "src/LawSpec/Actors/Go.hs",
36
+ "src/LawSpec/Actors/Haskell.hs",
37
+ "src/LawSpec/Actors/Jvm.hs",
38
+ "src/LawSpec/Actors/Python.hs",
39
+ "src/LawSpec/Actors/Rust.hs",
40
+ "src/LawSpec/Actors/Types.hs",
41
+ "src/LawSpec/Actors/Web.hs",
33
42
  "src/LawSpec/Api.hs",
34
43
  "src/LawSpec/Backend.hs",
44
+ "src/LawSpec/Bounds.hs",
35
45
  "src/LawSpec/Capabilities.hs",
36
46
  "src/LawSpec/Code/Doc.hs",
37
47
  "src/LawSpec/Code/JavaScript.hs",
@@ -44,9 +54,11 @@
44
54
  "src/LawSpec/Core/Eval.hs",
45
55
  "src/LawSpec/Core/Evidence.hs",
46
56
  "src/LawSpec/Core/Expression.hs",
57
+ "src/LawSpec/Core/Machine.hs",
47
58
  "src/LawSpec/Core/Payload.hs",
48
59
  "src/LawSpec/Core/PayloadPlan.hs",
49
60
  "src/LawSpec/Core/Policy.hs",
61
+ "src/LawSpec/Core/Program.hs",
50
62
  "src/LawSpec/Core/RefinementProof.hs",
51
63
  "src/LawSpec/Core/Schema.hs",
52
64
  "src/LawSpec/Core/Semantics.hs",
@@ -103,8 +115,11 @@
103
115
  "src/LawSpec/KotlinNativeBinding.hs",
104
116
  "src/LawSpec/KotlinProperties.hs",
105
117
  "src/LawSpec/KotlinTestHelpers.hs",
118
+ "src/LawSpec/MachineSpec.hs",
119
+ "src/LawSpec/Mailboxes.hs",
106
120
  "src/LawSpec/Memo.hs",
107
121
  "src/LawSpec/Model.hs",
122
+ "src/LawSpec/ModelTests.hs",
108
123
  "src/LawSpec/NativeBinding.hs",
109
124
  "src/LawSpec/NativeRequest.hs",
110
125
  "src/LawSpec/Packages.hs",
@@ -121,6 +136,7 @@
121
136
  "src/LawSpec/PythonTypes.hs",
122
137
  "src/LawSpec/Railway.hs",
123
138
  "src/LawSpec/Refinement.hs",
139
+ "src/LawSpec/Remote.hs",
124
140
  "src/LawSpec/Resilience.hs",
125
141
  "src/LawSpec/RuntimeSources.hs",
126
142
  "src/LawSpec/RustData.hs",
@@ -131,7 +147,16 @@
131
147
  "src/LawSpec/RustNativeGenerators.hs",
132
148
  "src/LawSpec/Scaffold.hs",
133
149
  "src/LawSpec/Scalar.hs",
150
+ "src/LawSpec/Scenario.hs",
151
+ "src/LawSpec/Sessions.hs",
152
+ "src/LawSpec/Sessions/Go.hs",
153
+ "src/LawSpec/Sessions/Haskell.hs",
154
+ "src/LawSpec/Sessions/Jvm.hs",
155
+ "src/LawSpec/Sessions/Python.hs",
156
+ "src/LawSpec/Sessions/Rust.hs",
157
+ "src/LawSpec/Sessions/Web.hs",
134
158
  "src/LawSpec/SpecializeDefinitions.hs",
159
+ "src/LawSpec/StatefulModel.hs",
135
160
  "src/LawSpec/TargetNames.hs",
136
161
  "src/LawSpec/TestManifest.hs",
137
162
  "src/LawSpec/Testing.hs",
@@ -150,9 +175,9 @@
150
175
  "wasm/lawspec-wasm.cabal"
151
176
  ],
152
177
  "digests": {
153
- "dev/Gen/Embed.hs": "41cd18500c1a8c9bdb51011ab4c74817f8e04b655aa10d9894aa1b93a3fa858b",
154
- "lawspec.cabal": "a5b307f47140711064647dda585c4f882af8072c9118d9c637e4c52bdac6032f",
155
- "package.yaml": "7e5212a8889ae07c4200ad953e4b40b5af7b0497fef565e5469e93526f3727b9",
178
+ "dev/Gen/Embed.hs": "98a186594c3c38a65aad1203d5730ce352b309f92e1990ccc508e7a5e00f8f35",
179
+ "lawspec.cabal": "49b548507a6af8fc1d3fa83defcb6de139bcf45b8e6043668e12011795eae7ec",
180
+ "package.yaml": "013801d35e8c72fe06b20fbf2a352d18228477f8941faa66342c42b8b4398632",
156
181
  "runtime/LawSpecCodecs.hs": "1b3f6b40ad49928cf5e9386e06bc2992c9f1271754351b9fa3075e50346ef03b",
157
182
  "runtime/LawSpecCollectionCodecs.hs": "74caa786801c5142ed040897c7ebb7373abf49ee49e02af53e466646fb624f47",
158
183
  "runtime/LawSpecDataStrategies.hs": "9cc5b98476364a6c255dc3eb40c53d65b4a9d4ab0c3961a806b3515a8d5e8f7f",
@@ -160,146 +185,171 @@
160
185
  "runtime/LawSpecKotlin.kt": "0cf3b7de0406155225ccca33ee3dfdf8f0456c47d577f6be8f1265c13df838cb",
161
186
  "runtime/LawSpecKotlinCodecs.kt": "811accd1cac055d46f7ae0a2aff03602389fbbaaa2eaf778a9dcdd6899b12466",
162
187
  "runtime/LawSpecKotlinStrategies.kt": "8ee1edeec1c342f2bc70ca8bdad22ec5aabc38f6f61381fe905b717ffce0688e",
163
- "runtime/LawSpecRuntime.hs": "63b6c7d12271bec263c6095ebc2fe9318799eff4235f3b877f63a967a4b81352",
164
- "runtime/LawSpecRuntime.java": "c7763b4f2a6060b696f89ff0a932ccc68d5d9af3cbfdc258614c7b90aec4ff8a",
165
- "runtime/LawSpecSchema.hs": "c19eedd197fc2359780c1576dd6a1d6e9bcdaf2ed037b5dbb37f3db766356bf9",
166
- "runtime/LawSpecSchema.java": "bdf02d151db8635956d5d1266ba4434e507aee573eb8659112df010980a8d854",
188
+ "runtime/LawSpecRuntime.hs": "671895d4746c491f640fb3076a65f49386a6e8615b507f277d813fe1a66bc76a",
189
+ "runtime/LawSpecRuntime.java": "298f696cc3df5694a003e46fc9070748d00faa91e46dcc59d9e0f195fcd82e92",
190
+ "runtime/LawSpecSchema.hs": "1000ee60eb6910a9fd4fdced5940014eb1a0720afecd4e2b571f185aec6de5de",
191
+ "runtime/LawSpecSchema.java": "78b715e9ad3f20603c6a05c6f06a3736664a1821d9a6f4d73f3ff1dfed74473a",
167
192
  "runtime/LawSpecStrategies.kt": "569f7775c0ac44765d05567cbf62d026558ac193c080ca71681ec6ee49c21794",
168
- "runtime/lawspec_codecs.go": "57dadec7eb3e9912178b3d6f2e507a42f03f4e81807ffd30385dba446f6ef4dd",
193
+ "runtime/LawSpecTransports.hs": "77d121016edc2792d456c9ba6297dd897beb46b609cec7611915888dad40ed0a",
194
+ "runtime/lawspec_codecs.go": "039c4014a78b267754de4ec1c6da6a94ef7d651b60422a120dec9d83ce31a28a",
169
195
  "runtime/lawspec_data_strategies.go": "65ca2a09012c516c17bb66d7381637e71f454740858f648a78b9e536f1c7c600",
170
196
  "runtime/lawspec_data_strategies.mjs": "5fe9327a6dda2e759558b77100aec96798f1aed4f517d4bc91f45a543b8d14b9",
171
197
  "runtime/lawspec_data_strategies.py": "0d06f0c5b9cdd5f6659f424a328884b670c94b1572ec0fa5d5408a05110d94dd",
172
- "runtime/lawspec_runtime.go": "36f73eedd4ca35e6b7ebb93fd63ac356e8e04366c63c80b42cf72112ec8b8ba8",
173
- "runtime/lawspec_runtime.mjs": "576389ebdc770bddb4092bb9229a71ce54e37ba8da90ffde8de15305004c0ec8",
174
- "runtime/lawspec_runtime.py": "93c8b0bf87d9e6af26bb33e4c1d8611927df295e9cab9d11f73872d0f35ccbf6",
175
- "runtime/lawspec_runtime.rs": "1e9f898325dda99e44f07e7d422e7b234ebae73d7845d98391f8e3d6851c6f0e",
176
- "runtime/lawspec_schema.go": "7e9361e9693c3885d98500026f3e3ef8e213eb72a489a58fc72669e8a9938103",
177
- "runtime/lawspec_schema.mjs": "d77abea1a9dcb03e4a6c6eef6509971d8599fac9acdefa9b9e4b89b8d0fc5226",
178
- "runtime/lawspec_schema.py": "dd29fd2624c204442bfd3ed8a420a853413aa520c5d99f4e5028db7ce21e34c8",
198
+ "runtime/lawspec_runtime.go": "25b342e07996db86c4b997aa2a7f48aefc39d6ebff6cfad58095f4756040ed61",
199
+ "runtime/lawspec_runtime.mjs": "755b90f13085b409302df1cb3b396dd6917fbdbaab66c9903a29f3981e5e936b",
200
+ "runtime/lawspec_runtime.py": "0949983cf2594cb2e9eef812f570a775a56ab50c598c4872a0bbad427b0372d3",
201
+ "runtime/lawspec_runtime.rs": "3221a2de8ed83fb5586ec1b0dd8dbdf4954ea5f71a0f5f23930fb8da4cb36581",
202
+ "runtime/lawspec_schema.go": "83c7ebf07c386fdfcf55562f4b1d6947ecb1d6a022f50aa0d49b4bce0eead746",
203
+ "runtime/lawspec_schema.mjs": "89b3b76ffd0ddd70c4bd49b73ca08a359d70aa3994745746978ed615676fde26",
204
+ "runtime/lawspec_schema.py": "4c8ea9895f2f93ff5d34c4df414305bc0c2a151edd4e192ebc8982b35fa7782d",
179
205
  "runtime/lawspec_strategies.rs": "6c21050184ac20b2ad38e99f47b78fb013f1916389e85e522dd73209133af990",
180
- "runtime/rust/Cargo.lock": "f7200d8d23c2325ba49315e5f03b58957c0a1df6ef9fea3542aa0bd95ed605ee",
181
- "runtime/rust/Cargo.toml": "e5c2240c00392995e668ce50c26bd1e96cd57719b3769d09bab077519a5cd198",
206
+ "runtime/rust/Cargo.lock": "3a1d2207563535ef88fc7d5dc45ed42eaec1ade27229ed81f4837a236ed27319",
207
+ "runtime/rust/Cargo.toml": "0fcc1650d227d553d953b2e09f3fe8436d3183994646a0194628d72545e536aa",
208
+ "src/LawSpec/Actors.hs": "98677022a6d596bbdbb32c69a23bdc0ade9dd18bb60067bdfb2c280fc0c54089",
209
+ "src/LawSpec/Actors/Go.hs": "81f732637abd28e5d7ba1ba94dd0a8bf88722accf9c2583453f7dae176460429",
210
+ "src/LawSpec/Actors/Haskell.hs": "7fcc71ca1f7eb2e57aba631f0cf9334a1dd6ab644211126fa831535bbfce90a8",
211
+ "src/LawSpec/Actors/Jvm.hs": "134ef10ca7e86f0f47517e67a9fcf9a9f8fe646152ed9ceacf5099af9fc1671c",
212
+ "src/LawSpec/Actors/Python.hs": "f451178ee04bed1b9cead845582c523f475999621c4a2013373b43187b993833",
213
+ "src/LawSpec/Actors/Rust.hs": "e36b8e3fd7add15d12b7e92b71ef98d038e9d78343c89b58fcbbf6c57d6cada7",
214
+ "src/LawSpec/Actors/Types.hs": "6831a6aafa5486f2e8d1d454e6448a7908235f80fc00c91239f91258fc22952a",
215
+ "src/LawSpec/Actors/Web.hs": "6660ddc6ac535e926c222dd413934474a775c98ce18b4f709b30555a5e00aed8",
182
216
  "src/LawSpec/Api.hs": "c0cb09ea2754f79138697e6ee6b4817a43d8343cb410380389d6b321c2feb07b",
183
217
  "src/LawSpec/Backend.hs": "709581d869bbc3c3103d72b8d4b4d506b96eceefee03add45ca36acd5cedf41c",
218
+ "src/LawSpec/Bounds.hs": "00c4467bbd1d96cd31a1ac43b42226079126e70158bb87f365d6b9ea2757ff54",
184
219
  "src/LawSpec/Capabilities.hs": "ab457f3da440a237ee731d664b94d95a0cc1fa4d8be4d4d0403a61ebcf98e310",
185
220
  "src/LawSpec/Code/Doc.hs": "9e3b70f85deb1dcbce385af1d0cd4bea2dfa8a2d806d54745d4bb437406673e5",
186
221
  "src/LawSpec/Code/JavaScript.hs": "77bf27dcc210216e4739f68c4709f556f80130ab83b3b9387ac4a2421e790910",
187
- "src/LawSpec/Collections.hs": "0635f3164c8d234956b7d47c7da3d2ab7a857e3d7eca55873777cf4492356f95",
222
+ "src/LawSpec/Collections.hs": "504af1d31c267287456fde20d2782c72c519abf4ce26b083e59a7aefa876a768",
188
223
  "src/LawSpec/Common.hs": "107612a8aaa787488413acf9c1a56622004d3bff251db89b99928343e6070883",
189
224
  "src/LawSpec/Compile.hs": "efca518b2f0a7dff48927dedc3d6752e10228520d1cae4567aabc2bfac3d94a1",
190
- "src/LawSpec/Core.hs": "3584b20ad29ba9a939c6ba8967757f4cb49078e325bec7acdf4b2e00cdde3bb2",
225
+ "src/LawSpec/Core.hs": "73b08330f973a47c792ec879a153687438efb3f97e26f5e052d2f23f9cdc4053",
191
226
  "src/LawSpec/Core/DefinitionContracts.hs": "b7f60f038b231187ecf898e585ae1a8fb1fc113bb55bad6d1bb2660350fd969e",
192
227
  "src/LawSpec/Core/Definitions.hs": "a57e30f6864a6bae7e60cd08ef968b1adc9bbd1c86d4b20c405276eccd604f8d",
193
228
  "src/LawSpec/Core/Eval.hs": "7c55598054f76e5f3c332a53df46bc2090a4914e8e1460671896f50db0102a9d",
194
- "src/LawSpec/Core/Evidence.hs": "48442ab98eafaa0f09d56c01493b73b724845347bbd27ae390c64366faec938d",
229
+ "src/LawSpec/Core/Evidence.hs": "e8870096ca2e3fe46325ceff13cbc93fd6d0b46c9aa9c56300e9269460c3d773",
195
230
  "src/LawSpec/Core/Expression.hs": "850ff201b56553021404ed783e037f9a27a7d70658c62f5e22e89868bb06044a",
231
+ "src/LawSpec/Core/Machine.hs": "7ba46cdc4934af3ffd52f3766e56091a2d8e04a9301dde16be7ebeb3260fbd79",
196
232
  "src/LawSpec/Core/Payload.hs": "da2417fc99354338eab49a688c5f36cecde5ec1aacd8582c895428568b10a376",
197
233
  "src/LawSpec/Core/PayloadPlan.hs": "f2a7d2dc58c6a0f79707bdc24773bd3aad3a3b8eea2735a8284b2a9f3a4af4a8",
198
234
  "src/LawSpec/Core/Policy.hs": "c0fdb7babe904bafa0fe97c2089f63ae393c3e8845a6d3110e12d8531e0656f0",
235
+ "src/LawSpec/Core/Program.hs": "36a4ed09b61e8fa2b8e69556105f7276a20e8384868cdd26e11714020c6e930c",
199
236
  "src/LawSpec/Core/RefinementProof.hs": "c19fc03e68488357a59897ec38ce3d2efd320c35b405b632af17425d6a18447a",
200
237
  "src/LawSpec/Core/Schema.hs": "ce06bd96b63d11f80be518e626b33526668ae1e2f3f7fc626bb1048e296efc21",
201
238
  "src/LawSpec/Core/Semantics.hs": "cdb8256e523f7808fa50fe7d80d709217a28de4c81c5ff5be8382f94900f3779",
202
239
  "src/LawSpec/Core/Stages.hs": "b88b974e3510ca797bd4ad8a22c47d63cce28245fc4775999d666e8f2d8dac56",
203
240
  "src/LawSpec/Core/Total.hs": "d706a145c3663b6bd3f0ecf390fee1fe4847564ec4f9ce70fa7583ead04a933a",
204
241
  "src/LawSpec/Core/Totality.hs": "a9460bc11a91be583274bf4e87bbc85630a544736c4d532a61cf9038f1a3d42d",
205
- "src/LawSpec/Core/Types.hs": "04d9c093fcc0d84e2864c8a3b69d5fe318a92c60b32844048198f1b12fe1b6fb",
242
+ "src/LawSpec/Core/Types.hs": "a684e003ed64924cb54717f0e4b166fea62a2ac0fe5c9f8851a865f4dcb9858e",
206
243
  "src/LawSpec/Core/Validate.hs": "74c2a51eb913f8414268064f22d2d5d97ebfb0e4797e146b229076c29ac38726",
207
244
  "src/LawSpec/Core/Value.hs": "52fedabbc07c8c65acc5be1efc7b4860bee47b58931ef76d26fcbfc8a280bf41",
208
- "src/LawSpec/CoreEmit.hs": "6af51e63da17000b0bab20e0cc9a74dab93d02209c14e564bda024262e5887e4",
209
- "src/LawSpec/CoreNativeScalarEmit.hs": "7c35c0405717f6cbf9dd0cbecb430678fda9fa95cd6c1363cceade2f1d6ea682",
210
- "src/LawSpec/CorePersist.hs": "f18f6ae69ff8caa3f5d166f5b64f06716bc4755a7b825a370e233ba90f4b5bb5",
211
- "src/LawSpec/CoreScalarEmit.hs": "7852454ec42777a5ad1246ba179aa8591f3145a45b8d3cbfb4c4b087a7601243",
212
- "src/LawSpec/Data.hs": "f659f4e86f1009c4806334a45686970dde2efa2641585f997a7beba01d0e6f2d",
245
+ "src/LawSpec/CoreEmit.hs": "ed22e992e34a5328e6eb5794af81942e2b66f60b23632f15e0e261d35157e107",
246
+ "src/LawSpec/CoreNativeScalarEmit.hs": "5182e898f247376d4846336e0aecd22685dd2f6d9a41897afb67b0b4e732b82e",
247
+ "src/LawSpec/CorePersist.hs": "d28fd82240b9926201cf3befe45e2190c57bbed899e3f7d861220aa9580ddaa5",
248
+ "src/LawSpec/CoreScalarEmit.hs": "163669ab934a1736976437394f3f4528ca7ae85dc14facebef6ec2fa576b92f0",
249
+ "src/LawSpec/Data.hs": "99fe2a88d2206909c1ee63d05d224111449a5a8c15727cada961ec498a8425db",
213
250
  "src/LawSpec/DataNames.hs": "2eeb0d215131981a2271725a50c21dce44c7146a167025eb239a83922fdecaf6",
214
251
  "src/LawSpec/DefinitionTotality.hs": "af3aa9f7495344ea34c90cf87664f3ec2d9f95474ef273905fc6c9b17edd5d80",
215
252
  "src/LawSpec/Dependencies.hs": "b748d2231f543a878e2ff3816f8a027285c610555821856383e8d1853e4c7151",
216
253
  "src/LawSpec/Digest.hs": "ba8128e36856d5fb0d2345779fd949b11042af688a0d8cee63e5ae8818cef7ca",
217
- "src/LawSpec/Discharge.hs": "26b74132dfb0545dd48baf35c75aba261be109edea0693e2c9ff580750483f88",
254
+ "src/LawSpec/Discharge.hs": "5369d37d511f5d7422bb03dab4b128430b1a3a3d561814fe7904729e02501afa",
218
255
  "src/LawSpec/Domain.hs": "222d15f0012ae630802238a6d7e1ee78d1e718b599f5ebb5a1ddc4e8d29d68c3",
219
256
  "src/LawSpec/DomainModel.hs": "b2ac0eb9b63fae2860d9f53e6770d8fdf053d9df33773071b31de53cdf4e1562",
220
- "src/LawSpec/Elaboration.hs": "b6c92cd113c61724b51baf73f94ae9507ff9be8661d0ec16215b8f3399f10f5f",
257
+ "src/LawSpec/Elaboration.hs": "b69b739a61fb431432424fc31815462c8e64737df66e8a59610f15bd9c98a30c",
221
258
  "src/LawSpec/Emit.hs": "9f34f5765915a2a12a66a6dca647ddaef9289372956802c6d99cf0cfec447c7a",
222
259
  "src/LawSpec/Eval.hs": "b87a786ed7a512c60e00a037a1a36738933518aafa255babaa8b1b42dbb8ff6d",
223
260
  "src/LawSpec/Flow.hs": "830b9d59b94f26a05687bd5baed06b4ecbf1f47c6a634766810d3dd2a44647cd",
224
261
  "src/LawSpec/Frontend.hs": "85d631cb6246efcb14814177d1620ffd5f67964de725a8af241a11f1f30f5da3",
225
- "src/LawSpec/GoData.hs": "5db907554f6d3d4bbb7e0617214be0260434ac8fb02d49e677325c4154bfee04",
226
- "src/LawSpec/GoDefinitions.hs": "602977adc5d3bc9c6076bcc98c2e8955eba56ec4b8891534b01f49b7d7bb3206",
262
+ "src/LawSpec/GoData.hs": "7532c2fbcce57a75013874e383225ad42b2a7d39b7f3420d56076d733e3d95cf",
263
+ "src/LawSpec/GoDefinitions.hs": "13ff50b7fec465b0750b57a09081e5cd7949e49105fa74da76836b3fcd014ae8",
227
264
  "src/LawSpec/GoExpr.hs": "67ef004e97074976e0fd137dfef8d417efe8de3f7d5c3c08293874d30d89e9d0",
228
- "src/LawSpec/GoNativeBinding.hs": "1ad8ea4cec6187c7e6005651c0edeec69e196eb329fb958c833da7751225aa1b",
229
- "src/LawSpec/GoProperties.hs": "3c9f73b42c1e13f86cc0592998090dd5619d55b56d190a05ca1de5d661e87ffa",
230
- "src/LawSpec/GoTestHelpers.hs": "dee55ee8505370e932773b8c685f4a1f380129e6f43f8806bf1e82efb99451b1",
265
+ "src/LawSpec/GoNativeBinding.hs": "14825118889abfa737abed9c22c1e5a5e29b9f7433a35ca80fcbe00f1fbe632d",
266
+ "src/LawSpec/GoProperties.hs": "ef0cc192eb49c928c96bd9842618c5d59ff0b6442ed4f14423e061a9cf848888",
267
+ "src/LawSpec/GoTestHelpers.hs": "76241cf037208f5caac5e905acf4e05acfc26917adc74f11f92aca60aa1c352e",
231
268
  "src/LawSpec/GoTypeRefs.hs": "7f239f5ac3ac8bd21c8f76c328049f7715d8562ee1382befa0a58abd4f15f726",
232
- "src/LawSpec/HaskellData.hs": "8ca1f1a353972a28b3d044c3763243cd8a2abf3e2cdb3b15b6112d8a7edf9da2",
233
- "src/LawSpec/HaskellDefinitions.hs": "fe989b62cb970bf4a3060a5793ff11ee5756cdec4c8c97de17f54181ef0112be",
269
+ "src/LawSpec/HaskellData.hs": "6366fad5cec25eeffee4ddcfe8a01672d2b1ac9c96144088ccf80061ef690fb1",
270
+ "src/LawSpec/HaskellDefinitions.hs": "9e99c5ef7110e286b92acd08efd8890340b9c2d242053568804648789907479b",
234
271
  "src/LawSpec/HaskellExpr.hs": "f7ef064ac6700c027de4bd71bddeb3236853232cf7a39bed61de16153539b401",
235
- "src/LawSpec/HaskellNativeBinding.hs": "9f98aa0c8659b572bd6486a0e29c4692bc6432db8639fa74a09bbf1b771bbfa6",
236
- "src/LawSpec/HaskellProperties.hs": "9eac50a0c24398a71823c71c75a29cf2718ff53f63890bf764735078f39b2f8a",
237
- "src/LawSpec/HaskellTestHelpers.hs": "51e59b2abc9e85455e3c8e2c6baadb27e5d319081cb730d2ce56be5dc8053897",
272
+ "src/LawSpec/HaskellNativeBinding.hs": "6037c7874c186b4de68d4a7982d14a695fd21325e78e5ce3eebe19a2128b01d8",
273
+ "src/LawSpec/HaskellProperties.hs": "24f0fc966e3c1f59761010ea1860bb4fffc2fd4fe57f2e3159371b021881a2f1",
274
+ "src/LawSpec/HaskellTestHelpers.hs": "a0d3bef096b9a8bddfbb213e554e00535a3a7691c4ef95cb6c61a4eb6cea5098",
238
275
  "src/LawSpec/HaskellTypeRefs.hs": "2225b2a5e2ab3662e7202d23b24f4d6db48353b35ae28df8acd2b92fd2b97574",
239
276
  "src/LawSpec/Imports.hs": "0f81acb1e85d23b0c5745aa8530b0b979d739f201fc1d3d8f2d901c16c820b4a",
240
277
  "src/LawSpec/IndexTerm.hs": "1c694f279b934e7b853c0028158c2754048928deb45fb7d65abc1d98da382bcb",
241
278
  "src/LawSpec/Indexed.hs": "1e7ed53653cabc097f75dcf350c81facf9feb30af73f3e21f9344665fc316387",
242
279
  "src/LawSpec/Inference.hs": "40693bcf11935f812bac171e981476acd978a16d126855c9ddf385a8b1cc23c3",
243
- "src/LawSpec/JavaData.hs": "078594c2a233824ff1d1a9c3fbc246e9d77ce4cc724ef1f72ad3aace68be5a93",
244
- "src/LawSpec/JavaDefinitions.hs": "5247258db6ddb7075e5d05c6bb830aad6e0d9d3314082d164b1b2f5506337476",
280
+ "src/LawSpec/JavaData.hs": "6173a61ffd95e1f671a0df1f85c056a1f785f6fa66c4d55d09d2420400cfcb94",
281
+ "src/LawSpec/JavaDefinitions.hs": "587b82efbe07823defdd2143469b4632bd86b21f0d9644a4929cf58d1d0a2342",
245
282
  "src/LawSpec/JavaExpr.hs": "fb1d3e64f3288e557720dead7738eb4f2a59d4563e5be4a742e1582829f19d3e",
246
- "src/LawSpec/JavaNativeBinding.hs": "9eb52b3be19badda078069bb3d6813d72cad4f0a9bfa708f7404e44201d3c352",
247
- "src/LawSpec/JavaProperties.hs": "16b334f98eec4c029e630ce31fe7635f6d8d73bfcfb13707e0d348b2cbf23f95",
248
- "src/LawSpec/JavaTestHelpers.hs": "e6f4b9bbb7e5f07ece6ab1845e12aa661e62e8b926680b11454223fc3ec1523d",
249
- "src/LawSpec/KotlinData.hs": "2cd47e1746fb840cc9dc62e02961bbb3a10b982b1b46f89be6816b45282476a3",
283
+ "src/LawSpec/JavaNativeBinding.hs": "2c2bb31c121f54ba1b43b201163398ac562a3b99e7b9190ecab1c43ac1a2abd0",
284
+ "src/LawSpec/JavaProperties.hs": "b57a30301ac295dfbd6d4d7ff0d94f2c788fc892c184fb7661b338aad6d89f7e",
285
+ "src/LawSpec/JavaTestHelpers.hs": "3eab1c7f55ddbf34c4ab53e4718d347f5fd9df22900dc4d34808b31590f4cac4",
286
+ "src/LawSpec/KotlinData.hs": "ccbef310915bd4c998bb9566c0e741be1275109ea536947a9844794eaeecaba0",
250
287
  "src/LawSpec/KotlinDefinitions.hs": "4d49a62a1f8ea31a31dc79a6f4aba318f2f71552c495a67499f3cec6dc17fa60",
251
288
  "src/LawSpec/KotlinExpr.hs": "20312f0774f1d0832a21a19b93c8103e2791ecd32a827d8e9c4f2b4830a996a0",
252
- "src/LawSpec/KotlinNativeBinding.hs": "1aec7854758f07a4d2288de13931fbb88ef32220f85d3c84fe8233ad67b6d095",
253
- "src/LawSpec/KotlinProperties.hs": "59ac7374bb2184cb41458ce2d8d5170adc67d913ac87a18c4c69174ee9d941a7",
254
- "src/LawSpec/KotlinTestHelpers.hs": "74810d65faafc6ed4d64b1fb0596cda4186e586b7144a7441641b798795bc324",
289
+ "src/LawSpec/KotlinNativeBinding.hs": "12a4f40de319b87a6f5a2e48ea2616010d620d00e2e3b67de063947e958f7da8",
290
+ "src/LawSpec/KotlinProperties.hs": "51b62307275e635f9d064b370df40e5bda6ec9251d78716e1b27110d8d1951f9",
291
+ "src/LawSpec/KotlinTestHelpers.hs": "6fc4fb258899f358156f1ad04a7709c2a2807f9dab54c1fc983cce9305ef6957",
292
+ "src/LawSpec/MachineSpec.hs": "3f687e2d0a60f9c5527f506661ec4e291d53fb061abbe10ced5db000ba52b7bb",
293
+ "src/LawSpec/Mailboxes.hs": "52945ebd898f203ec133882c9fc1a60d9e1ce28abc32cb16f97b6b38daed41f3",
255
294
  "src/LawSpec/Memo.hs": "1230a08b003cc6eee0db951b55a93f9ec573e5b6752c63d65d6c3487927b0b4e",
256
- "src/LawSpec/Model.hs": "6b3e70ba85a1613c969567a7a6d5ad75126e3df6cbc51a80eb964424f1bff4d6",
257
- "src/LawSpec/NativeBinding.hs": "33959b0fd432ad4150f3b685f6438e284b801c2a59d9ef3132486a1cc7c8925a",
258
- "src/LawSpec/NativeRequest.hs": "f8200c36725859ea32374655951f7a45e2b3342b159f9f6c88b5f9a2a6331897",
295
+ "src/LawSpec/Model.hs": "c645aad0f37f175a099865f467864391cc0cb8e76e4f6b3e1297d7ac6c31260d",
296
+ "src/LawSpec/ModelTests.hs": "a5905c0c4a493129c19cc135fb606dacd12fc72d495df471d63e7d3cacdfe925",
297
+ "src/LawSpec/NativeBinding.hs": "a2fae69f02eaa21b61c61496587f46508cab142b07434ad952cb4c154d9e0d04",
298
+ "src/LawSpec/NativeRequest.hs": "978834c3697866ee428ec4667243384de48b91c850357b683faca8a635a978ab",
259
299
  "src/LawSpec/Packages.hs": "161fc68a9959a80762ca4ece405240351e3180ea4dbb2bf148eaca6562fb7c30",
260
- "src/LawSpec/Parser.hs": "a2b7b241a60395b067690d74dc7385bb9365f10eda08ebb7d4372953b596b624",
261
- "src/LawSpec/Persist.hs": "d7f63a1205782c2ac0d71b737ade3ef90041403f3876b0f3a38c2b29d60922f2",
262
- "src/LawSpec/PortableGenerator.hs": "69d457e39f539c77fc7a4c08205e75352bbecd9dfdff031a283a39bf44b22d49",
300
+ "src/LawSpec/Parser.hs": "a687fb2d2a12d37a7fad97eb92375c7b425fa823cd85133e2f660f78a62da2c3",
301
+ "src/LawSpec/Persist.hs": "f29c228ba12605f9ddd393f2535a306e4ff41aa38a2e256840ef547be54dacbe",
302
+ "src/LawSpec/PortableGenerator.hs": "7dcf856ea56f57103da6cdfc39b63724ac6be2c2912acb791999c8a952679264",
263
303
  "src/LawSpec/PortableTestHelpers.hs": "8d98184c92a34b431f2a820cef3ea735b0cec3a52504f519b3bb06cb5174017c",
264
304
  "src/LawSpec/Prelude.hs": "515698dda42a8b950c8529b14b5f9d6fe25e590eb1a7a2593ccbcb2edf87ea57",
265
305
  "src/LawSpec/Public.hs": "7010357e250607a9f94d1ab8dc34fad4014fb7d9f15ba0d7c2fc94d0f48fcac4",
266
- "src/LawSpec/PythonData.hs": "09fc455151c0c527c53032512515482a970ecf45a1d529581622c47732c4bbb8",
267
- "src/LawSpec/PythonDefinitions.hs": "72e0ae7154d3d2c4350975477802495061fe8a2bb0dc420a54c2d6cc75c4d1a3",
306
+ "src/LawSpec/PythonData.hs": "ca8fe8b2410c83fb0e49a5f95a538d3601172cc6ed1ca6fdb2245c71df36acf6",
307
+ "src/LawSpec/PythonDefinitions.hs": "90bd885196387cc9fdb61b6623b08afd2bbd3a052a8b4fa7c18a22a9db2472b9",
268
308
  "src/LawSpec/PythonExpr.hs": "23d7d24b5fb4efff9cb63d38c02a93d95744ec79b4565daf1412088fc7c4ba59",
269
- "src/LawSpec/PythonNativeBinding.hs": "4e35ff8781062d0f614e45ea45f98038c8d609ab78bd671cb0a239eaa9db1690",
270
- "src/LawSpec/PythonTypes.hs": "bee4b5a5b00ad6ed358cdbcb6de02cd8be9be27e34c1c3ebe3256681aeb1e219",
271
- "src/LawSpec/Railway.hs": "cada409ef5703cc5626b0ba36ba85f1fcfa6380c4baa9d4942342ea5c20be963",
272
- "src/LawSpec/Refinement.hs": "3bbdc090f9ebce60d99254dbe93dec6e11bd838df8537df828fd9c768c79d126",
309
+ "src/LawSpec/PythonNativeBinding.hs": "106e2052d4023ae59628de310e26a6802de988a7732ff73a81d3df06fbe7b75a",
310
+ "src/LawSpec/PythonTypes.hs": "7193a0b8dad1661bb48189351e3dacdd938bf1ec40e3b716e2f7fb571bc6eb3a",
311
+ "src/LawSpec/Railway.hs": "7b13256dc9601e921096e0a957da66baa47ae9be7153c194a3ed805473c15f61",
312
+ "src/LawSpec/Refinement.hs": "f73b9d57a89a52934e0ae664c02984041faed09e8d478cb6416aafd25b5a2d94",
313
+ "src/LawSpec/Remote.hs": "3142e9dab22afb807f91bf528efd347d1271085bb85fc66c0505f3270bbc05ab",
273
314
  "src/LawSpec/Resilience.hs": "97b4a498ee74b608120ca578c7b9c708d2025b77db23d83e5c4ad80d5ff8a465",
274
- "src/LawSpec/RuntimeSources.hs": "08ed920c4db1ac1abfe5ecb2af84b598b229632c634747b9177f39a594231d03",
275
- "src/LawSpec/RustData.hs": "2c3ccc04a48c385bcc29f2dd8c7f0b88be898caaa461a8fd9910f2c35d560228",
315
+ "src/LawSpec/RuntimeSources.hs": "b56aa873658c36acf202fdd75fae885a93bd67981c6ee68741b28cf4efb3905a",
316
+ "src/LawSpec/RustData.hs": "d4ac7ae37ebe55c3ca9c587c09895fa4ef0156a989412bf6f5f8bd56749fb4e7",
276
317
  "src/LawSpec/RustDefinitions.hs": "77c00183d9af6973ec77d387203a24ab3094dec9a7485e836b286fb90ea9733a",
277
- "src/LawSpec/RustEmit.hs": "eb2bbc30150de2420473c0ace696c914a8eb9067b2e220d2872951030069e937",
318
+ "src/LawSpec/RustEmit.hs": "4a786ffbd99cefcd3fd5c4f9e395132871c6a88a4c1bd8a40adce2e5d72d7d1d",
278
319
  "src/LawSpec/RustExpr.hs": "04b2ef81417b811c7b98a98acdadab4e588ca8757964a63ba8dc5936c36479e6",
279
- "src/LawSpec/RustNativeBinding.hs": "d50d1fb10591ee86129ae49b38a343148c084479e450eef3b320e1efdd55245d",
320
+ "src/LawSpec/RustNativeBinding.hs": "c7f098efece9ac5d7328c813c9afe31725d4a65e6745931f3cad20d27b9a235c",
280
321
  "src/LawSpec/RustNativeGenerators.hs": "a3b1484d9ff0008e4f961aa81d0aa51da57ec0cd7909124e80c98d56aacc8ce9",
281
- "src/LawSpec/Scaffold.hs": "b4b02a2b565fd5bf3d056c68a24979339b6d4bd0a4182c0dc7b5faf79b8ec273",
322
+ "src/LawSpec/Scaffold.hs": "bc68ab7e19f12aa4da850e79219a4d601d884a160ba143d15892a7792f8fc02b",
282
323
  "src/LawSpec/Scalar.hs": "8ff178cbce4aa514f4b770e65efd471461cc12812e854d95f48b0dd54f0cc637",
324
+ "src/LawSpec/Scenario.hs": "143cf61314cc5e7e593512fbf27cb64ada62af6bdf05dfc5b3be6f8acf7c3f06",
325
+ "src/LawSpec/Sessions.hs": "741f5a8bffdaabf47d016d0069e7041dbb20e99313258ff923479aa1f0991b31",
326
+ "src/LawSpec/Sessions/Go.hs": "6a2bea954730e340eeea8469edfef7ece624fea358b453221c6f6837196e6c08",
327
+ "src/LawSpec/Sessions/Haskell.hs": "2b39ec5a99e5438504dd7d43d3a4debfba2a81b4d0ca015a378bd57eaab3e769",
328
+ "src/LawSpec/Sessions/Jvm.hs": "b1fc004fe558840caf1699de497459880d980f8651d928e336f925d84cc75cde",
329
+ "src/LawSpec/Sessions/Python.hs": "1f98eb9b3e51176247cb6bb9157ffa30daa64f21266aeb53e9dfd15756a6f186",
330
+ "src/LawSpec/Sessions/Rust.hs": "9ad3a48e5dd074ab8d4828ec3402556cdb2d32193139fa18d909ab431e58530d",
331
+ "src/LawSpec/Sessions/Web.hs": "9020ed23bdd4232ea51c4d5952e277c7480924408a10c251d1af5e2a4a3cb4d4",
283
332
  "src/LawSpec/SpecializeDefinitions.hs": "2bdd6d9b191941d869ef524659e02fed551499aaa2ea98c99323da03af113012",
333
+ "src/LawSpec/StatefulModel.hs": "ab2d5eb1c0443f6b527f8f2696a4d0b9ae14f0df91b8cef202c4f0c850e2115b",
284
334
  "src/LawSpec/TargetNames.hs": "06410a1973d12bc241bfc399c8f5856d1692c6af792bb83b187bca894cfde4ca",
285
335
  "src/LawSpec/TestManifest.hs": "3c2018eea1528d047dff4c5fd2f353ee1ceb339cce7b1c32f0a2390df2d40ac8",
286
336
  "src/LawSpec/Testing.hs": "3bb83c3e74de6f0a09b12736115e47b4db2244e2f749d640e063cfc0500f174c",
287
337
  "src/LawSpec/Time.hs": "9b05a784879a5791087492129bb9bd432d5e23082aa370e2a289552731bfb527",
288
- "src/LawSpec/WebData.hs": "bbcd7d734ce3941d83cc455a9a2147b642f6111ebb34db9ef99dcb7a58b8c4ae",
289
- "src/LawSpec/WebDefinitions.hs": "896c7b7b3bf69f331fba98d1ee9f9b1bf30af349fc93dfdb490081760106f2fb",
338
+ "src/LawSpec/WebData.hs": "a8e907ce04768ec8bf6f88f96d4d0e3e1888451335350d210cf051160daf4e51",
339
+ "src/LawSpec/WebDefinitions.hs": "b20086e4d9090c5fdd7eecd1dbc489de3e60fddae8a12c0fd83902892eff2c0d",
290
340
  "src/LawSpec/WebExpr.hs": "5bf5a2082f216646541bfa482f0f4eb492e32da9ab965e1e789256564d64332f",
291
- "src/LawSpec/WebNativeBinding.hs": "f536c1b1454bc83f5a9e8c61a608390b9a6fa91537f34d3c245b90ee6e275b7d",
292
- "src/LawSpec/WebTypes.hs": "1d43194e4dafbdcbed6e607414a875e9030028f03579f17d189c14a6a9bd5e53",
341
+ "src/LawSpec/WebNativeBinding.hs": "1039b25ffe7ad1c033baf7d040de0f667ddc521fc771bdf1ca056e63c842680d",
342
+ "src/LawSpec/WebTypes.hs": "60237d8b119e3a18690aa5429e99c8613e0ddae4da76d697de7af8b31aeb1ab0",
293
343
  "src/LawSpec/Witness.hs": "9ae944c9307df964bc853205269c1e4cb69cc076070bb878fc957f4bdb02de85",
294
344
  "stack.yaml": "20ccf4d599e355e60b7aa4f814a7cd4299fe2048616cc2e6dbdc22a7bd8cec73",
295
345
  "stack.yaml.lock": "ae222b9c81af920c56e50fa4596fa57786e7fa5a7b461390362b2b2ff63818c7",
296
346
  "wasm/app/Exports.hs": "4ecbdac8faa2449e6fc61b93c82e6278fa14374154f29b4dacf0eef433f06a47",
297
347
  "wasm/cabal.project": "021e560afdc5eb4cb7169e7119ecb8f92c9ee170245af909c94b612941bff5cc",
298
348
  "wasm/cabal.project.freeze": "733dbed3d2ecccb26e874fd58f136296dad772184deb1658c196b5d54a0814dc",
299
- "wasm/lawspec-wasm.cabal": "36699a4aca6e7ad1c8ab81160ee5f8238e826fd977db5ca6e10b6c806786cbcb",
300
- "npm/core.wasm": "7409a9cdb0da8e65445f2451c115248798f972853a81132848a63253a246341e",
349
+ "wasm/lawspec-wasm.cabal": "efb684af5b2f141714ce02867c7a347332fd6296bdb94d5de97d4d2b32ab631e",
350
+ "npm/core.wasm": "be25d0010892423a515995e68aabc622b0b09974c7e37b5bde0f192157166f00",
301
351
  "npm/core_jsffi.js": "88d136efe92f7cff5758c8fec8d9b6bbc9707fe37741cebeeb415fe34ce3d72b",
302
352
  "npm/api.mjs": "19e1624f91258c1397f3212faf65b407c62671b0fc5b118520e6a91f7ad7c6ba",
303
- "npm/index.d.ts": "b6beef671c22633fdf369f584bfe9bc9bd0b281c54df06f1946970415e1e7793"
353
+ "npm/index.d.ts": "58ebf96832216d675857bfcc0905e7395172078b726b3da9165e2b96214f35bb"
304
354
  }
305
355
  }
package/core.wasm CHANGED
Binary file
package/doctor.mjs CHANGED
@@ -241,6 +241,11 @@ export async function doctor(target, root, plannedArtifacts = []) {
241
241
  "hspec-discover",
242
242
  ])
243
243
  requireThat(versions[dep], `Stack test plan is missing ${dep}`);
244
+ // Nodes reach each other over TCP and HTTP with the network package.
245
+ requireThat(
246
+ versions.network,
247
+ "Stack plan is missing network (a library dependency, for distribution)",
248
+ );
244
249
  requireThat(
245
250
  /^2\.11\./.test(versions.hspec) &&
246
251
  /^1\./.test(versions.hedgehog) &&
@@ -0,0 +1,100 @@
1
+ unit example.actors
2
+
3
+ -- An actor owns a state and handles one message at a time, in the order
4
+ -- they arrive. Its handlers are plain functions from the state (and the
5
+ -- message's arguments) to a reply and the next state; LawSpec runs them
6
+ -- inside an actor and checks every reply against the model, in sequence and
7
+ -- from several callers at once. Runs also crash the actor between
8
+ -- messages: it restarts from its last state by reopen, and the model's state
9
+ -- follows modelReopen.
10
+ type Account is Account balance :: Int64 end
11
+
12
+ openAccount :: Unit -> Account
13
+ deposit :: Account -> UInt8 -> Pair Int64 Account
14
+ withdrawAll :: Account -> Pair Int64 Account
15
+ balance :: Account -> Pair Int64 Account
16
+ close :: Account -> Account
17
+ -- After a crash, the account reopens with the balance it had.
18
+ reopen :: Account -> Account
19
+
20
+ definition modelDeposit (amount :: UInt8) (n :: Int64 where n >= 0 && n <= 1000000) :: Pair Int64 Int64 is
21
+ Pair (n + amount) (n + amount)
22
+ end
23
+
24
+ definition modelWithdrawAll (n :: Int64) :: Pair Int64 Int64 is Pair n 0 end
25
+
26
+ definition modelBalance (n :: Int64) :: Pair Int64 Int64 is Pair n n end
27
+ definition modelClose (n :: Int64) :: Int64 is 0 end
28
+ definition modelReopen (n :: Int64) :: Int64 is n end
29
+ definition solvent (n :: Int64) :: Bool is n >= 0 end
30
+
31
+ actor account :: Account by Int64 is
32
+ start openAccount by 0
33
+ restart from reopen by modelReopen
34
+ on deposit by modelDeposit
35
+ on withdrawAll by modelWithdrawAll
36
+ on balance by modelBalance
37
+ on close by modelClose
38
+ invariant solvent
39
+ end
40
+
41
+ -- Implementation code uses the generated typed actor: depositTwice starts an
42
+ -- account and deposits from two callers at once.
43
+ depositTwice :: UInt8 -> Int64
44
+
45
+ law `two callers' deposits both land` is
46
+ definition is `for all` (x :: UInt8) . depositTwice x = 2 * x end
47
+ end
48
+
49
+ -- A supervisor starts its actors and restarts them after a crash: one for
50
+ -- one restarts only the actor that crashed. The account restarts from its
51
+ -- last balance (restart from reopen).
52
+ supervisor bank is
53
+ one for one
54
+ at most 3 restarts in 5s
55
+ permanent account
56
+ end
57
+
58
+ -- survivesCrash starts the bank, deposits, crashes the account, and reads
59
+ -- its balance through the same handle.
60
+ survivesCrash :: UInt8 -> Int64
61
+
62
+ law `a crashed account keeps its balance` is
63
+ definition is `for all` (x :: UInt8) . survivesCrash x = x end
64
+ end
65
+
66
+ -- A scenario runs the actor's messages from processes that talk over
67
+ -- channels. Some runs crash one process at a random point: a receive from a
68
+ -- process that failed runs its or else instead of waiting forever.
69
+ protocol Receipt is
70
+ send Int64
71
+ end
72
+
73
+ scenario `a deposit's receipt, or the balance if the teller fails` in account is
74
+ channel receipt :: Receipt
75
+ par
76
+ n <- deposit 5
77
+ send receipt n
78
+ with
79
+ receive receipt m or else
80
+ balance
81
+ end
82
+ expect m = 5
83
+ end
84
+ end
85
+
86
+ -- A mailbox has many senders and one receiver: two tellers report their
87
+ -- deposits to one auditor, who receives both reports.
88
+ scenario `two tellers report to one auditor` in account is
89
+ mailbox reports of Int64
90
+ par
91
+ n <- deposit 3
92
+ send reports n
93
+ with
94
+ m <- deposit 4
95
+ send reports m
96
+ with
97
+ receive reports first
98
+ receive reports second
99
+ end
100
+ end
@@ -0,0 +1,48 @@
1
+ unit example.concurrent
2
+
3
+ -- Concurrent collections checked against the built-in ones they behave
4
+ -- like. Each adapter uses its target's own concurrent structures; LawSpec
5
+ -- runs the commands in sequence and at the same time, and every history
6
+ -- must be linearizable. Sets and maps are checked key by key.
7
+
8
+ type WorkQueue is WorkQueue id :: Int32 end
9
+
10
+ newQueue :: Unit -> WorkQueue
11
+ async offer :: WorkQueue -> Int32 -> Unit
12
+ async poll :: WorkQueue -> Maybe Int32
13
+ async queueSize :: WorkQueue -> Int64
14
+
15
+ model queue :: shared WorkQueue behaves like Queue Int32 is
16
+ start newQueue
17
+ offer as offer
18
+ poll as poll
19
+ queueSize as size
20
+ end
21
+
22
+ type Tags is Tags id :: Int32 end
23
+
24
+ newTags :: Unit -> Tags
25
+ async tag :: Tags -> Int32 -> Bool
26
+ async untag :: Tags -> Int32 -> Bool
27
+ async tagged :: Tags -> Int32 -> Bool
28
+
29
+ model tags :: shared Tags behaves like Set Int32 is
30
+ start newTags
31
+ tag as add
32
+ untag as remove
33
+ tagged as contains
34
+ end
35
+
36
+ type Cache is Cache id :: Int32 end
37
+
38
+ newCache :: Unit -> Cache
39
+ async store :: Cache -> Int8 -> Int64 -> Maybe Int64
40
+ async fetch :: Cache -> Int8 -> Maybe Int64
41
+ async evict :: Cache -> Int8 -> Maybe Int64
42
+
43
+ model cache :: shared Cache behaves like KeyVal Int8 Int64 is
44
+ start newCache
45
+ store as put
46
+ fetch as get
47
+ evict as remove
48
+ end
@@ -0,0 +1,21 @@
1
+ unit example.consistency
2
+
3
+ -- Weaker consistency for replicated state. A page-view counter keeps one
4
+ -- replica per caller: a hit counts on the caller's replica and returns what
5
+ -- that replica has seen, so callers see stale totals, and the total is the
6
+ -- sum of the replicas. Its histories are not linearizable, but once every
7
+ -- hit is done the total must count them all: it is eventually consistent.
8
+ type Views is Views id :: Int32 end
9
+
10
+ newViews :: Unit -> Views
11
+ hit :: Views -> Int64
12
+ total :: Views -> Int64
13
+
14
+ definition modelHit (n :: Int64 where n >= 0 && n <= 1000000) :: Pair Int64 Int64 is Pair (n + 1) (n + 1) end
15
+
16
+ model views :: shared Views by Int64 is
17
+ consistency eventual
18
+ start newViews ~ 0
19
+ hit ~ modelHit
20
+ abstract total
21
+ end
@@ -0,0 +1,110 @@
1
+ unit example.distribution
2
+
3
+ -- Distribution. Nodes reach each other's actors, channels and checked
4
+ -- definitions over a transport: in memory (with faults, for testing), TCP or
5
+ -- HTTP. Values cross in the canonical wire encoding, the same bytes on every
6
+ -- target, so a node on one target can talk to a node on another.
7
+
8
+ -- The wire encoding's conformance vectors: values generated from a type
9
+ -- descriptor and a seed, then encoded, in hexadecimal.
10
+ encoded :: Text -> UInt64 -> Int32 -> Int32 -> List Text
11
+ roundTrips :: Text -> UInt64 -> Int32 -> Int32 -> Bool
12
+
13
+ law `integers on the wire` is
14
+ definition is
15
+ `for all` (seed :: UInt64) . prelude.length (encoded "(int Integer _ _)" seed 4 4) = 4
16
+ end
17
+ example `seed 7` is
18
+ seed = 7
19
+ expect encoded "(int Integer _ _)" seed 4 4 = ["9ddc4f", "eefb17", "8fc703", "8ee709"]
20
+ expect encoded "(int Int8 -128 127)" 42 4 5 = ["f901", "28", "00", "48", "5c"]
21
+ end
22
+ end
23
+
24
+ law `text, lists, Maybe and Either on the wire` is
25
+ definition is
26
+ `for all` (seed :: UInt64) . roundTrips "(list (maybe (either (int UInt8 0 255) (text))))" seed 4 8 = true
27
+ end
28
+ example `vectors` is
29
+ seed = 3
30
+ expect encoded "(text)" seed 4 3 = ["037b5b2c", "0134", "024d54"]
31
+ expect encoded "(list (maybe (bool)))" 5 3 3 = ["02000101", "0100", "010100"]
32
+ expect encoded "(either (int UInt8 0 255) (text))" 9 3 4 = ["00ec02", "0000", "00d201", "0100"]
33
+ end
34
+ end
35
+
36
+ law `data types on the wire` is
37
+ definition is
38
+ `for all` (seed :: UInt64) . roundTrips "(data Shape (ctor Shape::Circle (int Int32 0 100)) (ctor Shape::Box (int Int32 0 100) (int Int32 0 100)) (ctor Shape::Group (list (ref Shape))))" seed 4 8 = true
39
+ end
40
+ example `vectors` is
41
+ seed = 11
42
+ expect encoded "(data Shape (ctor Shape::Circle (int Int32 0 100)) (ctor Shape::Box (int Int32 0 100) (int Int32 0 100)) (ctor Shape::Group (list (ref Shape))))" seed 3 3 = ["0030", "020201b80100015ac801", "014808"]
43
+ end
44
+ end
45
+
46
+ -- A checked definition that another node evaluates by its content hash.
47
+ definition shifted (x :: Int32) :: Int64 is x + 1000 end
48
+
49
+ -- Calls that cross a network wait for it, so they are asynchronous.
50
+ async remoteShifted :: Int32 -> Int64
51
+
52
+ law `a definition evaluated on another node` is
53
+ definition is `for all` (x :: Int32) . remoteShifted x = shifted x end
54
+ end
55
+
56
+ -- An actor served on one node and called from another.
57
+ type Tally is Tally count :: Int64 end
58
+
59
+ openTally :: Unit -> Tally
60
+ add :: Tally -> UInt8 -> Pair Int64 Tally
61
+
62
+ definition modelAdd (n :: UInt8) (total :: Int64 where total >= 0 && total <= 1000000) :: Pair Int64 Int64 is
63
+ Pair (total + n) (total + n)
64
+ end
65
+
66
+ actor tally :: Tally by Int64 is
67
+ start openTally by 0
68
+ on add by modelAdd
69
+ end
70
+
71
+ async remoteAdds :: UInt8 -> Int64
72
+
73
+ law `two calls from another node` is
74
+ definition is `for all` (x :: UInt8) . remoteAdds x = 2 * x end
75
+ end
76
+
77
+ -- A protocol between two nodes: the first end sends a number and receives
78
+ -- its double.
79
+ protocol Doubling is
80
+ send Int32
81
+ receive Int64
82
+ end
83
+
84
+ async remoteDoubling :: Int32 -> Int64
85
+
86
+ law `a conversation between nodes` is
87
+ definition is `for all` (x :: Int32) . remoteDoubling x = 2 * x end
88
+ end
89
+
90
+ -- A mailbox offered on one node and sent to from another: each send waits
91
+ -- until the mailbox has the message.
92
+ mailbox ledger of Int64
93
+
94
+ async remoteLedger :: Int32 -> Int64
95
+
96
+ law `messages reach a mailbox on another node` is
97
+ definition is `for all` (x :: Int32) . remoteLedger x = 2 * x end
98
+ end
99
+
100
+ -- A channel end sent to another node: the node that sends it relays the
101
+ -- conversation, so the end works on its new node as it did on the old one.
102
+ protocol Handoff is
103
+ send Doubling
104
+ end
105
+
106
+ async remoteHandoff :: Int32 -> Int64
107
+
108
+ law `a channel end handed to another node` is
109
+ definition is `for all` (x :: Int32) . remoteHandoff x = 2 * x end
110
+ end
@@ -0,0 +1,142 @@
1
+ unit example.generation
2
+
3
+ -- Conformance of every target's portable generator with the same vectors:
4
+ -- the values generated from a type descriptor and a SplitMix64 seed, and the
5
+ -- shrink candidates of the first, rendered canonically.
6
+
7
+ generated :: Text -> UInt64 -> Int32 -> Int32 -> List Text
8
+ shrunk :: Text -> UInt64 -> Int32 -> List Text
9
+
10
+ law `int8` is
11
+ definition is
12
+ `for all` (seed :: UInt64) . prelude.length (generated "(int Int8 -128 127)" seed 4 5) = 5
13
+ end
14
+ example `seed 42` is
15
+ seed = 42
16
+ expect generated "(int Int8 -128 127)" seed 4 5 = ["-125", "20", "0", "36", "46"]
17
+ expect shrunk "(int Int8 -128 127)" seed 4 = ["0", "-63", "-124"]
18
+ end
19
+ end
20
+
21
+ law `unbounded integers` is
22
+ definition is
23
+ `for all` (seed :: UInt64) . prelude.length (generated "(int Integer _ _)" seed 4 4) = 4
24
+ end
25
+ example `seed 7` is
26
+ seed = 7
27
+ expect generated "(int Integer _ _)" seed 4 4 = ["-653071", "196343", "-29128", "80327"]
28
+ expect shrunk "(int Integer _ _)" seed 4 = ["0", "-326536", "-653070"]
29
+ end
30
+ end
31
+
32
+ law `a lower bound` is
33
+ definition is
34
+ `for all` (seed :: UInt64) . prelude.length (generated "(int Int32 5 _)" seed 4 4) = 4
35
+ end
36
+ example `seed 7` is
37
+ seed = 7
38
+ expect generated "(int Int32 5 _)" seed 4 4 = ["346934", "1196348", "970877", "1080332"]
39
+ expect shrunk "(int Int32 5 _)" seed 4 = ["5", "173470", "346933"]
40
+ end
41
+ end
42
+
43
+ law `the full UInt64 range` is
44
+ definition is
45
+ `for all` (seed :: UInt64) . prelude.length (generated "(int UInt64 0 18446744073709551615)" seed 4 3) = 3
46
+ end
47
+ example `seed 1` is
48
+ seed = 1
49
+ expect generated "(int UInt64 0 18446744073709551615)" seed 4 3 = ["13757245211066428519", "1", "0"]
50
+ expect shrunk "(int UInt64 0 18446744073709551615)" seed 4 = ["0", "6878622605533214260", "13757245211066428518"]
51
+ end
52
+ end
53
+
54
+ law `booleans` is
55
+ definition is
56
+ `for all` (seed :: UInt64) . prelude.length (generated "(bool)" seed 4 6) = 6
57
+ end
58
+ example `seed 3` is
59
+ seed = 3
60
+ expect generated "(bool)" seed 4 6 = ["true", "true", "true", "true", "false", "true"]
61
+ expect shrunk "(bool)" seed 4 = ["false"]
62
+ end
63
+ end
64
+
65
+ law `text` is
66
+ definition is
67
+ `for all` (seed :: UInt64) . prelude.length (generated "(text)" seed 6 3) = 3
68
+ end
69
+ example `seed 9` is
70
+ seed = 9
71
+ expect generated "(text)" seed 6 3 = ["\"I(\"", "\"\"", "\"4<*6F\""]
72
+ expect shrunk "(text)" seed 6 = ["\"\"", "\"I\"", "\"(\""]
73
+ end
74
+ end
75
+
76
+ law `unit` is
77
+ definition is
78
+ `for all` (seed :: UInt64) . prelude.length (generated "(unit)" seed 1 2) = 2
79
+ end
80
+ example `seed 1` is
81
+ seed = 1
82
+ expect generated "(unit)" seed 1 2 = ["()", "()"]
83
+ expect shrunk "(unit)" seed 1 = []
84
+ end
85
+ end
86
+
87
+ law `lists` is
88
+ definition is
89
+ `for all` (seed :: UInt64) . prelude.length (generated "(list (int Int32 0 _))" seed 4 3) = 3
90
+ end
91
+ example `seed 42` is
92
+ seed = 42
93
+ expect generated "(list (int Int32 0 _))" seed 4 3 = ["[0, 1745563, 275752]", "[1325093, 742426, 493279]", "[2000000]"]
94
+ expect shrunk "(list (int Int32 0 _))" seed 4 = ["[]", "[0]", "[1745563, 275752]", "[0, 275752]", "[0, 1745563]", "[0, 0, 275752]", "[0, 872782, 275752]", "[0, 1745562, 275752]", "[0, 1745563, 0]", "[0, 1745563, 137876]", "[0, 1745563, 275751]"]
95
+ end
96
+ end
97
+
98
+ law `maybe` is
99
+ definition is
100
+ `for all` (seed :: UInt64) . prelude.length (generated "(maybe (bool))" seed 4 4) = 4
101
+ end
102
+ example `seed 5` is
103
+ seed = 5
104
+ expect generated "(maybe (bool))" seed 4 4 = ["Just(false)", "Just(true)", "Just(false)", "Just(true)"]
105
+ expect shrunk "(maybe (bool))" seed 4 = ["Nothing"]
106
+ end
107
+ end
108
+
109
+ law `either` is
110
+ definition is
111
+ `for all` (seed :: UInt64) . prelude.length (generated "(either (text) (int Int8 -128 127))" seed 4 4) = 4
112
+ end
113
+ example `seed 11` is
114
+ seed = 11
115
+ expect generated "(either (text) (int Int8 -128 127))" seed 4 4 = ["Right(-19)", "Left(\"\\\"{U\")", "Left(\"j\")", "Right(1)"]
116
+ expect shrunk "(either (text) (int Int8 -128 127))" seed 4 = ["Right(0)", "Right(-10)", "Right(-18)"]
117
+ end
118
+ end
119
+
120
+ law `a recursive tree` is
121
+ definition is
122
+ `for all` (seed :: UInt64) . prelude.length (generated "(data Tree (ctor t::type::Tree::Leaf) (ctor t::type::Tree::Node (ref Tree) (int Int8 -128 127) (ref Tree))) (ref Tree)" seed 3 2) = 2
123
+ end
124
+ example `seed 13` is
125
+ seed = 13
126
+ expect generated "(data Tree (ctor t::type::Tree::Leaf) (ctor t::type::Tree::Node (ref Tree) (int Int8 -128 127) (ref Tree))) (ref Tree)" seed 3 2 = ["Node(Node(Leaf, -29, Leaf), -44, Node(Node(Leaf, -110, Leaf), 58, Leaf))", "Leaf"]
127
+ expect shrunk "(data Tree (ctor t::type::Tree::Leaf) (ctor t::type::Tree::Node (ref Tree) (int Int8 -128 127) (ref Tree))) (ref Tree)" seed 3 = ["Leaf", "Node(Leaf, -29, Leaf)", "Node(Node(Leaf, -110, Leaf), 58, Leaf)", "Node(Leaf, -44, Node(Node(Leaf, -110, Leaf), 58, Leaf))", "Node(Node(Leaf, 0, Leaf), -44, Node(Node(Leaf, -110, Leaf), 58, Leaf))", "Node(Node(Leaf, -15, Leaf), -44, Node(Node(Leaf, -110, Leaf), 58, Leaf))", "Node(Node(Leaf, -28, Leaf), -44, Node(Node(Leaf, -110, Leaf), 58, Leaf))", "Node(Node(Leaf, -29, Leaf), 0, Node(Node(Leaf, -110, Leaf), 58, Leaf))", "Node(Node(Leaf, -29, Leaf), -22, Node(Node(Leaf, -110, Leaf), 58, Leaf))", "Node(Node(Leaf, -29, Leaf), -43, Node(Node(Leaf, -110, Leaf), 58, Leaf))", "Node(Node(Leaf, -29, Leaf), -44, Leaf)", "Node(Node(Leaf, -29, Leaf), -44, Node(Leaf, -110, Leaf))", "Node(Node(Leaf, -29, Leaf), -44, Node(Leaf, 58, Leaf))", "Node(Node(Leaf, -29, Leaf), -44, Node(Node(Leaf, 0, Leaf), 58, Leaf))", "Node(Node(Leaf, -29, Leaf), -44, Node(Node(Leaf, -55, Leaf), 58, Leaf))", "Node(Node(Leaf, -29, Leaf), -44, Node(Node(Leaf, -109, Leaf), 58, Leaf))", "Node(Node(Leaf, -29, Leaf), -44, Node(Node(Leaf, -110, Leaf), 0, Leaf))", "Node(Node(Leaf, -29, Leaf), -44, Node(Node(Leaf, -110, Leaf), 29, Leaf))", "Node(Node(Leaf, -29, Leaf), -44, Node(Node(Leaf, -110, Leaf), 57, Leaf))"]
128
+ end
129
+ end
130
+
131
+ -- A refinement's bounds narrow generation: an amount from 1 to 1000 is
132
+ -- drawn from that range, not filtered out of every Int32, alongside a value
133
+ -- of a data type.
134
+ type Purse is Purse coins :: Int64 end
135
+
136
+ definition spend (p :: Purse) (amount :: Int32 where amount >= 1 && amount <= 1000) :: Int32 is amount end
137
+
138
+ law `refined amounts are drawn from their range` is
139
+ definition is
140
+ `for all` (p :: Purse) (amount :: Int32 where amount >= 1 && amount <= 1000) . spend p amount >= 1
141
+ end
142
+ end
@@ -0,0 +1,20 @@
1
+ unit example.handles
2
+
3
+ -- A handle is a value only adapters create, such as a library's concurrent
4
+ -- queue. LawSpec passes it along unopened: it never generates, builds or
5
+ -- looks inside one, and two handles are equal only when they are the same.
6
+ -- Here the queue is the target's own concurrent queue, bound directly where
7
+ -- the target has one (see each target's bindings) and wrapped elsewhere.
8
+ handle Jobs
9
+
10
+ newJobs :: Unit -> Jobs
11
+ submit :: Jobs -> Int32 -> Unit
12
+ take :: Jobs -> Maybe Int32
13
+ pending :: Jobs -> Int32
14
+
15
+ model jobs :: shared Jobs behaves like Queue Int32 is
16
+ start newJobs
17
+ submit as offer
18
+ take as poll
19
+ pending as size
20
+ end
@@ -0,0 +1,121 @@
1
+ unit example.models
2
+
3
+ -- A stateful model pairs a system's commands with reference definitions over
4
+ -- a simpler model state. LawSpec generates runs of commands, runs them
5
+ -- against the adapters, and checks each result and state against the model.
6
+
7
+ -- A linear model: the stack's size is in its type, so a run never pops an
8
+ -- empty stack.
9
+ type Stack (n :: Natural) is
10
+ | Empty where n = 0
11
+ | Push top :: Int8 rest :: Stack m where n = m + 1
12
+ end
13
+
14
+ empty :: Unit -> Stack 0
15
+ push :: (x :: Int8) -> Stack n / Stack (n + 1) -> Unit
16
+ pop :: Stack (n + 1) / Stack n -> Int8
17
+ peek :: Stack (n + 1) / Stack (n + 1) -> Int8
18
+
19
+ definition modelPush (x :: Int8) (xs :: List Int8) :: List Int8 is Cons x xs end
20
+
21
+ definition modelPop (xs :: List Int8) :: Pair Int8 (List Int8) is
22
+ match xs with
23
+ | Nil -> Pair 0 Nil
24
+ | Cons x rest -> Pair x rest
25
+ end
26
+ end
27
+
28
+ definition modelPeek (xs :: List Int8) :: Pair Int8 (List Int8) is
29
+ match xs with
30
+ | Nil -> Pair 0 Nil
31
+ | Cons x rest -> Pair x xs
32
+ end
33
+ end
34
+
35
+ definition toList (s :: Stack n) :: List Int8 is
36
+ match s with
37
+ | Empty -> Nil
38
+ | Push top rest -> Cons top (toList rest)
39
+ end
40
+ end
41
+
42
+ model stack :: Stack n by List Int8 is
43
+ start empty by Nil
44
+ push by modelPush
45
+ pop by modelPop
46
+ peek by modelPeek
47
+ abstract toList
48
+ end
49
+
50
+ -- A shared model: commands take one counter, whose type never changes, and
51
+ -- may run at the same time, so each must be atomic. LawSpec also runs them
52
+ -- in parallel and checks that every history is linearizable.
53
+ type Counter is Counter id :: Int32 end
54
+
55
+ newCounter :: Unit -> Counter
56
+ async increment :: Counter -> Int64
57
+ async decrement :: Counter -> Int64
58
+ async read :: Counter -> Int64
59
+
60
+ definition modelIncrement (n :: Int64 where n >= 0 && n <= 1000000) :: Pair Int64 Int64 is Pair (n + 1) (n + 1) end
61
+ definition modelDecrement (n :: Int64 where n >= 0 && n <= 1000000) :: Pair Int64 Int64 is Pair (n - 1) (n - 1) end
62
+ definition modelRead (n :: Int64) :: Pair Int64 Int64 is Pair n n end
63
+ definition positive (n :: Int64) :: Bool is n > 0 end
64
+
65
+ model counter :: shared Counter by Int64 is
66
+ start newCounter ~ 0
67
+ increment ~ modelIncrement
68
+ decrement ~ modelDecrement when positive
69
+ read ~ modelRead
70
+ end
71
+
72
+ -- A protocol lists what one end of a channel sends and receives; the other
73
+ -- end does the reverse. Scenarios run a shared model's commands from
74
+ -- processes that run at the same time and talk over channels; LawSpec checks
75
+ -- that they cannot deadlock or race, then runs them on many schedules, and
76
+ -- each run must agree with the model.
77
+ protocol Report is
78
+ send Int64
79
+ end
80
+
81
+ protocol Request is
82
+ send Report
83
+ end
84
+
85
+ scenario `a count is passed on` in counter is
86
+ channel report :: Report
87
+ par
88
+ n <- increment
89
+ send report n
90
+ with
91
+ receive report m
92
+ expect m = 1
93
+ end
94
+ end
95
+
96
+ -- The asker hands its end of the answer channel to a worker, which replies
97
+ -- to the listener directly.
98
+ scenario `a reply is delegated` in counter is
99
+ channel ask :: Request
100
+ channel answer :: Report
101
+ par
102
+ send ask answer
103
+ with
104
+ receive ask reply
105
+ n <- increment
106
+ send reply n
107
+ with
108
+ receive answer m
109
+ expect m = 1
110
+ end
111
+ end
112
+
113
+ scenario `two counts at once` in counter is
114
+ par
115
+ a <- increment
116
+ with
117
+ b <- increment
118
+ end
119
+ total <- read
120
+ expect total = 2
121
+ end
@@ -0,0 +1,38 @@
1
+ unit example.sessions
2
+
3
+ -- Protocols become typed channel ends on every target, for implementation
4
+ -- code: each step is its own type, so steps out of order do not compile,
5
+ -- and an end used twice fails. The adapters below implement adding with a
6
+ -- server process they talk to through those generated types.
7
+
8
+ -- What a server does: receive two numbers, send their sum. Its client holds
9
+ -- the other end, which does the reverse.
10
+ protocol Serve is
11
+ receive Int32
12
+ receive Int32
13
+ send Int64
14
+ end
15
+
16
+ -- Handing a server's end to a worker (delegation).
17
+ protocol Hire is
18
+ send Serve
19
+ end
20
+
21
+ -- Adds through a server process. Processes that talk over channels wait for
22
+ -- each other, so these adapters are asynchronous.
23
+ async add :: Int32 -> Int32 -> Integer
24
+
25
+ -- Adds through a worker that is handed the server's end over a Hire channel.
26
+ async addHired :: Int32 -> Int32 -> Integer
27
+
28
+ law `a server adds` is
29
+ definition is
30
+ `for all` (a :: Int32) (b :: Int32) . add a b = prelude.Integer a + prelude.Integer b
31
+ end
32
+ end
33
+
34
+ law `a hired worker adds` is
35
+ definition is
36
+ `for all` (a :: Int32) (b :: Int32) . addHired a b = prelude.Integer a + prelude.Integer b
37
+ end
38
+ end
package/index.d.ts CHANGED
@@ -186,6 +186,7 @@ export interface NativeTypeBinding {
186
186
  native: NativeReference;
187
187
  constructors?: NativeConstructorBinding[];
188
188
  codec?: NativeCodecBinding;
189
+ arguments?: string[];
189
190
  }
190
191
 
191
192
  export interface NativeGeneratorBinding {
@@ -196,7 +197,9 @@ export interface NativeGeneratorBinding {
196
197
 
197
198
  export interface NativeFunctionBinding {
198
199
  declaration: string;
199
- native: NativeReference;
200
+ native?: NativeReference;
201
+ method?: string;
202
+ constructor?: NativeReference;
200
203
  }
201
204
 
202
205
  export interface NativeGoImport {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lawspec",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
4
4
  "description": "State the law once. Check it everywhere.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/templates.mjs CHANGED
@@ -81,12 +81,12 @@ const scaffolds = {
81
81
  "haskell": {
82
82
  "readable": {
83
83
  "stack.yaml": "snapshot: lts-24.58\npackages: [.]\n",
84
- "package.yaml": "name: lawspec-example\nversion: 0.1.0\ndependencies: [base, text, bytestring, containers]\nlibrary:\n source-dirs: src\ntests:\n laws:\n main: Spec.hs\n source-dirs: test\n dependencies: [lawspec-example, hspec, hedgehog, hspec-hedgehog, containers, mtl]\n build-tools: [hspec-discover]\n",
84
+ "package.yaml": "name: lawspec-example\nversion: 0.1.0\ndependencies: [base, text, bytestring, containers, network]\nlibrary:\n source-dirs: src\ntests:\n laws:\n main: Spec.hs\n source-dirs: test\n dependencies: [lawspec-example, hspec, hedgehog, hspec-hedgehog, containers, mtl]\n build-tools: [hspec-discover]\n",
85
85
  "test/Spec.hs": "{-# OPTIONS_GHC -F -pgmF hspec-discover #-}\n"
86
86
  },
87
87
  "compact": {
88
88
  "stack.yaml": "snapshot: lts-24.58\npackages: [.]\n",
89
- "package.yaml": "name: lawspec-example\nversion: 0.1.0\ndependencies: [base, text, bytestring, containers]\nlibrary:\n source-dirs: src\ntests:\n laws:\n main: Spec.hs\n source-dirs: test\n dependencies: [lawspec-example, hspec, hedgehog, hspec-hedgehog, containers, mtl]\n build-tools: [hspec-discover]\n",
89
+ "package.yaml": "name: lawspec-example\nversion: 0.1.0\ndependencies: [base, text, bytestring, containers, network]\nlibrary:\n source-dirs: src\ntests:\n laws:\n main: Spec.hs\n source-dirs: test\n dependencies: [lawspec-example, hspec, hedgehog, hspec-hedgehog, containers, mtl]\n build-tools: [hspec-discover]\n",
90
90
  "test/Spec.hs": "{-# OPTIONS_GHC -F -pgmF hspec-discover #-}\n"
91
91
  }
92
92
  },