Skip to content

Commit 3e76069

Browse files
committed
Output booster-kore simplification diff with some context
1 parent 1103673 commit 3e76069

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

booster/library/Booster/JsonRpc/Utils.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,15 @@ methodOfRpcCall = \case
224224
renderDiff :: BS.ByteString -> BS.ByteString -> Maybe String
225225
renderDiff first second
226226
| first == second = Nothing
227-
renderDiff first second = unsafePerformIO . withTempDir $ \dir -> do
227+
| otherwise = renderDiff' ["-w"] first second
228+
229+
renderDiff' :: [String] -> BS.ByteString -> BS.ByteString -> Maybe String
230+
renderDiff' diffOptions first second = unsafePerformIO . withTempDir $ \dir -> do
228231
let path1 = dir </> "diff_file1.txt"
229232
path2 = dir </> "diff_file2.txt"
230233
BS.writeFile path1 first
231234
BS.writeFile path2 second
232-
(result, str, _) <- readProcessWithExitCode "diff" ["-w", path1, path2] ""
235+
(result, str, _) <- readProcessWithExitCode "diff" (diffOptions <> [path1, path2]) ""
233236
case result of
234237
ExitSuccess -> pure Nothing
235238
ExitFailure 1 -> pure $ Just str
@@ -240,7 +243,7 @@ renderDiff first second = unsafePerformIO . withTempDir $ \dir -> do
240243
-- This uses the `pretty` instance for a textual diff.
241244
diffBy :: Internal.KoreDefinition -> KorePattern -> KorePattern -> Maybe String
242245
diffBy def pat1 pat2 =
243-
renderDiff (internalise pat1) (internalise pat2)
246+
renderDiff' ["-c", "-w"] (internalise pat1) (internalise pat2)
244247
where
245248
renderBS :: TermOrPredicates -> BS.ByteString
246249
renderBS (Predicates ps) =

0 commit comments

Comments
 (0)