@@ -56,20 +56,12 @@ invariant name e p = void . interpret notChecked ((:[]) . e) p'
56
56
notChecked :: History h a
57
57
-> InvalidInput h a
58
58
-> InvariantViolation h a
59
- notChecked history reason = InvariantNotChecked {
60
- invariantNotCheckedName = name
61
- , invariantNotCheckedReason = reason
62
- , invariantNotCheckedEvents = history
63
- }
59
+ notChecked history reason = InvariantNotChecked name reason history
64
60
65
61
violation :: History h a
66
62
-> InvariantViolationEvidence
67
63
-> InvariantViolation h a
68
- violation history ev = InvariantViolation {
69
- invariantViolationName = name
70
- , invariantViolationEvidence = ev
71
- , invariantViolationEvents = history
72
- }
64
+ violation history ev = InvariantViolation name ev history
73
65
74
66
p' :: History h a
75
67
-> [Wallet h a ]
@@ -82,28 +74,18 @@ invariant name e p = void . interpret notChecked ((:[]) . e) p'
82
74
-- | Invariant violation
83
75
data InvariantViolation h a =
84
76
-- | Invariance violation
85
- InvariantViolation {
86
- -- | Name of the invariant
87
- invariantViolationName :: Text
88
-
89
- -- | Evidence that the invariant was violated
90
- , invariantViolationEvidence :: InvariantViolationEvidence
91
-
92
- -- | The evens that led to the error
93
- , invariantViolationEvents :: History h a
94
- }
77
+ -- invariantViolationName = Name of the invariant
78
+ -- invariantViolationEvidence = Evidence that the invariant
79
+ -- was violated
80
+ -- invariantViolationEvents = The evennts that led to the error
81
+ InvariantViolation ! Text ! InvariantViolationEvidence ! (History h a )
95
82
96
83
-- | The invariant was not checked because the input was invalid
97
- | InvariantNotChecked {
98
- -- | Name of the invariant
99
- invariantNotCheckedName :: Text
100
-
101
- -- | Why did we not check the invariant
102
- , invariantNotCheckedReason :: InvalidInput h a
103
-
104
- -- | The events that led to the error
105
- , invariantNotCheckedEvents :: History h a
106
- }
84
+ -- InvariantNotChecked
85
+ -- invariantNotCheckedName = Name of the invariant
86
+ -- invariantNotCheckedReason = Why did we not check the invariant
87
+ -- invariantNotCheckedEvents = The events that led to the error
88
+ | InvariantNotChecked ! Text ! (InvalidInput h a ) ! (History h a )
107
89
108
90
{- ------------------------------------------------------------------------------
109
91
Evidence that an invariant was violated
@@ -288,20 +270,12 @@ walletEquivalent lbl e e' = void .
288
270
notChecked :: History h a
289
271
-> InvalidInput h a
290
272
-> InvariantViolation h a
291
- notChecked history reason = InvariantNotChecked {
292
- invariantNotCheckedName = lbl
293
- , invariantNotCheckedReason = reason
294
- , invariantNotCheckedEvents = history
295
- }
273
+ notChecked history reason = InvariantNotChecked lbl reason history
296
274
297
275
violation :: History h a
298
276
-> InvariantViolationEvidence
299
277
-> InvariantViolation h a
300
- violation history ev = InvariantViolation {
301
- invariantViolationName = lbl
302
- , invariantViolationEvidence = ev
303
- , invariantViolationEvents = history
304
- }
278
+ violation history ev = InvariantViolation lbl ev history
305
279
306
280
p :: History h a
307
281
-> [Wallet h a ]
@@ -332,7 +306,10 @@ walletEquivalent lbl e e' = void .
332
306
-------------------------------------------------------------------------------}
333
307
334
308
instance (Hash h a , Buildable a ) => Buildable (InvariantViolation h a ) where
335
- build InvariantViolation {.. } = bprint
309
+ build (InvariantViolation
310
+ invariantViolationName
311
+ invariantViolationEvidence
312
+ invariantViolationEvents) = bprint
336
313
( " InvariantViolation "
337
314
% " { name: " % build
338
315
% " , evidence: " % build
@@ -342,7 +319,10 @@ instance (Hash h a, Buildable a) => Buildable (InvariantViolation h a) where
342
319
invariantViolationName
343
320
invariantViolationEvidence
344
321
invariantViolationEvents
345
- build (InvariantNotChecked {.. }) = bprint
322
+ build (InvariantNotChecked
323
+ invariantNotCheckedName
324
+ invariantNotCheckedReason
325
+ invariantNotCheckedEvents) = bprint
346
326
( " InvariantNotChecked "
347
327
% " { name: " % build
348
328
% " , reason: " % build
0 commit comments