@@ -52,6 +52,7 @@ import Kore.Internal.TermLike (
52
52
SomeVariableName ,
53
53
TermLike ,
54
54
)
55
+ import Kore.JsonRpc.Types.Log qualified as KoreRpcLog
55
56
import Kore.Rewrite.Axiom.MatcherData (
56
57
MatchResult ,
57
58
)
@@ -270,8 +271,34 @@ instance Entry DebugAttemptEquation where
270
271
(srcLoc equation)
271
272
oneLineDoc (DebugAttemptEquationResult _ (Left _)) = " equation is not applicable"
272
273
oneLineDoc (DebugAttemptEquationResult _ (Right _)) = " equation is applicable"
273
- oneLineJson entry =
274
- JSON. object [" entry" JSON. .= Log. entryTypeText (Log. toEntry entry)]
274
+
275
+ oneLineJson = \ case
276
+ entry@ DebugAttemptEquation {} -> JSON. object [" entry" JSON. .= Log. entryTypeText (Log. toEntry entry)]
277
+ DebugAttemptEquationResult equation (Right _) ->
278
+ JSON. toJSON $
279
+ KoreRpcLog. Simplification
280
+ { originalTerm = Nothing
281
+ , originalTermIndex = Nothing
282
+ , result =
283
+ KoreRpcLog. Success
284
+ { rewrittenTerm = Nothing
285
+ , substitution = Nothing
286
+ , ruleId = fromMaybe " UNKNOWN" (Attribute. getUniqueId . Attribute. uniqueId . attributes $ equation)
287
+ }
288
+ , origin = KoreRpcLog. KoreRpc
289
+ }
290
+ DebugAttemptEquationResult equation (Left failureReason) ->
291
+ JSON. toJSON $
292
+ KoreRpcLog. Simplification
293
+ { originalTerm = Nothing
294
+ , originalTermIndex = Nothing
295
+ , result =
296
+ KoreRpcLog. Failure
297
+ { reason = (Pretty. renderText . Pretty. layoutOneLine) (pretty failureReason)
298
+ , _ruleId = Attribute. getUniqueId . Attribute. uniqueId . attributes $ equation
299
+ }
300
+ , origin = KoreRpcLog. KoreRpc
301
+ }
275
302
276
303
-- | Log the result of attempting to apply an 'Equation'.
277
304
debugAttemptEquationResult ::
0 commit comments