lawspec 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/CHANGELOG.md +109 -1
  2. package/NORMALIZATION-LICENSES.txt +296 -0
  3. package/README.md +13 -4
  4. package/api.mjs +0 -8
  5. package/bin/lawspec.mjs +114 -79
  6. package/build.json +99 -117
  7. package/core.wasm +2 -2
  8. package/core_jsffi.js +5 -0
  9. package/doctor.mjs +14 -4
  10. package/examples/native-payments/clojure/lawspec.json +1 -1
  11. package/examples/native-payments/csharp/lawspec.json +1 -1
  12. package/examples/native-payments/elixir/lawspec.json +1 -1
  13. package/examples/native-payments/erlang/lawspec.json +1 -1
  14. package/examples/native-payments/fsharp/lawspec.json +1 -1
  15. package/examples/native-payments/gleam/lawspec.json +1 -1
  16. package/examples/native-payments/go/lawspec.json +1 -1
  17. package/examples/native-payments/groovy/lawspec.json +1 -1
  18. package/examples/native-payments/haskell/lawspec.json +1 -1
  19. package/examples/native-payments/java/lawspec.json +1 -1
  20. package/examples/native-payments/javascript/lawspec.json +1 -1
  21. package/examples/native-payments/kotlin/lawspec.json +1 -1
  22. package/examples/native-payments/prolog/lawspec.json +20 -0
  23. package/examples/native-payments/prolog/src/domain/payments.pl +23 -0
  24. package/examples/native-payments/prolog/tests/domain/payment_generators.pl +17 -0
  25. package/examples/native-payments/python/lawspec.json +1 -1
  26. package/examples/native-payments/rust/lawspec.json +1 -1
  27. package/examples/native-payments/scala/lawspec.json +1 -1
  28. package/examples/native-payments/swift/lawspec.json +1 -1
  29. package/examples/native-payments/typescript/lawspec.json +1 -1
  30. package/examples/packages/orders/lawspec.json +1 -1
  31. package/examples/packages/orders/orders.lawspec +27 -25
  32. package/examples/packages/shop-domain/src/domain.lawspec +15 -14
  33. package/examples/packages/shop-tax-1/src/api.lawspec +1 -0
  34. package/examples/packages/shop-tax-1/src/rates.lawspec +1 -0
  35. package/examples/packages/shop-tax-2/src/api.lawspec +1 -0
  36. package/examples/packages/shop-tax-2/src/rates.lawspec +1 -0
  37. package/examples/rc1/authorization-snapshots.lawspec +24 -23
  38. package/examples/rc1/banner-filenames.lawspec +7 -6
  39. package/examples/rc1/bit-codec.lawspec +12 -11
  40. package/examples/rc1/bounded-witness-search.lawspec +52 -45
  41. package/examples/rc1/conflicting-requirements.lawspec +8 -7
  42. package/examples/rc1/constructive-witnesses.lawspec +40 -33
  43. package/examples/rc1/documentary-review.lawspec +9 -8
  44. package/examples/rc1/empty-domains.lawspec +16 -15
  45. package/examples/rc1/finite-integer-domains.lawspec +24 -23
  46. package/examples/rc1/law-metadata.lawspec +6 -5
  47. package/examples/rc1/native-payments.lawspec +17 -16
  48. package/examples/rc1/nesting/rrr.lawspec +4 -3
  49. package/examples/rc1/nesting/rru.lawspec +7 -6
  50. package/examples/rc1/nesting/rur.lawspec +7 -6
  51. package/examples/rc1/nesting/ruu.lawspec +10 -9
  52. package/examples/rc1/nesting/urr.lawspec +7 -6
  53. package/examples/rc1/nesting/uru.lawspec +10 -9
  54. package/examples/rc1/nesting/uur.lawspec +10 -9
  55. package/examples/rc1/nesting/uuu.lawspec +13 -12
  56. package/examples/rc1/order-workflow.lawspec +18 -17
  57. package/examples/rc1/parcel-measurements.lawspec +14 -13
  58. package/examples/rc1/picture-records.lawspec +6 -5
  59. package/examples/rc1/picture-tuples.lawspec +6 -5
  60. package/examples/rc1/record-payloads.lawspec +12 -11
  61. package/examples/rc1/recursive-records.lawspec +11 -10
  62. package/examples/rc1/refund-conformance.lawspec +7 -6
  63. package/examples/rc1/refund-policy.lawspec +15 -14
  64. package/examples/rc1/requirement-composition.lawspec +26 -25
  65. package/examples/rc1/structural-records.lawspec +13 -12
  66. package/examples/rc1-authoring.lawspec +6 -5
  67. package/examples/specs/abilities.lawspec +67 -65
  68. package/examples/specs/ability_imports.lawspec +58 -57
  69. package/examples/specs/actors.lawspec +23 -22
  70. package/examples/specs/algebra.lawspec +142 -141
  71. package/examples/specs/approvals.lawspec +19 -18
  72. package/examples/specs/async_bindings.lawspec +10 -9
  73. package/examples/specs/async_fetch.lawspec +12 -11
  74. package/examples/specs/atoi_codec.lawspec +16 -15
  75. package/examples/specs/boolean_flags.lawspec +10 -9
  76. package/examples/specs/builtins.lawspec +73 -72
  77. package/examples/specs/canonical_url.lawspec +14 -13
  78. package/examples/specs/collections.lawspec +153 -154
  79. package/examples/specs/composition.lawspec +70 -66
  80. package/examples/specs/concurrent_collections.lawspec +8 -7
  81. package/examples/specs/consistency.lawspec +4 -3
  82. package/examples/specs/contracts.lawspec +80 -79
  83. package/examples/specs/crypto.lawspec +26 -25
  84. package/examples/specs/ctc.lawspec +148 -0
  85. package/examples/specs/currying.lawspec +32 -31
  86. package/examples/specs/data_types.lawspec +50 -49
  87. package/examples/specs/distribution.lawspec +57 -56
  88. package/examples/specs/domain_modeling.lawspec +68 -47
  89. package/examples/specs/durations.lawspec +39 -38
  90. package/examples/specs/equivalent.lawspec +25 -24
  91. package/examples/specs/failures.lawspec +64 -63
  92. package/examples/specs/finite_data.lawspec +32 -31
  93. package/examples/specs/flow_stack.lawspec +64 -63
  94. package/examples/specs/gadt_expressions.lawspec +50 -49
  95. package/examples/specs/generation.lawspec +115 -114
  96. package/examples/specs/handler_bindings.lawspec +42 -40
  97. package/examples/specs/handles.lawspec +2 -1
  98. package/examples/specs/harness.lawspec +45 -43
  99. package/examples/specs/harness_testing.lawspec +18 -13
  100. package/examples/specs/indexed_arithmetic.lawspec +401 -126
  101. package/examples/specs/indexed_families.lawspec +182 -66
  102. package/examples/specs/keywords.lawspec +22 -21
  103. package/examples/specs/limits.lawspec +7 -6
  104. package/examples/specs/list_contracts.lawspec +121 -120
  105. package/examples/specs/list_refinements.lawspec +43 -42
  106. package/examples/specs/lists.lawspec +45 -44
  107. package/examples/specs/matchers.lawspec +79 -78
  108. package/examples/specs/matching.lawspec +43 -42
  109. package/examples/specs/mixed_inputs.lawspec +25 -24
  110. package/examples/specs/models.lawspec +44 -43
  111. package/examples/specs/parse_port.lawspec +28 -27
  112. package/examples/specs/payments.lawspec +55 -54
  113. package/examples/specs/railway.lawspec +59 -58
  114. package/examples/specs/records.lawspec +149 -148
  115. package/examples/specs/records_inner.lawspec +5 -4
  116. package/examples/specs/recursive_refinements.lawspec +30 -29
  117. package/examples/specs/refined_definitions.lawspec +24 -23
  118. package/examples/specs/refinements.lawspec +58 -57
  119. package/examples/specs/resilience.lawspec +161 -160
  120. package/examples/specs/resources.lawspec +61 -60
  121. package/examples/specs/scalar_adapters.lawspec +60 -59
  122. package/examples/specs/scalar_catalog.lawspec +165 -164
  123. package/examples/specs/scalars.lawspec +78 -77
  124. package/examples/specs/scheduling_order.lawspec +8 -7
  125. package/examples/specs/scheduling_overlap.lawspec +5 -4
  126. package/examples/specs/sequences.lawspec +66 -65
  127. package/examples/specs/sessions.lawspec +13 -12
  128. package/examples/specs/slug.lawspec +16 -15
  129. package/examples/specs/sum_refinements.lawspec +42 -41
  130. package/examples/specs/tables.lawspec +29 -28
  131. package/examples/specs/total_functions.lawspec +71 -70
  132. package/examples/specs/workflows.lawspec +101 -100
  133. package/examples-command.mjs +7 -7
  134. package/explain.mjs +6 -4
  135. package/expression-presentation.mjs +8 -8
  136. package/files.mjs +1 -1
  137. package/index.d.ts +10 -528
  138. package/launcher.mjs +9 -2
  139. package/lsp.mjs +10 -6
  140. package/native-evidence.mjs +25 -12
  141. package/native-examples.mjs +3 -3
  142. package/package.json +2 -1
  143. package/starter-rc1.lawspec +6 -5
  144. package/starter.lawspec +16 -15
  145. package/templates.mjs +88 -5
  146. package/test-command.mjs +40 -4
  147. package/migrate.mjs +0 -135
  148. package/migration-bindings.mjs +0 -86
  149. package/migration-cases.mjs +0 -45
  150. package/migration-collections.mjs +0 -54
  151. package/migration-correspondence.mjs +0 -275
  152. package/migration-generation.mjs +0 -99
  153. package/migration-laws.mjs +0 -102
  154. package/migration-records.mjs +0 -166
  155. package/migration-source.mjs +0 -247
  156. package/migration-write.mjs +0 -156
