2 | import public Text.Show.Diff
3 | import Text.Show.Pretty
8 | renderLineDiffPlain : LineDiff -> String
9 | renderLineDiffPlain (LineSame x) = " " ++ x
10 | renderLineDiffPlain (LineRemoved x) = "- " ++ x
11 | renderLineDiffPlain (LineAdded x) = "+ " ++ x
16 | structuralDiff : (expected : String) -> (actual : String) -> Maybe (List LineDiff)
17 | structuralDiff expected actual = do
18 | ve <- parseValue expected
19 | va <- parseValue actual
21 | Just $
toLineDiff (valueDiff ve va)
27 | failureDiff : FailureInfo -> Maybe (String, List LineDiff)
28 | failureDiff (ExpectedButGot reason expected actual) = do
29 | diffs <- structuralDiff expected actual
30 | Just (reason, diffs)
31 | failureDiff _ = Nothing