Skip to content

Commit 5e20b14

Browse files
improve showR
1 parent 4efc47d commit 5e20b14

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

quickcheck-dynamic/src/Test/QuickCheck/ParallelActions.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,19 @@ monitorTrace :: forall state m. (StateModel state, RunModelPar state m)
170170
=> VarContext -> Env -> Trace state m -> PropertyM m ()
171171
monitorTrace _used _env [] = pure ()
172172
monitorTrace used env (TraceStep r v act : tr) = do
173-
let showR (Right x) = show x
173+
let showR (Right x)
174+
| v `wellTypedIn` used = show v ++ "@" ++ showsPrec 10 x ""
175+
| otherwise = show x
174176
showR (Left err) = "fail " ++ showsPrec 10 err ""
175-
pre | v `wellTypedIn` used = show v ++ " @ "
176-
| otherwise = ""
177-
monitor $ counterexample (pre ++ showR r ++ " <- " ++ show (polarAction act))
177+
monitor $ counterexample (showR r ++ " <- " ++ show (polarAction act))
178178
monitor $ monitoringPar @state @m (polarAction act) (lookUpVar env) r
179179
monitorTrace used env' tr
180180
where
181181
env' | Right val <- r = (v :== val) : env
182182
| otherwise = env
183183

184-
checkTrace :: forall state m. (StateModel state, RunModelPar state m) => Annotated state -> Env -> TraceTree state m -> Bool
184+
checkTrace :: forall state m. (StateModel state, RunModelPar state m)
185+
=> Annotated state -> Env -> TraceTree state m -> Bool
185186
checkTrace s env (Node (TraceStep r v (ActionWithPolarity a _)) trs) =
186187
-- NOTE: we need to re-compute the polarity of `a` here because it may be that the failure can be explained,
187188
-- but only by the action failing when it was previous successful

0 commit comments

Comments
 (0)