@@ -4,7 +4,7 @@ echoCodePoint :: CodePoint -> CodePoint
4
4
  echoCodeUnit :: CodeUnit16 -> CodeUnit16
5
5
  echoBytes :: Bytes -> Bytes
6
6
  echoComplex :: Complex64 -> Complex64
7
- successor :: Int8 -> BigInt
7
+ successor :: Int8 -> Integer
8
8
  narrow :: Int8 -> Int8
9
9
  addDecimal :: Decimal -> Decimal -> Decimal
10
10
  sameSymbol :: Symbol -> Symbol -> Bool
@@ -14,70 +14,71 @@ finish :: Unit -> Unit
14
14
  preserveBig :: UInt64 -> UInt64
15
15
  machineEcho :: IntSize -> IntSize
16
16
 
17
- law `promoted successor` is
18
- definition is `for all` (x :: Int8) . successor x = x + 1 end
19
- example `no overflow` is x = 127 expect successor x = 128 end
20
- end
21
- law `checked bridge` is
22
- definition is `for all` (x :: Int8) . narrow (x + 0) = x end
23
- example `maximum` is x = 127 expect narrow (x + 0) = 127 end
24
- end
25
- law `exact decimal adapter` is
26
- definition is `for all` (x :: Decimal) (y :: Decimal) . addDecimal x y = x + y end
27
- example `tenths` is x = 0.1 y = 0.2 expect addDecimal x y = 0.3 end
28
- end
29
- law `symbol identity adapter` is
30
- definition is `for all` (x :: Symbol) (y :: Symbol) . sameSymbol x x and sameSymbol y y end
31
- example `same description distinct identities` is
17
+ law "|promoted successor| is
18
+ definition : for all (x :: Int8) => successor x = x + 1 end for all end definition
19
+ example "|no overflow| : x = 127 expect successor x = 128 end example
20
+ end law
21
+ law "|checked bridge| is
22
+ definition : for all (x :: Int8) => narrow (x + 0) = x end for all end definition
23
+ example "|maximum| : x = 127 expect narrow (x + 0) = 127 end example
24
+ end law
25
+ law "|exact decimal adapter| is
26
+ definition : for all (x :: Decimal) (y :: Decimal) => addDecimal x y = x + y end for all end definition
27
+ example "|tenths| : x = 0.1 y = 0.2 expect addDecimal x y = 0.3 end example
28
+ end law
29
+ law "|symbol identity adapter| is
30
+ definition : for all (x :: Symbol) (y :: Symbol) => sameSymbol x x and sameSymbol y y end for all end definition
31
+ example "|same description distinct identities| :
32
32
  x = symbol("a", "same") y = symbol("b", "same")
