lawspec 0.15.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -0
- package/README.md +3 -3
- package/bin/lawspec.mjs +1 -1
- package/build.json +101 -91
- package/core.wasm +0 -0
- package/examples/specs/async_fetch.lawspec +30 -0
- package/examples/specs/collections.lawspec +103 -44
- package/examples/specs/flow_stack.lawspec +59 -0
- package/examples/specs/gadt_expressions.lawspec +76 -0
- package/examples/specs/indexed_arithmetic.lawspec +154 -0
- package/examples/specs/lists.lawspec +67 -0
- package/package.json +1 -1
- package/templates.mjs +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
### Collections
|
|
6
|
+
|
|
7
|
+
`Set a`, `KeyVal k v`, `Queue a`, `Stack a` and `Deque a` are built in, with
|
|
8
|
+
`Entry k v` and `Ordering`. Operations are total prelude functions, such as
|
|
9
|
+
`prelude.setOf`, `prelude.lookup`, `prelude.push` and `prelude.popBack`, and
|
|
10
|
+
`prelude.compare` orders two keyed values. A unit that declares a type of the
|
|
11
|
+
same name keeps its own.
|
|
12
|
+
|
|
13
|
+
- Set elements and KeyVal keys need the new `Keyed` capability: a total order
|
|
14
|
+
shared by every target. Exact numbers order by value, text by code point,
|
|
15
|
+
lists element by element and data by constructor, then fields. Floats,
|
|
16
|
+
complex numbers and symbols are not keyed.
|
|
17
|
+
- Adapters use each target's own collections: `frozenset` and `dict` in
|
|
18
|
+
Python, `Set` and `Map` in JavaScript, sorted slices in Go, `java.util.Set`
|
|
19
|
+
and `Map` in Java and Kotlin, `BTreeSet` and `BTreeMap` in Rust, and
|
|
20
|
+
`Data.Set` and `Data.Map` in Haskell. Python and JavaScript use sorted tuples
|
|
21
|
+
or arrays where elements are structured. Codecs sort, deduplicate and keep
|
|
22
|
+
the last value for a repeated key.
|
|
23
|
+
- Generated Haskell projects depend on `containers`. Rust and Haskell
|
|
24
|
+
generated data derive `Ord` when it is keyed.
|
|
25
|
+
|
|
26
|
+
See [collections](docs/reference/language/collections.md).
|
|
27
|
+
|
|
28
|
+
### Asynchronous functions
|
|
29
|
+
|
|
30
|
+
`async price :: Text -> Int32` declares an asynchronous adapter. It returns a
|
|
31
|
+
coroutine in Python, a `Promise` in JavaScript and TypeScript, a
|
|
32
|
+
`CompletableFuture` in Java, a `suspend fun` in Kotlin, a goroutine-backed
|
|
33
|
+
`lawspec.Task` in Go, an `IO` action in Haskell and a `Future` in Rust. The
|
|
34
|
+
generated tests await each call where it is made, and check contracts on the
|
|
35
|
+
awaited result. See
|
|
36
|
+
[asynchronous functions](docs/reference/language/async-functions.md).
|
|
37
|
+
|
|
38
|
+
### Other changes
|
|
39
|
+
|
|
40
|
+
- A numeric literal passed to a generic function takes the type its other
|
|
41
|
+
arguments fix: `prelude.insert 1 s` with `s :: Set Int32` needs no
|
|
42
|
+
annotation.
|
|
43
|
+
- Generated schemas no longer revalidate a whole value on each construction,
|
|
44
|
+
match or checked-definition call; values are checked at the adapter
|
|
45
|
+
boundary. Large recursive values test much faster.
|
|
46
|
+
- The list example is now `examples/specs/lists.lawspec`;
|
|
47
|
+
`collections.lawspec` covers the new collections.
|
|
48
|
+
|
|
49
|
+
## 0.16.0
|
|
50
|
+
|
|
51
|
+
### GADTs
|
|
52
|
+
|
|
53
|
+
A constructor can fix a type parameter: `| Number value :: BigInt where a =
|
|
54
|
+
BigInt` builds only `Expr BigInt`. Matching refines the parameter in each
|
|
55
|
+
branch, so `definition eval (e :: Expr a) :: a` type-checks. A constructor that
|
|
56
|
+
cannot build a type is no value of it: matches need no branch for it, and
|
|
57
|
+
decoding rejects it. Definitions may call themselves at other instances
|
|
58
|
+
(polymorphic recursion), up to 64 instances each. Existentials determined by
|
|
59
|
+
the type (`where a = Pair b c`) are supported, and so are existentials only a
|
|
60
|
+
field mentions: each such value carries its type as a trailing `witness` field,
|
|
61
|
+
and generated values draw it from `Bool` and `Int32`. Native types use each
|
|
62
|
+
target's own GADT form where it has one: sealed interfaces of records in Java,
|
|
63
|
+
Kotlin data classes, Haskell GADT syntax, TypeScript conditional unions and
|
|
64
|
+
`Expr[int]` in Python. See [GADTs](docs/reference/language/gadts.md).
|
|
65
|
+
|
|
66
|
+
### Index arithmetic and shared indices
|
|
67
|
+
|
|
68
|
+
- Index expressions accept `+ - * div mod ^`. Subtraction never truncates:
|
|
69
|
+
`n = m - 1` requires `m >= 1`, as a runtime-checked constructor constraint.
|
|
70
|
+
- A variable bound by several fields makes their indices equal, so
|
|
71
|
+
`Node left :: Perfect m right :: Perfect m` declares perfect trees.
|
|
72
|
+
- An implicit index may first appear as `v + k` or `k * v`:
|
|
73
|
+
`dropFirst :: (xs :: Row (k + 1)) -> (r :: Rest k)`.
|
|
74
|
+
- Products and powers are uninterpreted atoms in the prover, so `r * c` and
|
|
75
|
+
`c * r` agree. A definition's non-linear result index that cannot be proved
|
|
76
|
+
is checked on each result and reported as `runtime-checked`; a linear one is
|
|
77
|
+
still an error.
|
|
78
|
+
- Generation solves any equation backwards over the indices each constructor
|
|
79
|
+
can reach, in all seven runtimes. This fixes `n = m + m`, which used to build
|
|
80
|
+
children of the wrong size, and builds balanced trees even without a fixed
|
|
81
|
+
index.
|
|
82
|
+
|
|
83
|
+
See [indexed families](docs/reference/language/indexed-families.md).
|
|
84
|
+
|
|
85
|
+
### Flow types
|
|
86
|
+
|
|
87
|
+
`pop :: Stack (n + 1) / Stack n -> Int8` declares a flow parameter: the call
|
|
88
|
+
takes the stack from one type to another. In laws, `~s` passes a state and
|
|
89
|
+
rebinds it to the state the call leaves, and `e1; e2` sequences:
|
|
90
|
+
`(push x ~s; pop ~s) = x`. Each clause is checked left to right, so a pop the
|
|
91
|
+
stack cannot take is a compile error that suggests a bound. A definition
|
|
92
|
+
updates its flow parameter with `~s := e`. Each flow function returns a
|
|
93
|
+
generated product (`PopFlow` with `result` and `state`), indexed by the state
|
|
94
|
+
it leaves, so adapters' output states are runtime checked. See
|
|
95
|
+
[flow types](docs/reference/language/flow-types.md).
|
|
96
|
+
|
|
97
|
+
### Other changes
|
|
98
|
+
|
|
99
|
+
- A type variable that only a field mentions is now an existential, not an
|
|
100
|
+
error.
|
|
101
|
+
- Rust property tests run on a thread with a 64 MiB stack, for deep generated
|
|
102
|
+
values.
|
|
103
|
+
- New acceptance suites `gadt` and `flow`, and `indexed` gains
|
|
104
|
+
`examples/specs/indexed_arithmetic.lawspec`, with mutants for every target.
|
|
105
|
+
- The [roadmap](docs/explanation/roadmap.md) records 0.12 to 0.19.
|
|
106
|
+
|
|
3
107
|
## 0.15.2
|
|
4
108
|
|
|
5
109
|
Generated data types are the types you would write by hand, so adapters no
|
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.
|
|
33
|
+
npm install --save-dev lawspec@0.17.0
|
|
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.
|
|
44
|
-
npm install --save-dev lawspec@0.
|
|
43
|
+
npm exec --package=lawspec@0.17.0 -- lawspec init --target javascript
|
|
44
|
+
npm install --save-dev lawspec@0.17.0
|
|
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
package/build.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"lawspec.cabal",
|
|
6
6
|
"package.yaml",
|
|
7
7
|
"runtime/LawSpecCodecs.hs",
|
|
8
|
+
"runtime/LawSpecCollectionCodecs.hs",
|
|
8
9
|
"runtime/LawSpecDataStrategies.hs",
|
|
9
10
|
"runtime/LawSpecDataStrategies.java",
|
|
10
11
|
"runtime/LawSpecKotlin.kt",
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
"src/LawSpec/Capabilities.hs",
|
|
35
36
|
"src/LawSpec/Code/Doc.hs",
|
|
36
37
|
"src/LawSpec/Code/JavaScript.hs",
|
|
38
|
+
"src/LawSpec/Collections.hs",
|
|
37
39
|
"src/LawSpec/Common.hs",
|
|
38
40
|
"src/LawSpec/Compile.hs",
|
|
39
41
|
"src/LawSpec/Core.hs",
|
|
@@ -64,6 +66,7 @@
|
|
|
64
66
|
"src/LawSpec/Elaboration.hs",
|
|
65
67
|
"src/LawSpec/Emit.hs",
|
|
66
68
|
"src/LawSpec/Eval.hs",
|
|
69
|
+
"src/LawSpec/Flow.hs",
|
|
67
70
|
"src/LawSpec/Frontend.hs",
|
|
68
71
|
"src/LawSpec/GoData.hs",
|
|
69
72
|
"src/LawSpec/GoDefinitions.hs",
|
|
@@ -80,6 +83,7 @@
|
|
|
80
83
|
"src/LawSpec/HaskellTestHelpers.hs",
|
|
81
84
|
"src/LawSpec/HaskellTypeRefs.hs",
|
|
82
85
|
"src/LawSpec/Imports.hs",
|
|
86
|
+
"src/LawSpec/IndexTerm.hs",
|
|
83
87
|
"src/LawSpec/Indexed.hs",
|
|
84
88
|
"src/LawSpec/Inference.hs",
|
|
85
89
|
"src/LawSpec/JavaData.hs",
|
|
@@ -125,6 +129,7 @@
|
|
|
125
129
|
"src/LawSpec/WebExpr.hs",
|
|
126
130
|
"src/LawSpec/WebNativeBinding.hs",
|
|
127
131
|
"src/LawSpec/WebTypes.hs",
|
|
132
|
+
"src/LawSpec/Witness.hs",
|
|
128
133
|
"stack.yaml",
|
|
129
134
|
"stack.yaml.lock",
|
|
130
135
|
"wasm/app/Exports.hs",
|
|
@@ -133,137 +138,142 @@
|
|
|
133
138
|
"wasm/lawspec-wasm.cabal"
|
|
134
139
|
],
|
|
135
140
|
"digests": {
|
|
136
|
-
"dev/Gen/Embed.hs": "
|
|
137
|
-
"lawspec.cabal": "
|
|
138
|
-
"package.yaml": "
|
|
139
|
-
"runtime/LawSpecCodecs.hs": "
|
|
140
|
-
"runtime/
|
|
141
|
-
"runtime/LawSpecDataStrategies.
|
|
141
|
+
"dev/Gen/Embed.hs": "41cd18500c1a8c9bdb51011ab4c74817f8e04b655aa10d9894aa1b93a3fa858b",
|
|
142
|
+
"lawspec.cabal": "a80664dbccd59b2365eb0c7721e7a809cc513895dacc25df1d654bd33eb5171c",
|
|
143
|
+
"package.yaml": "dbf60bb49b779a36a9764774430f35affe300fccc97e3e6b687a80ee3059237f",
|
|
144
|
+
"runtime/LawSpecCodecs.hs": "1b3f6b40ad49928cf5e9386e06bc2992c9f1271754351b9fa3075e50346ef03b",
|
|
145
|
+
"runtime/LawSpecCollectionCodecs.hs": "74caa786801c5142ed040897c7ebb7373abf49ee49e02af53e466646fb624f47",
|
|
146
|
+
"runtime/LawSpecDataStrategies.hs": "9cc5b98476364a6c255dc3eb40c53d65b4a9d4ab0c3961a806b3515a8d5e8f7f",
|
|
147
|
+
"runtime/LawSpecDataStrategies.java": "d06c1eb6c67f3d07ab0c90dc8f8626b48358763b91585c6ea216a47e11886dd0",
|
|
142
148
|
"runtime/LawSpecKotlin.kt": "0cf3b7de0406155225ccca33ee3dfdf8f0456c47d577f6be8f1265c13df838cb",
|
|
143
|
-
"runtime/LawSpecKotlinCodecs.kt": "
|
|
144
|
-
"runtime/LawSpecKotlinStrategies.kt": "
|
|
145
|
-
"runtime/LawSpecRuntime.hs": "
|
|
146
|
-
"runtime/LawSpecRuntime.java": "
|
|
147
|
-
"runtime/LawSpecSchema.hs": "
|
|
148
|
-
"runtime/LawSpecSchema.java": "
|
|
149
|
+
"runtime/LawSpecKotlinCodecs.kt": "416610eb295f2fe0a77dd5a133fc10db081b69a04e1649b33abec60e69f32474",
|
|
150
|
+
"runtime/LawSpecKotlinStrategies.kt": "8ee1edeec1c342f2bc70ca8bdad22ec5aabc38f6f61381fe905b717ffce0688e",
|
|
151
|
+
"runtime/LawSpecRuntime.hs": "59eccad16a99a4118a1f9f51a7556ef133e4b875f2f4f678d394f53cdf03d776",
|
|
152
|
+
"runtime/LawSpecRuntime.java": "8096d2cd35786f4e68991ceef8579337cd3c729f4871c60c261e40a0a4ccc43d",
|
|
153
|
+
"runtime/LawSpecSchema.hs": "c19eedd197fc2359780c1576dd6a1d6e9bcdaf2ed037b5dbb37f3db766356bf9",
|
|
154
|
+
"runtime/LawSpecSchema.java": "67f57d8e91fcf155a443724a5632ef52037a1d67ff12d20f3044cf22d6ca98b2",
|
|
149
155
|
"runtime/LawSpecStrategies.kt": "569f7775c0ac44765d05567cbf62d026558ac193c080ca71681ec6ee49c21794",
|
|
150
|
-
"runtime/lawspec_codecs.go": "
|
|
151
|
-
"runtime/lawspec_data_strategies.go": "
|
|
152
|
-
"runtime/lawspec_data_strategies.mjs": "
|
|
153
|
-
"runtime/lawspec_data_strategies.py": "
|
|
154
|
-
"runtime/lawspec_runtime.go": "
|
|
155
|
-
"runtime/lawspec_runtime.mjs": "
|
|
156
|
-
"runtime/lawspec_runtime.py": "
|
|
157
|
-
"runtime/lawspec_runtime.rs": "
|
|
158
|
-
"runtime/lawspec_schema.go": "
|
|
159
|
-
"runtime/lawspec_schema.mjs": "
|
|
160
|
-
"runtime/lawspec_schema.py": "
|
|
161
|
-
"runtime/lawspec_strategies.rs": "
|
|
162
|
-
"runtime/rust/Cargo.lock": "
|
|
163
|
-
"runtime/rust/Cargo.toml": "
|
|
156
|
+
"runtime/lawspec_codecs.go": "e069dd6f4331b9bdcbd50dda8fe5faffca83cb9c7c8ea62ac631d2c9fa951bf4",
|
|
157
|
+
"runtime/lawspec_data_strategies.go": "65ca2a09012c516c17bb66d7381637e71f454740858f648a78b9e536f1c7c600",
|
|
158
|
+
"runtime/lawspec_data_strategies.mjs": "5fe9327a6dda2e759558b77100aec96798f1aed4f517d4bc91f45a543b8d14b9",
|
|
159
|
+
"runtime/lawspec_data_strategies.py": "0d06f0c5b9cdd5f6659f424a328884b670c94b1572ec0fa5d5408a05110d94dd",
|
|
160
|
+
"runtime/lawspec_runtime.go": "870e611874d67f45d70c68e03d2094a37f3a12d8a42d9610d8437b8a8d5af30f",
|
|
161
|
+
"runtime/lawspec_runtime.mjs": "bf51f4ebd2855d26d7958cb2ed4ca6f5e8ec6f8a9e31ee38d8324f6accd40b81",
|
|
162
|
+
"runtime/lawspec_runtime.py": "44f69c30040bd9b7df8f66c18fc3487ca965d6eea4f27f811a5ec403a16f9942",
|
|
163
|
+
"runtime/lawspec_runtime.rs": "49e9a13ab742ac5a192785585548c7ab8f8b8f03cb0046ea03acf4b97c2273ee",
|
|
164
|
+
"runtime/lawspec_schema.go": "7e9361e9693c3885d98500026f3e3ef8e213eb72a489a58fc72669e8a9938103",
|
|
165
|
+
"runtime/lawspec_schema.mjs": "d77abea1a9dcb03e4a6c6eef6509971d8599fac9acdefa9b9e4b89b8d0fc5226",
|
|
166
|
+
"runtime/lawspec_schema.py": "daed20d27168970350ef0b63b9cb2e566bd00598922acb4071d863c076e787ba",
|
|
167
|
+
"runtime/lawspec_strategies.rs": "5e991a45548811fef1728e1e9b9f12f76ee4cc7cb9c3339eab79bc4cf5f54f6b",
|
|
168
|
+
"runtime/rust/Cargo.lock": "06dbc409b525f297e90a6a3255b2af1ad002421873d6e068cbbbf49ea09bf9a4",
|
|
169
|
+
"runtime/rust/Cargo.toml": "efa4b9b3f7b5d8a44652bacc1e49beebb2e53d15d96ef6f8ff9832d589d6125a",
|
|
164
170
|
"src/LawSpec/Api.hs": "b7315b30890e3e38382c7e4d60afdfc6c7c3647f056636c230a91c16047f9944",
|
|
165
|
-
"src/LawSpec/Backend.hs": "
|
|
166
|
-
"src/LawSpec/Capabilities.hs": "
|
|
171
|
+
"src/LawSpec/Backend.hs": "caf45afb73e7455dd801195b8b117ca7e4664ac4babc6ef0732e06faf9e64fcb",
|
|
172
|
+
"src/LawSpec/Capabilities.hs": "ab457f3da440a237ee731d664b94d95a0cc1fa4d8be4d4d0403a61ebcf98e310",
|
|
167
173
|
"src/LawSpec/Code/Doc.hs": "9e3b70f85deb1dcbce385af1d0cd4bea2dfa8a2d806d54745d4bb437406673e5",
|
|
168
174
|
"src/LawSpec/Code/JavaScript.hs": "77bf27dcc210216e4739f68c4709f556f80130ab83b3b9387ac4a2421e790910",
|
|
175
|
+
"src/LawSpec/Collections.hs": "f8cc2978b6690709deb421ee22df37985c80e5b06064f819a193d6b912328ee1",
|
|
169
176
|
"src/LawSpec/Common.hs": "107612a8aaa787488413acf9c1a56622004d3bff251db89b99928343e6070883",
|
|
170
|
-
"src/LawSpec/Compile.hs": "
|
|
171
|
-
"src/LawSpec/Core.hs": "
|
|
177
|
+
"src/LawSpec/Compile.hs": "ec8a077041ec65ae908cf5fe48ed3cd15200f613b5cee7a4331f2f0bd9cb66ca",
|
|
178
|
+
"src/LawSpec/Core.hs": "30f5a20ede2dc810532d7e5c608a7df98b436e4d5e08547b837d5f56c86c270e",
|
|
172
179
|
"src/LawSpec/Core/DefinitionContracts.hs": "b7f60f038b231187ecf898e585ae1a8fb1fc113bb55bad6d1bb2660350fd969e",
|
|
173
|
-
"src/LawSpec/Core/Definitions.hs": "
|
|
174
|
-
"src/LawSpec/Core/Eval.hs": "
|
|
175
|
-
"src/LawSpec/Core/Evidence.hs": "
|
|
176
|
-
"src/LawSpec/Core/Expression.hs": "
|
|
177
|
-
"src/LawSpec/Core/Payload.hs": "
|
|
180
|
+
"src/LawSpec/Core/Definitions.hs": "8e0d1d7127f9d4872f2464b4af50b0f286823d5f0f203baf38fb3c316d766140",
|
|
181
|
+
"src/LawSpec/Core/Eval.hs": "26c518cf3db1f395f69353cb373e1aacf7f1a0ce81d3e17b15878421e9625a8b",
|
|
182
|
+
"src/LawSpec/Core/Evidence.hs": "48442ab98eafaa0f09d56c01493b73b724845347bbd27ae390c64366faec938d",
|
|
183
|
+
"src/LawSpec/Core/Expression.hs": "8b8a55d6fb166012918f0dc83322776505a83a7024a76c49fc568f29137a3702",
|
|
184
|
+
"src/LawSpec/Core/Payload.hs": "da2417fc99354338eab49a688c5f36cecde5ec1aacd8582c895428568b10a376",
|
|
178
185
|
"src/LawSpec/Core/PayloadPlan.hs": "f2a7d2dc58c6a0f79707bdc24773bd3aad3a3b8eea2735a8284b2a9f3a4af4a8",
|
|
179
186
|
"src/LawSpec/Core/RefinementProof.hs": "c19fc03e68488357a59897ec38ce3d2efd320c35b405b632af17425d6a18447a",
|
|
180
|
-
"src/LawSpec/Core/Schema.hs": "
|
|
181
|
-
"src/LawSpec/Core/Semantics.hs": "
|
|
182
|
-
"src/LawSpec/Core/Total.hs": "
|
|
183
|
-
"src/LawSpec/Core/Totality.hs": "
|
|
184
|
-
"src/LawSpec/Core/Types.hs": "
|
|
185
|
-
"src/LawSpec/Core/Validate.hs": "
|
|
186
|
-
"src/LawSpec/Core/Value.hs": "
|
|
187
|
-
"src/LawSpec/CoreEmit.hs": "
|
|
188
|
-
"src/LawSpec/CoreNativeScalarEmit.hs": "
|
|
189
|
-
"src/LawSpec/CoreScalarEmit.hs": "
|
|
190
|
-
"src/LawSpec/Data.hs": "
|
|
187
|
+
"src/LawSpec/Core/Schema.hs": "ce06bd96b63d11f80be518e626b33526668ae1e2f3f7fc626bb1048e296efc21",
|
|
188
|
+
"src/LawSpec/Core/Semantics.hs": "cdb8256e523f7808fa50fe7d80d709217a28de4c81c5ff5be8382f94900f3779",
|
|
189
|
+
"src/LawSpec/Core/Total.hs": "308684d7ff78a5e4dc75aef30c4df17610a2cb107d48ddb75d14d8573b178e5b",
|
|
190
|
+
"src/LawSpec/Core/Totality.hs": "5e76100466cf4a157b9eda36738806af836a5bda949f5d568d7bf5155fa8858a",
|
|
191
|
+
"src/LawSpec/Core/Types.hs": "f4689fb690148be0171403ba2bf0e29f841cee3381bf2a8ad1daf45841140097",
|
|
192
|
+
"src/LawSpec/Core/Validate.hs": "74c2a51eb913f8414268064f22d2d5d97ebfb0e4797e146b229076c29ac38726",
|
|
193
|
+
"src/LawSpec/Core/Value.hs": "1f4eddd1e4c642f91478fa7009bc4edbd9f6f4da115c11e03021f4e4e9f0b275",
|
|
194
|
+
"src/LawSpec/CoreEmit.hs": "e006dd23a77fea0918b5a5a9dd1aaba5f56c55e74d8f717f91266b94463f7d80",
|
|
195
|
+
"src/LawSpec/CoreNativeScalarEmit.hs": "389f1940596512d91ba813c2f20ed66fe7c972cfc2e44d76e4e8a61d5f3c52b7",
|
|
196
|
+
"src/LawSpec/CoreScalarEmit.hs": "4b45ec70b9074d54c9e023d482d5926ec3f679c167eb4f68f6de9679dfb98f8e",
|
|
197
|
+
"src/LawSpec/Data.hs": "f659f4e86f1009c4806334a45686970dde2efa2641585f997a7beba01d0e6f2d",
|
|
191
198
|
"src/LawSpec/DataNames.hs": "2eeb0d215131981a2271725a50c21dce44c7146a167025eb239a83922fdecaf6",
|
|
192
|
-
"src/LawSpec/DefinitionTotality.hs": "
|
|
193
|
-
"src/LawSpec/Discharge.hs": "
|
|
199
|
+
"src/LawSpec/DefinitionTotality.hs": "adf00236e0e1b1cad4299793ced5f9047dbc2321d3c2f9ba040bac30d1a87c73",
|
|
200
|
+
"src/LawSpec/Discharge.hs": "bd1acbddecf1f060aaaad1a6796825321c56b434d556e9873eb6c9d99459fdb7",
|
|
194
201
|
"src/LawSpec/Domain.hs": "222d15f0012ae630802238a6d7e1ee78d1e718b599f5ebb5a1ddc4e8d29d68c3",
|
|
195
|
-
"src/LawSpec/DomainModel.hs": "
|
|
196
|
-
"src/LawSpec/Elaboration.hs": "
|
|
202
|
+
"src/LawSpec/DomainModel.hs": "835e6e31c9565bd624c1139ead71ad65c1065ee660457ae365522f7ed78f7939",
|
|
203
|
+
"src/LawSpec/Elaboration.hs": "aade19ada1b9b944d1d5864b1ada61f89a57a675d7e8de9e2f3bc6b6f6d84b00",
|
|
197
204
|
"src/LawSpec/Emit.hs": "9f34f5765915a2a12a66a6dca647ddaef9289372956802c6d99cf0cfec447c7a",
|
|
198
|
-
"src/LawSpec/Eval.hs": "
|
|
199
|
-
"src/LawSpec/
|
|
200
|
-
"src/LawSpec/
|
|
201
|
-
"src/LawSpec/
|
|
202
|
-
"src/LawSpec/
|
|
205
|
+
"src/LawSpec/Eval.hs": "b87a786ed7a512c60e00a037a1a36738933518aafa255babaa8b1b42dbb8ff6d",
|
|
206
|
+
"src/LawSpec/Flow.hs": "830b9d59b94f26a05687bd5baed06b4ecbf1f47c6a634766810d3dd2a44647cd",
|
|
207
|
+
"src/LawSpec/Frontend.hs": "5f2bb4f3580b8fca6d899a0b40000da653fb7e76f11f8c8df271eb023ad5b278",
|
|
208
|
+
"src/LawSpec/GoData.hs": "ffd2f91688e4efdbd65033b88ad55032278f9b29d8027f6dc9e4b2c3eb9bfbc0",
|
|
209
|
+
"src/LawSpec/GoDefinitions.hs": "907fb5ba9935391fa640c0cf6d037db78d270467a8b93e1190a9d511f03561ff",
|
|
210
|
+
"src/LawSpec/GoExpr.hs": "67ef004e97074976e0fd137dfef8d417efe8de3f7d5c3c08293874d30d89e9d0",
|
|
203
211
|
"src/LawSpec/GoNativeBinding.hs": "1ad8ea4cec6187c7e6005651c0edeec69e196eb329fb958c833da7751225aa1b",
|
|
204
|
-
"src/LawSpec/GoProperties.hs": "
|
|
212
|
+
"src/LawSpec/GoProperties.hs": "a6118510ae472de8cbeb0f1dfb025f23a84123bccc5a53af20ad39470851e639",
|
|
205
213
|
"src/LawSpec/GoTestHelpers.hs": "dee55ee8505370e932773b8c685f4a1f380129e6f43f8806bf1e82efb99451b1",
|
|
206
214
|
"src/LawSpec/GoTypeRefs.hs": "7f239f5ac3ac8bd21c8f76c328049f7715d8562ee1382befa0a58abd4f15f726",
|
|
207
|
-
"src/LawSpec/HaskellData.hs": "
|
|
208
|
-
"src/LawSpec/HaskellDefinitions.hs": "
|
|
209
|
-
"src/LawSpec/HaskellExpr.hs": "
|
|
215
|
+
"src/LawSpec/HaskellData.hs": "8ca1f1a353972a28b3d044c3763243cd8a2abf3e2cdb3b15b6112d8a7edf9da2",
|
|
216
|
+
"src/LawSpec/HaskellDefinitions.hs": "9481901b9f1753dbfe90dcc859275eaab474acdb2f41035cd14e9d03cce45440",
|
|
217
|
+
"src/LawSpec/HaskellExpr.hs": "f7ef064ac6700c027de4bd71bddeb3236853232cf7a39bed61de16153539b401",
|
|
210
218
|
"src/LawSpec/HaskellNativeBinding.hs": "9f98aa0c8659b572bd6486a0e29c4692bc6432db8639fa74a09bbf1b771bbfa6",
|
|
211
|
-
"src/LawSpec/HaskellProperties.hs": "
|
|
219
|
+
"src/LawSpec/HaskellProperties.hs": "3f99a4083b602e3a197446614f66f127384b2babd6039c5d3189a81c75329db4",
|
|
212
220
|
"src/LawSpec/HaskellTestHelpers.hs": "51e59b2abc9e85455e3c8e2c6baadb27e5d319081cb730d2ce56be5dc8053897",
|
|
213
221
|
"src/LawSpec/HaskellTypeRefs.hs": "2225b2a5e2ab3662e7202d23b24f4d6db48353b35ae28df8acd2b92fd2b97574",
|
|
214
|
-
"src/LawSpec/Imports.hs": "
|
|
215
|
-
"src/LawSpec/
|
|
216
|
-
"src/LawSpec/
|
|
217
|
-
"src/LawSpec/
|
|
218
|
-
"src/LawSpec/
|
|
219
|
-
"src/LawSpec/
|
|
222
|
+
"src/LawSpec/Imports.hs": "1182894623b69e777531706c013b5ecd9995c51dd8c8b969c1807a5a103bf2da",
|
|
223
|
+
"src/LawSpec/IndexTerm.hs": "65e7942306f08683ec9f284f76b10ad271f8a909b1ec721da04f6275c9a1d20e",
|
|
224
|
+
"src/LawSpec/Indexed.hs": "1e7ed53653cabc097f75dcf350c81facf9feb30af73f3e21f9344665fc316387",
|
|
225
|
+
"src/LawSpec/Inference.hs": "8d3a8853bd691329d6d1cf0cdde9e4e8f8c895f5be944f2e77e9df348d1aa0eb",
|
|
226
|
+
"src/LawSpec/JavaData.hs": "8afc712aed51240921cd6830b5d21ab029f71cc5cb0de56ca522eadd94ccb600",
|
|
227
|
+
"src/LawSpec/JavaDefinitions.hs": "ba771b59878d8780613d1d40094597e8dca0478ccde11188a39df77667a01dab",
|
|
228
|
+
"src/LawSpec/JavaExpr.hs": "fb1d3e64f3288e557720dead7738eb4f2a59d4563e5be4a742e1582829f19d3e",
|
|
220
229
|
"src/LawSpec/JavaNativeBinding.hs": "9eb52b3be19badda078069bb3d6813d72cad4f0a9bfa708f7404e44201d3c352",
|
|
221
|
-
"src/LawSpec/JavaProperties.hs": "
|
|
230
|
+
"src/LawSpec/JavaProperties.hs": "7438793af96d9e9e2072670c4bc20f56729c85e054d598b5ad4e991bfdf094a1",
|
|
222
231
|
"src/LawSpec/JavaTestHelpers.hs": "e6f4b9bbb7e5f07ece6ab1845e12aa661e62e8b926680b11454223fc3ec1523d",
|
|
223
|
-
"src/LawSpec/KotlinData.hs": "
|
|
232
|
+
"src/LawSpec/KotlinData.hs": "ca3bad4dca9fcd604cd39ec713ef8ed38966aaf24b1d6b33d88d405bfc80641d",
|
|
224
233
|
"src/LawSpec/KotlinDefinitions.hs": "97d7d407d4bbdb4ce16035d607dbbcb8e3d6f5db513f2123a2c269e3dc6d2b38",
|
|
225
234
|
"src/LawSpec/KotlinExpr.hs": "20312f0774f1d0832a21a19b93c8103e2791ecd32a827d8e9c4f2b4830a996a0",
|
|
226
235
|
"src/LawSpec/KotlinNativeBinding.hs": "1aec7854758f07a4d2288de13931fbb88ef32220f85d3c84fe8233ad67b6d095",
|
|
227
|
-
"src/LawSpec/KotlinProperties.hs": "
|
|
236
|
+
"src/LawSpec/KotlinProperties.hs": "5c7289c97cc915cbc3432eb4b08a2fefbe786af4d6591af4b59923aa9d6a2075",
|
|
228
237
|
"src/LawSpec/KotlinTestHelpers.hs": "74810d65faafc6ed4d64b1fb0596cda4186e586b7144a7441641b798795bc324",
|
|
229
|
-
"src/LawSpec/Model.hs": "
|
|
238
|
+
"src/LawSpec/Model.hs": "72fae874b4a5aa98057254fc1b508df3f71ec8587740bc7c18ea29490526137b",
|
|
230
239
|
"src/LawSpec/NativeBinding.hs": "33959b0fd432ad4150f3b685f6438e284b801c2a59d9ef3132486a1cc7c8925a",
|
|
231
|
-
"src/LawSpec/NativeRequest.hs": "
|
|
240
|
+
"src/LawSpec/NativeRequest.hs": "f8200c36725859ea32374655951f7a45e2b3342b159f9f6c88b5f9a2a6331897",
|
|
232
241
|
"src/LawSpec/Packages.hs": "161fc68a9959a80762ca4ece405240351e3180ea4dbb2bf148eaca6562fb7c30",
|
|
233
|
-
"src/LawSpec/Parser.hs": "
|
|
242
|
+
"src/LawSpec/Parser.hs": "953e907c51e12724085a6ce0504c767a8d622acf7ad4479913ed2cb86017251e",
|
|
234
243
|
"src/LawSpec/PortableGenerator.hs": "69d457e39f539c77fc7a4c08205e75352bbecd9dfdff031a283a39bf44b22d49",
|
|
235
|
-
"src/LawSpec/PortableTestHelpers.hs": "
|
|
244
|
+
"src/LawSpec/PortableTestHelpers.hs": "8d98184c92a34b431f2a820cef3ea735b0cec3a52504f519b3bb06cb5174017c",
|
|
236
245
|
"src/LawSpec/Prelude.hs": "b1e155c12f58e7c346551a0c65c5d5af76d045b3f1625977ca2a5d1c97cb8c46",
|
|
237
|
-
"src/LawSpec/Public.hs": "
|
|
238
|
-
"src/LawSpec/PythonData.hs": "
|
|
239
|
-
"src/LawSpec/PythonDefinitions.hs": "
|
|
246
|
+
"src/LawSpec/Public.hs": "7010357e250607a9f94d1ab8dc34fad4014fb7d9f15ba0d7c2fc94d0f48fcac4",
|
|
247
|
+
"src/LawSpec/PythonData.hs": "bb6e947829aa7611f39fb74152e8ef013c192be717a3573f12d249973ca65e5d",
|
|
248
|
+
"src/LawSpec/PythonDefinitions.hs": "387a3f7678a7968249805365602206ebc0bb8d5b56924534d35294a1a98b0e5f",
|
|
240
249
|
"src/LawSpec/PythonExpr.hs": "23d7d24b5fb4efff9cb63d38c02a93d95744ec79b4565daf1412088fc7c4ba59",
|
|
241
250
|
"src/LawSpec/PythonNativeBinding.hs": "4e35ff8781062d0f614e45ea45f98038c8d609ab78bd671cb0a239eaa9db1690",
|
|
242
|
-
"src/LawSpec/PythonTypes.hs": "
|
|
251
|
+
"src/LawSpec/PythonTypes.hs": "d465eef5fecef5d011fa422655d51cd1123800a39cfaf042545d41f2557bd98c",
|
|
243
252
|
"src/LawSpec/Refinement.hs": "3bbdc090f9ebce60d99254dbe93dec6e11bd838df8537df828fd9c768c79d126",
|
|
244
|
-
"src/LawSpec/RuntimeSources.hs": "
|
|
245
|
-
"src/LawSpec/RustData.hs": "
|
|
246
|
-
"src/LawSpec/RustDefinitions.hs": "
|
|
247
|
-
"src/LawSpec/RustEmit.hs": "
|
|
253
|
+
"src/LawSpec/RuntimeSources.hs": "b984cd8635be4109ea79fff5becb9accb1379f5322aaf6c50938264f01ba47b6",
|
|
254
|
+
"src/LawSpec/RustData.hs": "b8bb35f2cc5835c811e01e8bbbe172f483ab2620e1e8e331cdfaf6342c23e7f1",
|
|
255
|
+
"src/LawSpec/RustDefinitions.hs": "8211ad8c4db088ae658918b5172a666303aaf1bfe3f29bdd0b520a77015b2892",
|
|
256
|
+
"src/LawSpec/RustEmit.hs": "a57aaef4f6980a4d00b6fee1caf099b5ee317f1f8f6cfc9c480f68a431d39942",
|
|
248
257
|
"src/LawSpec/RustExpr.hs": "04b2ef81417b811c7b98a98acdadab4e588ca8757964a63ba8dc5936c36479e6",
|
|
249
258
|
"src/LawSpec/RustNativeBinding.hs": "d50d1fb10591ee86129ae49b38a343148c084479e450eef3b320e1efdd55245d",
|
|
250
259
|
"src/LawSpec/RustNativeGenerators.hs": "a3b1484d9ff0008e4f961aa81d0aa51da57ec0cd7909124e80c98d56aacc8ce9",
|
|
251
|
-
"src/LawSpec/Scaffold.hs": "
|
|
252
|
-
"src/LawSpec/Scalar.hs": "
|
|
253
|
-
"src/LawSpec/SpecializeDefinitions.hs": "
|
|
254
|
-
"src/LawSpec/Testing.hs": "
|
|
255
|
-
"src/LawSpec/WebData.hs": "
|
|
256
|
-
"src/LawSpec/WebDefinitions.hs": "
|
|
260
|
+
"src/LawSpec/Scaffold.hs": "217328445923b9e339428dd542ce9b910c26ed132c31d1ef083de73763b749f9",
|
|
261
|
+
"src/LawSpec/Scalar.hs": "f7eddc660dbc08d315d85291e446ed5c34670e2321f9268ba852ebf65e206141",
|
|
262
|
+
"src/LawSpec/SpecializeDefinitions.hs": "2bdd6d9b191941d869ef524659e02fed551499aaa2ea98c99323da03af113012",
|
|
263
|
+
"src/LawSpec/Testing.hs": "fb4299ad7e68d84e32991b5397c39f2fd06eb1417a0bf8b14fe2d85cfa9c26db",
|
|
264
|
+
"src/LawSpec/WebData.hs": "bbcd7d734ce3941d83cc455a9a2147b642f6111ebb34db9ef99dcb7a58b8c4ae",
|
|
265
|
+
"src/LawSpec/WebDefinitions.hs": "579309c76b9303a3c9e456e1252f2d0881795210aa0b09104a00efdfe10e3e13",
|
|
257
266
|
"src/LawSpec/WebExpr.hs": "0389dcd5cf7479dd23ef034b1012de6ebd70bf1dc9e3d90981dfb0ba2702596f",
|
|
258
|
-
"src/LawSpec/WebNativeBinding.hs": "
|
|
259
|
-
"src/LawSpec/WebTypes.hs": "
|
|
267
|
+
"src/LawSpec/WebNativeBinding.hs": "f536c1b1454bc83f5a9e8c61a608390b9a6fa91537f34d3c245b90ee6e275b7d",
|
|
268
|
+
"src/LawSpec/WebTypes.hs": "1d43194e4dafbdcbed6e607414a875e9030028f03579f17d189c14a6a9bd5e53",
|
|
269
|
+
"src/LawSpec/Witness.hs": "9ae944c9307df964bc853205269c1e4cb69cc076070bb878fc957f4bdb02de85",
|
|
260
270
|
"stack.yaml": "20ccf4d599e355e60b7aa4f814a7cd4299fe2048616cc2e6dbdc22a7bd8cec73",
|
|
261
271
|
"stack.yaml.lock": "ae222b9c81af920c56e50fa4596fa57786e7fa5a7b461390362b2b2ff63818c7",
|
|
262
272
|
"wasm/app/Exports.hs": "4ecbdac8faa2449e6fc61b93c82e6278fa14374154f29b4dacf0eef433f06a47",
|
|
263
273
|
"wasm/cabal.project": "021e560afdc5eb4cb7169e7119ecb8f92c9ee170245af909c94b612941bff5cc",
|
|
264
274
|
"wasm/cabal.project.freeze": "733dbed3d2ecccb26e874fd58f136296dad772184deb1658c196b5d54a0814dc",
|
|
265
|
-
"wasm/lawspec-wasm.cabal": "
|
|
266
|
-
"npm/core.wasm": "
|
|
275
|
+
"wasm/lawspec-wasm.cabal": "c4be9cf8ffe6ed3f54000311845595ea9a9094dbbfc1dd735be90d9ba23e08ab",
|
|
276
|
+
"npm/core.wasm": "369eb593bfdf2824102cec5f9097ee9d7958be71394d432e5b09aae408db333b",
|
|
267
277
|
"npm/core_jsffi.js": "88d136efe92f7cff5758c8fec8d9b6bbc9707fe37741cebeeb415fe34ce3d72b",
|
|
268
278
|
"npm/api.mjs": "19e1624f91258c1397f3212faf65b407c62671b0fc5b118520e6a91f7ad7c6ba",
|
|
269
279
|
"npm/index.d.ts": "2215087cc6628a2ddbdd573210c4f9021cffeb00c142d4f3ae1314fd59a397f6"
|
package/core.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
unit example.orders
|
|
2
|
+
|
|
3
|
+
-- An async adapter's result arrives later, as the target's task (a coroutine,
|
|
4
|
+
-- Promise, CompletableFuture, suspend call, Go task, IO action or Future); the
|
|
5
|
+
-- tests await each call where it is made, in order.
|
|
6
|
+
|
|
7
|
+
-- A product's price, looked up remotely. Prices are never negative.
|
|
8
|
+
async price :: (sku :: Text) -> (r :: Int32 where r >= 0)
|
|
9
|
+
-- How many are in stock.
|
|
10
|
+
async stock :: Text -> Int32
|
|
11
|
+
-- A local quote of the same price.
|
|
12
|
+
quote :: Text -> Int32
|
|
13
|
+
|
|
14
|
+
law `prices agree with quotes` is
|
|
15
|
+
definition is `for all` (sku :: Text) . price sku = quote sku end
|
|
16
|
+
example `a free sample` is
|
|
17
|
+
sku = "free"
|
|
18
|
+
expect price sku = 0
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
-- Two awaited calls in one clause.
|
|
23
|
+
law `stock never lowers a price` is
|
|
24
|
+
definition is `for all` (sku :: Text) . price sku + stock sku >= stock sku end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
-- An awaited call in a guard.
|
|
28
|
+
law `stocked products have prices` is
|
|
29
|
+
definition is `for all` (sku :: Text) . stock sku > 0 implies price sku >= 0 end
|
|
30
|
+
end
|
|
@@ -1,67 +1,126 @@
|
|
|
1
1
|
unit example.collections
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
-- Built-in collections: Set and KeyVal keep their elements and keys in the
|
|
4
|
+
-- portable total order, without repeats; Queue, Stack and Deque keep their
|
|
5
|
+
-- items in order. prelude.setOf, keyValOf, queueOf, stackOf and dequeOf
|
|
6
|
+
-- build them from lists.
|
|
7
|
+
|
|
8
|
+
-- The distinct values of a list.
|
|
9
|
+
dedupe :: List Int32 -> Set Int32
|
|
10
|
+
-- How many times each word occurs.
|
|
11
|
+
wordCounts :: List Text -> KeyVal Text BigInt
|
|
12
|
+
-- Enqueue every value, first to last.
|
|
13
|
+
fifo :: List Int8 -> Queue Int8
|
|
14
|
+
-- Push every value, first to last: the last is on top.
|
|
15
|
+
lifo :: List Int8 -> Stack Int8
|
|
16
|
+
-- Move the front item to the back.
|
|
17
|
+
rotate :: Deque Int8 -> Deque Int8
|
|
18
|
+
-- The distinct lists among some lists: structured elements.
|
|
19
|
+
distinctRows :: List (List Int8) -> Set (List Int8)
|
|
20
|
+
|
|
21
|
+
definition countWords (words :: List Text) (counts :: KeyVal Text BigInt) :: KeyVal Text BigInt is
|
|
22
|
+
match words with
|
|
23
|
+
| Nil -> counts
|
|
24
|
+
| Cons w rest -> match prelude.lookup w counts with
|
|
25
|
+
| Nothing -> countWords rest (prelude.put w 1 counts)
|
|
26
|
+
| Just n -> countWords rest (prelude.put w ((n + 1) :: BigInt) counts)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
definition rotated (d :: Deque Int8) :: Deque Int8 is
|
|
32
|
+
match prelude.peekFront d with
|
|
33
|
+
| Nothing -> d
|
|
34
|
+
| Just x -> prelude.pushBack x (prelude.popFront d)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
law `dedupe agrees with setOf` is
|
|
39
|
+
definition is `for all` (xs :: List Int32) . dedupe xs = prelude.setOf xs end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
law `distinct rows agree with setOf` is
|
|
43
|
+
definition is `for all` (rows :: List (List Int8)) . distinctRows rows = prelude.setOf rows end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
law `word counts agree with the definition` is
|
|
47
|
+
definition is
|
|
48
|
+
`for all` (words :: List Text) . wordCounts words = countWords words (prelude.keyValOf [])
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
law `the queue's front is the first value` is
|
|
53
|
+
definition is
|
|
54
|
+
`for all` (x :: Int8) (xs :: List Int8) . prelude.front (fifo (Cons x xs)) = Just x
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
law `the stack's top is the last value` is
|
|
59
|
+
definition is
|
|
60
|
+
`for all` (x :: Int8) (xs :: List Int8) . prelude.peek (lifo [x]) = Just x
|
|
20
61
|
end
|
|
21
|
-
example `empty input` is x = [] expect reverse x = [] end
|
|
22
62
|
end
|
|
23
63
|
|
|
24
|
-
law `
|
|
25
|
-
definition is `
|
|
26
|
-
example `duplicates` is x = [3, 1, 3] expect sort x = [1, 3, 3] end
|
|
64
|
+
law `fifo keeps the order` is
|
|
65
|
+
definition is `for all` (xs :: List Int8) . prelude.toList (fifo xs) = xs end
|
|
27
66
|
end
|
|
28
67
|
|
|
29
|
-
law `
|
|
30
|
-
definition is `for all` (
|
|
68
|
+
law `rotate agrees with the definition` is
|
|
69
|
+
definition is `for all` (d :: Deque Int8) . rotate d = rotated d end
|
|
31
70
|
end
|
|
32
71
|
|
|
33
|
-
law `
|
|
34
|
-
definition is
|
|
72
|
+
law `union is commutative` is
|
|
73
|
+
definition is
|
|
74
|
+
`for all` (s :: Set Int32) (t :: Set Int32) . prelude.union s t = prelude.union t s
|
|
75
|
+
end
|
|
35
76
|
end
|
|
36
77
|
|
|
37
|
-
law `
|
|
38
|
-
definition is
|
|
78
|
+
law `a removed value is no member` is
|
|
79
|
+
definition is
|
|
80
|
+
`for all` (x :: Int32) (s :: Set Int32) . prelude.member x (prelude.remove x s) = false
|
|
81
|
+
end
|
|
39
82
|
end
|
|
40
83
|
|
|
41
|
-
law `
|
|
84
|
+
law `an inserted value is a member` is
|
|
42
85
|
definition is
|
|
43
|
-
`for all` (
|
|
44
|
-
prelude.length (reverse xs) = prelude.length xs
|
|
86
|
+
`for all` (x :: Int32) (s :: Set Int32) . prelude.member x (prelude.insert x s) = true
|
|
45
87
|
end
|
|
46
88
|
end
|
|
47
89
|
|
|
48
|
-
law `
|
|
49
|
-
definition is
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
90
|
+
law `intersection and difference split a set` is
|
|
91
|
+
definition is
|
|
92
|
+
`for all` (s :: Set Int32) (t :: Set Int32) .
|
|
93
|
+
prelude.union (prelude.intersection s t) (prelude.difference s t) = s
|
|
94
|
+
end
|
|
53
95
|
end
|
|
54
96
|
|
|
55
|
-
law `
|
|
56
|
-
definition is
|
|
57
|
-
|
|
58
|
-
|
|
97
|
+
law `the latest put wins` is
|
|
98
|
+
definition is
|
|
99
|
+
`for all` (k :: Text) (v :: BigInt) (w :: BigInt) (m :: KeyVal Text BigInt) .
|
|
100
|
+
prelude.lookup k (prelude.put k w (prelude.put k v m)) = Just w
|
|
101
|
+
end
|
|
59
102
|
end
|
|
60
103
|
|
|
61
|
-
law `
|
|
62
|
-
definition is
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
104
|
+
law `a deleted key is absent` is
|
|
105
|
+
definition is
|
|
106
|
+
`for all` (k :: Text) (m :: KeyVal Text BigInt) . prelude.lookup k (prelude.delete k m) = Nothing
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
law `keys are distinct` is
|
|
111
|
+
definition is
|
|
112
|
+
`for all` (m :: KeyVal Text BigInt) . prelude.size (prelude.setOf (prelude.keys m)) = prelude.size m
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
law `popping the back leaves the rest` is
|
|
117
|
+
definition is
|
|
118
|
+
`for all` (x :: Int8) (d :: Deque Int8) . prelude.popBack (prelude.pushBack x d) = d
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
law `the empty stack stays empty` is
|
|
123
|
+
definition is
|
|
124
|
+
`for all` (x :: Int8) . prelude.isEmpty (prelude.pop (prelude.stackOf [x])) = true
|
|
66
125
|
end
|
|
67
126
|
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
unit example.flow
|
|
2
|
+
|
|
3
|
+
type Stack (n :: Natural) is
|
|
4
|
+
| Empty where n = 0
|
|
5
|
+
| Push top :: Int8 rest :: Stack m where n = m + 1
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
-- A / A' is a flow parameter: the call takes the stack from A to A'. Each
|
|
9
|
+
-- adapter returns its result with the stack it leaves, as a generated
|
|
10
|
+
-- product (PushFlow, PopFlow, PeekFlow); the stack's index is checked.
|
|
11
|
+
push :: (x :: Int8) -> Stack n / Stack (n + 1) -> Unit
|
|
12
|
+
pop :: Stack (n + 1) / Stack n -> Int8
|
|
13
|
+
peek :: Stack (n + 1) / Stack (n + 1) -> Int8
|
|
14
|
+
|
|
15
|
+
-- A reference definition updates its flow parameter with ~s := e.
|
|
16
|
+
definition pushed (x :: Int8) (s :: Stack n / Stack (n + 1)) :: Unit is
|
|
17
|
+
~s := Push x s
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
-- ~s passes s to a flow parameter and rebinds s to the stack the call
|
|
21
|
+
-- leaves; e1; e2 sequences, left to right. pop needs Stack (m + 1): after
|
|
22
|
+
-- push, s is a Stack (n + 1), so the pop below type-checks.
|
|
23
|
+
law `pop returns what push pushed` is
|
|
24
|
+
definition is
|
|
25
|
+
`for all` (x :: Int8) (s :: Stack n) . (push x ~s; pop ~s) = x
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
law `push grows the stack` is
|
|
30
|
+
definition is
|
|
31
|
+
`for all` (x :: Int8) (s :: Stack n) . (push x ~s; nOfStack s) = n + 1
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
law `pops come back in reverse` is
|
|
36
|
+
definition is
|
|
37
|
+
`for all` (x :: Int8) (y :: Int8) (s :: Stack n) .
|
|
38
|
+
(push x ~s; push y ~s; pop ~s; pop ~s) = x
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
-- The quantifier's index k + 1 lets peek and pop take s.
|
|
43
|
+
law `peek and pop agree` is
|
|
44
|
+
definition is
|
|
45
|
+
`for all` (s :: Stack (k + 1)) . peek ~s = pop ~s
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
law `pop shrinks the stack` is
|
|
50
|
+
definition is
|
|
51
|
+
`for all` (s :: Stack (k + 1)) . (pop ~s; nOfStack s) = k
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
law `push agrees with the reference` is
|
|
56
|
+
definition is
|
|
57
|
+
`for all` (x :: Int8) (s :: Stack n) . (pushed x ~s; pop ~s) = x
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
unit example.gadt
|
|
2
|
+
|
|
3
|
+
type Pair (a :: Type) (b :: Type) is Pair first :: a second :: b end
|
|
4
|
+
|
|
5
|
+
-- An expression indexed by the type of its value. Each constructor's `where`
|
|
6
|
+
-- fixes that type, so a value of Expr Bool is never a number literal. The
|
|
7
|
+
-- types b and c of Both are existential: Expr (Pair b c) determines them.
|
|
8
|
+
type Expr (a :: Type) is
|
|
9
|
+
| Number value :: BigInt where a = BigInt
|
|
10
|
+
| Truth value :: Bool where a = Bool
|
|
11
|
+
| Plus left :: Expr BigInt right :: Expr BigInt where a = BigInt
|
|
12
|
+
| Same left :: Expr BigInt right :: Expr BigInt where a = Bool
|
|
13
|
+
| Negate operand :: Expr Bool where a = Bool
|
|
14
|
+
| Both first :: Expr b second :: Expr c where a = Pair b c
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
-- Matching Number refines a to BigInt in that branch, so v is a value of a.
|
|
18
|
+
-- eval calls itself at other types (Expr BigInt inside Expr Bool): each type
|
|
19
|
+
-- it is used at becomes a checked instance, and unreachable branches vanish.
|
|
20
|
+
definition eval (e :: Expr a) :: a is
|
|
21
|
+
match e with
|
|
22
|
+
| Number v -> v
|
|
23
|
+
| Truth b -> b
|
|
24
|
+
| Plus l r -> eval l + eval r
|
|
25
|
+
| Same l r -> eval l == eval r
|
|
26
|
+
| Negate x -> !(eval x)
|
|
27
|
+
| Both l r -> Pair (eval l) (eval r)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
evalNumber :: Expr BigInt -> BigInt
|
|
32
|
+
evalTruth :: Expr Bool -> Bool
|
|
33
|
+
evalPair :: Expr (Pair BigInt Bool) -> Pair BigInt Bool
|
|
34
|
+
-- Constant folding: a single number with the same value.
|
|
35
|
+
fold :: Expr BigInt -> Expr BigInt
|
|
36
|
+
|
|
37
|
+
-- A shown value's type is existential and only the value says what it is:
|
|
38
|
+
-- each value carries its type, as a witness, to native code.
|
|
39
|
+
type Shown is
|
|
40
|
+
| Shown value :: b
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
-- The name of the type a shown value holds.
|
|
44
|
+
describe :: Shown -> Text
|
|
45
|
+
|
|
46
|
+
law `numbers agree with eval` is
|
|
47
|
+
definition is `for all` (e :: Expr BigInt) . evalNumber e = eval e end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
law `truths agree with eval` is
|
|
51
|
+
definition is `for all` (e :: Expr Bool) . evalTruth e = eval e end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
law `pairs agree with eval` is
|
|
55
|
+
definition is `for all` (e :: Expr (Pair BigInt Bool)) . evalPair e = eval e end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
law `folding keeps the value` is
|
|
59
|
+
definition is `for all` (e :: Expr BigInt) . eval (fold e) = eval e end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
law `a shown number names its type` is
|
|
63
|
+
definition is `for all` (x :: Int32) . describe (Shown x) = "Int32" end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
law `a shown flag names its type` is
|
|
67
|
+
definition is `for all` (b :: Bool) . describe (Shown b) = "Bool" end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
law `every shown value is described` is
|
|
71
|
+
definition is `for all` (s :: Shown) . prelude.length (describe s) > 0 end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
law `two plus three` is
|
|
75
|
+
definition is `for all` (x :: BigInt) . eval (Plus (Number 2) (Number 3)) = 5 end
|
|
76
|
+
end
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
unit example.arithmetic
|
|
2
|
+
|
|
3
|
+
-- Index equations may use natural arithmetic: + - * div mod ^. Subtraction
|
|
4
|
+
-- never truncates, so `m - 1` requires m >= 1 of every value. A variable bound
|
|
5
|
+
-- by several fields makes those fields' indices equal.
|
|
6
|
+
type Row (n :: Natural) is
|
|
7
|
+
| End where n = 0
|
|
8
|
+
| Cell head :: Int8 tail :: Row m where n = m + 1
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
-- A perfect tree: both subtrees share one height.
|
|
12
|
+
type Perfect (n :: Natural) is
|
|
13
|
+
| Leaf value :: Int8 where n = 0
|
|
14
|
+
| Node left :: Perfect m right :: Perfect m where n = m + 1
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
-- A grid's index is its number of cells.
|
|
18
|
+
type Grid (n :: Natural) is
|
|
19
|
+
| Grid rows :: Row r columns :: Row c where n = r * c
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
-- Two halves of one length.
|
|
23
|
+
type Halves (n :: Natural) is
|
|
24
|
+
| Halves front :: Row m back :: Row m where n = m + m
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
-- The number of whole pairs, and the length after the first element.
|
|
28
|
+
type Pairs (n :: Natural) is
|
|
29
|
+
| Pairs items :: Row m where n = m div 2
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
type Rest (n :: Natural) is
|
|
33
|
+
| Rest items :: Row m where n = m - 1
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
mirror :: (tree :: Perfect n) -> (r :: Perfect n)
|
|
37
|
+
area :: (grid :: Grid n) -> BigInt
|
|
38
|
+
duplicate :: (xs :: Row m) -> (r :: Halves (m + m))
|
|
39
|
+
countPairs :: (xs :: Row m) -> (r :: Pairs (m div 2))
|
|
40
|
+
-- `k + 1` binds k to one less than the argument's length.
|
|
41
|
+
dropFirst :: (xs :: Row (k + 1)) -> (r :: Rest k)
|
|
42
|
+
|
|
43
|
+
-- Checked definitions. Matching a Node tells the prover its subtrees share a
|
|
44
|
+
-- height, so mirrorP's result height is proved; so is transposeG's, as r * c
|
|
45
|
+
-- and c * r are the same product. stackRows' claim, (r + r) * c = 2 * (r * c),
|
|
46
|
+
-- is beyond linear arithmetic: it is checked on each result instead.
|
|
47
|
+
definition mirrorP (tree :: Perfect n) :: Perfect n is
|
|
48
|
+
match tree with
|
|
49
|
+
| Leaf v -> Leaf v
|
|
50
|
+
| Node l r -> Node (mirrorP r) (mirrorP l)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
definition transposeG (grid :: Grid n) :: Grid n is
|
|
55
|
+
match grid with
|
|
56
|
+
| Grid rows columns -> Grid columns rows
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
definition appendRow (xs :: Row n) (ys :: Row m) :: Row (n + m) is
|
|
61
|
+
match xs with
|
|
62
|
+
| End -> ys
|
|
63
|
+
| Cell h t -> Cell h (appendRow t ys)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
definition stackRows (grid :: Grid n) :: Grid (2 * n) is
|
|
68
|
+
match grid with
|
|
69
|
+
| Grid rows columns -> Grid (appendRow rows rows) columns
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
law `mirror agrees with the proved definition` is
|
|
74
|
+
definition is
|
|
75
|
+
`for all` (tree :: Perfect 3) . mirror tree = mirrorP tree
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
law `transposing keeps the area` is
|
|
80
|
+
definition is
|
|
81
|
+
`for all` (grid :: Grid 12) . area (transposeG grid) = 12
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
law `stacking doubles the area` is
|
|
86
|
+
definition is
|
|
87
|
+
`for all` (grid :: Grid 6) . area (stackRows grid) = 12
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
-- Without an index claim, balanced trees are still generated directly, from a
|
|
92
|
+
-- few small heights; random trees would almost never be balanced.
|
|
93
|
+
law `mirroring twice restores a tree` is
|
|
94
|
+
definition is
|
|
95
|
+
`for all` (tree :: Perfect n) . mirror (mirror tree) = tree
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
law `mirroring keeps the height` is
|
|
100
|
+
definition is
|
|
101
|
+
`for all` (tree :: Perfect 3) . nOfPerfect (mirror tree) = 3
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
law `a grid of six cells` is
|
|
106
|
+
definition is
|
|
107
|
+
`for all` (grid :: Grid 6) . area grid = 6
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
-- Generation chooses rows and columns among the divisors of twelve.
|
|
112
|
+
law `the area is the index` is
|
|
113
|
+
definition is
|
|
114
|
+
`for all` (grid :: Grid 12) . area grid = nOfGrid grid
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
law `duplicating makes equal halves` is
|
|
119
|
+
definition is
|
|
120
|
+
`for all` (xs :: Row m) . nOfHalves (duplicate xs) = m + m
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
-- Generation gives both halves the same length.
|
|
125
|
+
law `halves of six` is
|
|
126
|
+
definition is
|
|
127
|
+
`for all` (halves :: Halves 6) . nOfHalves halves = 6
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
law `seven elements make three pairs` is
|
|
132
|
+
definition is
|
|
133
|
+
`for all` (xs :: Row 7) . nOfPairs (countPairs xs) = 3
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
-- A child may have a larger index than its parent: Pairs 2 holds four or five.
|
|
138
|
+
law `two pairs` is
|
|
139
|
+
definition is
|
|
140
|
+
`for all` (p :: Pairs 2) . nOfPairs p = 2
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
law `the rest is one shorter` is
|
|
145
|
+
definition is
|
|
146
|
+
`for all` (xs :: Row (k + 1)) . nOfRest (dropFirst xs) = k
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
law `the rest of three` is
|
|
151
|
+
definition is
|
|
152
|
+
`for all` (r :: Rest 3) . nOfRest r = 3
|
|
153
|
+
end
|
|
154
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
unit example.lists
|
|
2
|
+
|
|
3
|
+
reverse :: List Int32 -> List Int32
|
|
4
|
+
sort :: List Int32 -> List Int32
|
|
5
|
+
sorted :: List Int32 -> Bool
|
|
6
|
+
permutation :: List Int32 -> List Int32 -> Bool
|
|
7
|
+
echoMaybe :: Maybe (Maybe Bool) -> Maybe (Maybe Bool)
|
|
8
|
+
echoEither :: Either (List Int32) (Maybe Bool) -> Either (List Int32) (Maybe Bool)
|
|
9
|
+
echoNested :: List (Maybe (Either CodeUnit16 Bytes)) -> List (Maybe (Either CodeUnit16 Bytes))
|
|
10
|
+
|
|
11
|
+
law `list involution` (f :: List a -> List a) requires Eq a is
|
|
12
|
+
definition is `involution` f end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
law `reverse twice restores the list` is
|
|
16
|
+
definition is `list involution` reverse end
|
|
17
|
+
example `ordered input` is
|
|
18
|
+
x = [3, 1, 2]
|
|
19
|
+
expect reverse x = [2, 1, 3]
|
|
20
|
+
end
|
|
21
|
+
example `empty input` is x = [] expect reverse x = [] end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
law `sorting is idempotent` is
|
|
25
|
+
definition is `idempotent` sort end
|
|
26
|
+
example `duplicates` is x = [3, 1, 3] expect sort x = [1, 3, 3] end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
law `sort produces sorted output` is
|
|
30
|
+
definition is `for all` (xs :: List Int32) . sorted (sort xs) end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
law `sort preserves length` is
|
|
34
|
+
definition is `for all` (xs :: List Int32) . prelude.length (sort xs) = prelude.length xs end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
law `sort preserves elements` is
|
|
38
|
+
definition is `for all` (xs :: List Int32) . permutation (sort xs) xs end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
law `nonempty reversal preserves length` is
|
|
42
|
+
definition is
|
|
43
|
+
`for all` (xs :: List Int32 where prelude.length xs > 0) .
|
|
44
|
+
prelude.length (reverse xs) = prelude.length xs
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
law `Maybe preserves nested absence` is
|
|
49
|
+
definition is `for all` (x :: Maybe (Maybe Bool)) . echoMaybe x = x end
|
|
50
|
+
example `outer absence` is x = Nothing expect echoMaybe x = Nothing end
|
|
51
|
+
example `inner absence` is x = Just Nothing expect echoMaybe x = Just Nothing end
|
|
52
|
+
example `present` is x = Just (Just true) expect echoMaybe x = Just (Just true) end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
law `Either preserves branches` is
|
|
56
|
+
definition is `for all` (x :: Either (List Int32) (Maybe Bool)) . echoEither x = x end
|
|
57
|
+
example `left list` is x = Left [3, 1, 3] expect echoEither x = Left [3, 1, 3] end
|
|
58
|
+
example `right absence` is x = Right Nothing expect echoEither x = Right Nothing end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
law `nested raw values survive` is
|
|
62
|
+
definition is `for all` (xs :: List (Maybe (Either CodeUnit16 Bytes))) . echoNested xs = xs end
|
|
63
|
+
example `surrogate and octets` is
|
|
64
|
+
xs = [Nothing, Just (Left codeUnit16(55296)), Just (Right bytes([0, 255]))]
|
|
65
|
+
expect echoNested xs = [Nothing, Just (Left codeUnit16(55296)), Just (Right bytes([0, 255]))]
|
|
66
|
+
end
|
|
67
|
+
end
|
package/package.json
CHANGED
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]\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]\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]\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]\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
|
},
|