33
33
  expect sameSymbol x y = false
34
34
  expect sameSymbol x x = true
35
- end
36
- end
37
- law `raw adapter` is
38
- definition is `for all` (x :: Utf16Text) . echoRaw x = x end
39
- example `lone surrogate` is x = utf16([55296]) expect echoRaw x = utf16([55296]) end
40
- end
41
- law `presence adapter` is
42
- definition is `for all` (x :: Optional (Nullable Int8)) . echoPresence x = x end
43
- example `missing` is x = undefined expect echoPresence x = undefined end
44
- example `null present` is x = optional(null) expect echoPresence x = optional(null) end
45
- end
46
- law `unit adapter` is
47
- definition is `for all` (x :: Unit) . finish x = unitValue end
48
- example `completed` is x = unitValue expect finish x = unitValue end
49
- end
35
+ end example
36
+ end law
37
+ law "|raw adapter| is
38
+ definition : for all (x :: Utf16Text) => echoRaw x = x end for all end definition
39
+ example "|lone surrogate| : x = utf16([55296]) expect echoRaw x = utf16([55296]) end example
40
+ end law
41
+ law "|presence adapter| is
42
+ definition : for all (x :: Optional (Nullable Int8)) => echoPresence x = x end for all end definition
43
+ example "|missing| : x = undefined expect echoPresence x = undefined end example
44
+ example "|null present| : x = optional(null) expect echoPresence x = optional(null) end example
45
+ end law
46
+ law "|unit adapter| is
47
+ definition : for all (x :: Unit) => finish x = unitValue end for all end definition
48
+ example "|completed| : x = unitValue expect finish x = unitValue end example
49
+ end law
50
50
 
51
- law `no safe-number truncation` is
52
- definition is `for all` (x :: UInt64) . preserveBig x = x end
53
- example `unsigned maximum` is x = 18446744073709551615 expect preserveBig x = 18446744073709551615 end
54
- end
55
- law `machine profile binding` is
56
- definition is `for all` (x :: IntSize) . machineEcho x = x end
57
- example `portable width` is x = 2147483647 expect machineEcho x = 2147483647 end
58
- end
51
+ law "|no safe-number truncation| is
52
+ definition : for all (x :: UInt64) => preserveBig x = x end for all end definition
53
+ example "|unsigned maximum| : x = 18446744073709551615 expect preserveBig x = 18446744073709551615 end example
54
+ end law
55
+ law "|machine profile binding| is
56
+ definition : for all (x :: IntSize) => machineEcho x = x end for all end definition
57
+ example "|portable width| : x = 2147483647 expect machineEcho x = 2147483647 end example
58
+ end law
59
59
 
60
- law `Char native bridge` is
61
- definition is `for all` (x :: Char) . echoChar x = x end
62
- example `native value` is x = char(128512) expect echoChar x = char(128512) end
63
- end
60
+ law "|Char native bridge| is
61
+ definition : for all (x :: Char) => echoChar x = x end for all end definition
62
+ example "|native value| : x = char(128512) expect echoChar x = char(128512) end example
63
+ end law
64
64
 
65
- law `CodePoint native bridge` is
66
- definition is `for all` (x :: CodePoint) . echoCodePoint x = x end
67
- example `native value` is x = codePoint(55296) expect echoCodePoint x = codePoint(55296) end
68
- end
65
+ law "|CodePoint native bridge| is
66
+ definition : for all (x :: CodePoint) => echoCodePoint x = x end for all end definition
67
+ example "|native value| : x = codePoint(55296) expect echoCodePoint x = codePoint(55296) end example
68
+ end law
69
69
 
70
- law `CodeUnit16 native bridge` is
71
- definition is `for all` (x :: CodeUnit16) . echoCodeUnit x = x end
72
- example `native value` is x = codeUnit16(65535) expect echoCodeUnit x = codeUnit16(65535) end
73
- end
70
+ law "|CodeUnit16 native bridge| is
71
+ definition : for all (x :: CodeUnit16) => echoCodeUnit x = x end for all end definition
72
+ example "|native value| : x = codeUnit16(65535) expect echoCodeUnit x = codeUnit16(65535) end example
73
+ end law
74
74
 
75
- law `Bytes native bridge` is
76
- definition is `for all` (x :: Bytes) . echoBytes x = x end
77
- example `native value` is x = bytes([0,128,255]) expect echoBytes x = bytes([0,128,255]) end
78
- end
75
+ law "|Bytes native bridge| is
76
+ definition : for all (x :: Bytes) => echoBytes x = x end for all end definition
77
+ example "|native value| : x = bytes([0,128,255]) expect echoBytes x = bytes([0,128,255]) end example
78
+ end law
79
79
 
80
- law `Complex64 native bridge` is
81
- definition is `for all` (x :: Complex64) . prelude.isNaN (prelude.real (echoComplex x)) = prelude.isNaN (prelude.real x) end
82
- example `native value` is x = complex64(1,2) expect echoComplex x = complex64(1,2) end
83
- end
80
+ law "|Complex64 native bridge| is
81
+ definition : for all (x :: Complex64) => prelude.isNaN (prelude.real (echoComplex x)) = prelude.isNaN (prelude.real x) end for all end definition
82
+ example "|native value| : x = complex64(1,2) expect echoComplex x = complex64(1,2) end example
83
+ end law
84
+ end unit
@@ -1,166 +1,167 @@
1
1
  unit example.scalar_catalog
2
2
 
3
- law `Bool representation` is
4
- definition is `for all` (x :: Bool) . x = x end
5
- example `explicit value` is x = true expect x = true end
6
- end
7
-
8
- law `Int8 representation` is
9
- definition is `for all` (x :: Int8) . x = x end
10
- example `explicit value` is x = -128 expect x = -128 end
11
- end
12
-
13
- law `Int16 representation` is
14
- definition is `for all` (x :: Int16) . x = x end
15
- example `explicit value` is x = 32767 expect x = 32767 end
16
- end
17
-
18
- law `Int32 representation` is
19
- definition is `for all` (x :: Int32) . x = x end
20
- example `explicit value` is x = 2147483647 expect x = 2147483647 end
21
- end
22
-
23
- law `Int64 representation` is
24
- definition is `for all` (x :: Int64) . x = x end
25
- example `explicit value` is x = 9223372036854775807 expect x = 9223372036854775807 end
26
- end
27
-
28
- law `UInt8 representation` is
29
- definition is `for all` (x :: UInt8) . x = x end
30
- example `explicit value` is x = 255 expect x = 255 end
31
- end
32
-
33
- law `UInt16 representation` is
34
- definition is `for all` (x :: UInt16) . x = x end
35
- example `explicit value` is x = 65535 expect x = 65535 end
36
- end
37
-
38
- law `UInt32 representation` is
39
- definition is `for all` (x :: UInt32) . x = x end
40
- example `explicit value` is x = 4294967295 expect x = 4294967295 end
41
- end
42
-
43
- law `UInt64 representation` is
44
- definition is `for all` (x :: UInt64) . x = x end
45
- example `explicit value` is x = 18446744073709551615 expect x = 18446744073709551615 end
46
- end
47
-
48
- law `IntSize representation` is
49
- definition is `for all` (x :: IntSize) . x = x end
50
- example `explicit value` is x = 2147483647 expect x = 2147483647 end
51
- end
52
-
53
- law `UIntSize representation` is
54
- definition is `for all` (x :: UIntSize) . x = x end
55
- example `explicit value` is x = 4294967295 expect x = 4294967295 end
56
- end
57
-
58
- law `UIntPtr representation` is
59
- definition is `for all` (x :: UIntPtr) . x = x end
60
- example `explicit value` is x = 4294967295 expect x = 4294967295 end
61
- end
62
-
63
- law `BigInt representation` is
64
- definition is `for all` (x :: BigInt) . x = x end
65
- example `explicit value` is x = -1234567890123456789012345678901234567890 expect x = -1234567890123456789012345678901234567890 end
66
- end
67
-
68
- law `BigUInt representation` is
69
- definition is `for all` (x :: BigUInt) . x = x end
70
- example `explicit value` is x = 1234567890123456789012345678901234567890 expect x = 1234567890123456789012345678901234567890 end
71
- end
72
-
73
- law `Decimal representation` is
74
- definition is `for all` (x :: Decimal) . x = x end
75
- example `explicit value` is x = 0.000000000000000000000000000000000001 expect x = 0.000000000000000000000000000000000001 end
76
- end
77
-
78
- law `Rational representation` is
79
- definition is `for all` (x :: Rational) . x = x end
80
- example `explicit value` is x = rational(-7, 11) expect x = rational(-7, 11) end
81
- end
82
-
83
- law `Float32 representation` is
84
- definition is `for all` (x :: Float32) . prelude.isNaN x = prelude.isNaN x end
85
- example `explicit value` is x = float32Bits("80000000") expect x = float32Bits("80000000") end
86
- end
87
-
88
- law `Float64 representation` is
89
- definition is `for all` (x :: Float64) . prelude.isNaN x = prelude.isNaN x end
90
- example `explicit value` is x = float64Bits("7ff0000000000000") expect x = float64Bits("7ff0000000000000") end
91
- end
92
-
93
- law `Complex64 representation` is
94
- definition is `for all` (x :: Complex64) . prelude.isNaN (prelude.real x) = prelude.isNaN (prelude.real x) end
95
- example `explicit value` is x = complex64(1, -2) expect x = complex64(1, -2) end
96
- end
97
-
98
- law `Complex128 representation` is
99
- definition is `for all` (x :: Complex128) . prelude.isNaN (prelude.real x) = prelude.isNaN (prelude.real x) end
100
- example `explicit value` is x = complex128(0.5, -3.5) expect x = complex128(0.5, -3.5) end
101
- end
102
-
103
- law `Char representation` is
104
- definition is `for all` (x :: Char) . x = x end
105
- example `explicit value` is x = char(128512) expect x = char(128512) end
106
- end
107
-
108
- law `CodePoint representation` is
109
- definition is `for all` (x :: CodePoint) . x = x end
110
- example `explicit value` is x = codePoint(55296) expect x = codePoint(55296) end
111
- end
112
-
113
- law `CodeUnit16 representation` is
114
- definition is `for all` (x :: CodeUnit16) . x = x end
115
- example `explicit value` is x = codeUnit16(65535) expect x = codeUnit16(65535) end
116
- end
117
-
118
- law `Text representation` is
119
- definition is `for all` (x :: Text) . x = x end
120
- example `explicit value` is x = "λ日本語😀" expect x = "λ日本語😀" end
121
- end
122
-
123
- law `CodePointText representation` is
124
- definition is `for all` (x :: CodePointText) . x = x end
125
- example `explicit value` is x = codePoints([55296, 1114111]) expect x = codePoints([55296, 1114111]) end
126
- end
127
-
128
- law `Utf16Text representation` is
129
- definition is `for all` (x :: Utf16Text) . x = x end
130
- example `explicit value` is x = utf16([55296, 0, 65535]) expect x = utf16([55296, 0, 65535]) end
131
- end
132
-
133
- law `Bytes representation` is
134
- definition is `for all` (x :: Bytes) . x = x end
135
- example `explicit value` is x = bytes([0, 128, 255]) expect x = bytes([0, 128, 255]) end
136
- end
137
-
138
- law `Symbol representation` is
139
- definition is `for all` (x :: Symbol) . x = x end
140
- example `explicit value` is x = symbol("catalog", "same") expect x = symbol("catalog", "same") end
141
- end
142
-
143
- law `Unit representation` is
144
- definition is `for all` (x :: Unit) . x = x end
145
- example `explicit value` is x = unitValue expect x = unitValue end
146
- end
147
-
148
- law `Null representation` is
149
- definition is `for all` (x :: Null) . x = x end
150
- example `explicit value` is x = null expect x = null end
151
- end
152
-
153
- law `Undefined representation` is
154
- definition is `for all` (x :: Undefined) . x = x end
155
- example `explicit value` is x = undefined expect x = undefined end
156
- end
157
-
158
- law `Nullable Int8 representation` is
159
- definition is `for all` (x :: Nullable Int8) . x = x end
160
- example `explicit value` is x = nullable(127) expect x = nullable(127) end
161
- end
162
-
163
- law `Optional Int8 representation` is
164
- definition is `for all` (x :: Optional Int8) . x = x end
165
- example `explicit value` is x = undefined expect x = undefined end
166
- end
3
+ law "|Bool representation| is
4
+ definition : for all (x :: Bool) => x = x end for all end definition
5
+ example "|explicit value| : x = true expect x = true end example
6
+ end law
7
+
8
+ law "|Int8 representation| is
9
+ definition : for all (x :: Int8) => x = x end for all end definition
10
+ example "|explicit value| : x = -128 expect x = -128 end example
11
+ end law
12
+
13
+ law "|Int16 representation| is
14
+ definition : for all (x :: Int16) => x = x end for all end definition
15
+ example "|explicit value| : x = 32767 expect x = 32767 end example
16
+ end law
17
+
18
+ law "|Int32 representation| is
19
+ definition : for all (x :: Int32) => x = x end for all end definition
20
+ example "|explicit value| : x = 2147483647 expect x = 2147483647 end example
21
+ end law
22
+
23
+ law "|Int64 representation| is
24
+ definition : for all (x :: Int64) => x = x end for all end definition
25
+ example "|explicit value| : x = 9223372036854775807 expect x = 9223372036854775807 end example
26
+ end law
27
+
28
+ law "|UInt8 representation| is
29
+ definition : for all (x :: UInt8) => x = x end for all end definition
30
+ example "|explicit value| : x = 255 expect x = 255 end example
31
+ end law
32
+
33
+ law "|UInt16 representation| is
34
+ definition : for all (x :: UInt16) => x = x end for all end definition
35
+ example "|explicit value| : x = 65535 expect x = 65535 end example
36
+ end law
37
+
38
+ law "|UInt32 representation| is
39
+ definition : for all (x :: UInt32) => x = x end for all end definition
40
+ example "|explicit value| : x = 4294967295 expect x = 4294967295 end example
41
+ end law
42
+
43
+ law "|UInt64 representation| is
44
+ definition : for all (x :: UInt64) => x = x end for all end definition
45
+ example "|explicit value| : x = 18446744073709551615 expect x = 18446744073709551615 end example
46
+ end law
47
+
48
+ law "|IntSize representation| is
49
+ definition : for all (x :: IntSize) => x = x end for all end definition
50
+ example "|explicit value| : x = 2147483647 expect x = 2147483647 end example
51
+ end law
52
+
53
+ law "|UIntSize representation| is
54
+ definition : for all (x :: UIntSize) => x = x end for all end definition
55
+ example "|explicit value| : x = 4294967295 expect x = 4294967295 end example
56
+ end law
57
+
58
+ law "|UIntPtr representation| is
59
+ definition : for all (x :: UIntPtr) => x = x end for all end definition
60
+ example "|explicit value| : x = 4294967295 expect x = 4294967295 end example
61
+ end law
62
+
63
+ law "|BigInt representation| is
64
+ definition : for all (x :: Integer) => x = x end for all end definition
65
+ example "|explicit value| : x = -1234567890123456789012345678901234567890 expect x = -1234567890123456789012345678901234567890 end example
66
+ end law
67
+
68
+ law "|BigUInt representation| is
69
+ definition : for all (x :: Whole) => x = x end for all end definition
70
+ example "|explicit value| : x = 1234567890123456789012345678901234567890 expect x = 1234567890123456789012345678901234567890 end example
71
+ end law
72
+
73
+ law "|Decimal representation| is
74
+ definition : for all (x :: Decimal) => x = x end for all end definition
75
+ example "|explicit value| : x = 0.000000000000000000000000000000000001 expect x = 0.000000000000000000000000000000000001 end example
76
+ end law
77
+
78
+ law "|Rational representation| is
79
+ definition : for all (x :: Rational) => x = x end for all end definition
80
+ example "|explicit value| : x = rational(-7, 11) expect x = rational(-7, 11) end example
81
+ end law
82
+
83
+ law "|Float32 representation| is
84
+ definition : for all (x :: Float32) => prelude.isNaN x = prelude.isNaN x end for all end definition
85
+ example "|explicit value| : x = float32Bits("80000000") expect x = float32Bits("80000000") end example
86
+ end law
87
+
88
+ law "|Float64 representation| is
89
+ definition : for all (x :: Float64) => prelude.isNaN x = prelude.isNaN x end for all end definition
90
+ example "|explicit value| : x = float64Bits("7ff0000000000000") expect x = float64Bits("7ff0000000000000") end example
91
+ end law
92
+
93
+ law "|Complex64 representation| is
94
+ definition : for all (x :: Complex64) => prelude.isNaN (prelude.real x) = prelude.isNaN (prelude.real x) end for all end definition
95
+ example "|explicit value| : x = complex64(1, -2) expect x = complex64(1, -2) end example
96
+ end law
97
+
98
+ law "|Complex128 representation| is
99
+ definition : for all (x :: Complex128) => prelude.isNaN (prelude.real x) = prelude.isNaN (prelude.real x) end for all end definition
100
+ example "|explicit value| : x = complex128(0.5, -3.5) expect x = complex128(0.5, -3.5) end example
101
+ end law
102
+
103
+ law "|Char representation| is
104
+ definition : for all (x :: Char) => x = x end for all end definition
105
+ example "|explicit value| : x = char(128512) expect x = char(128512) end example
106
+ end law
107
+
108
+ law "|CodePoint representation| is
109
+ definition : for all (x :: CodePoint) => x = x end for all end definition
110
+ example "|explicit value| : x = codePoint(55296) expect x = codePoint(55296) end example
111
+ end law
112
+
113
+ law "|CodeUnit16 representation| is
114
+ definition : for all (x :: CodeUnit16) => x = x end for all end definition
115
+ example "|explicit value| : x = codeUnit16(65535) expect x = codeUnit16(65535) end example
116
+ end law
117
+
118
+ law "|Text representation| is
119
+ definition : for all (x :: Text) => x = x end for all end definition
120
+ example "|explicit value| : x = "λ日本語😀" expect x = "λ日本語😀" end example
121
+ end law
122
+
123
+ law "|CodePointText representation| is
124
+ definition : for all (x :: CodePointText) => x = x end for all end definition
125
+ example "|explicit value| : x = codePoints([55296, 1114111]) expect x = codePoints([55296, 1114111]) end example
126
+ end law
127
+
128
+ law "|Utf16Text representation| is
129
+ definition : for all (x :: Utf16Text) => x = x end for all end definition
130
+ example "|explicit value| : x = utf16([55296, 0, 65535]) expect x = utf16([55296, 0, 65535]) end example
131
+ end law
132
+
133
+ law "|Bytes representation| is
134
+ definition : for all (x :: Bytes) => x = x end for all end definition
135
+ example "|explicit value| : x = bytes([0, 128, 255]) expect x = bytes([0, 128, 255]) end example
136
+ end law
137
+
138
+ law "|Symbol representation| is
139
+ definition : for all (x :: Symbol) => x = x end for all end definition
140
+ example "|explicit value| : x = symbol("catalog", "same") expect x = symbol("catalog", "same") end example
141
+ end law
142
+
143
+ law "|Unit representation| is
144
+ definition : for all (x :: Unit) => x = x end for all end definition
145
+ example "|explicit value| : x = unitValue expect x = unitValue end example
146
+ end law
147
+
148
+ law "|Null representation| is
149
+ definition : for all (x :: Null) => x = x end for all end definition
150
+ example "|explicit value| : x = null expect x = null end example
151
+ end law
152
+
153
+ law "|Undefined representation| is
154
+ definition : for all (x :: Undefined) => x = x end for all end definition
155
+ example "|explicit value| : x = undefined expect x = undefined end example
156
+ end law
157
+
158
+ law "|Nullable Int8 representation| is
159
+ definition : for all (x :: Nullable Int8) => x = x end for all end definition
160
+ example "|explicit value| : x = nullable(127) expect x = nullable(127) end example
161
+ end law
162
+
163
+ law "|Optional Int8 representation| is
164
+ definition : for all (x :: Optional Int8) => x = x end for all end definition
165
+ example "|explicit value| : x = undefined expect x = undefined end example
166
+ end law
167
+ end unit