From 41054fe5657fcee0dec17a353013dce54f7aa4bc Mon Sep 17 00:00:00 2001
From: Christian Gram Kalhauge <chrg@dtu.dk>
Date: Thu, 29 Feb 2024 09:36:20 +0100
Subject: [PATCH] Quality of life stuff

---
 rtree-c/bin/Main.hs | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/rtree-c/bin/Main.hs b/rtree-c/bin/Main.hs
index 93067c6..2d189de 100644
--- a/rtree-c/bin/Main.hs
+++ b/rtree-c/bin/Main.hs
@@ -11,6 +11,7 @@ import ReduceC
 import Colog
 import Control.Applicative
 import Control.Monad
+import Control.Monad.IRTree qualified as RPath
 import Control.Monad.State
 import Data.Foldable
 import Data.Functor
@@ -106,7 +107,7 @@ run = do
               <> fmtMessage m
           )
 
-    usingLoggerT (cmapM fmt logTextStderr) do
+    usingLoggerT (filterBySeverity Info msgSeverity $ cmapM fmt logTextStderr) do
       let
         test f = process D ("test " <> Text.pack f) do
           err <- liftIO $ runProcess cmd
@@ -131,21 +132,25 @@ run = do
             removeFile (f <.> "bak")
           liftIO exitFailure
 
-        check' f _ c = process I "Checking predictate" do
+        check' f l c = process D "Checking predictate" do
           when debug do
             pPrint (void c)
           when pedandic do
             liftIO $ copyFile f (f <.> "last")
+          logDebug (Text.pack . show $ RPath.fromChoiceList $ map fst l)
           output f c
           v <- validiate f
-          if v
-            then test f
-            else do
-              logWarning "Produced invalid code"
-              when pedandic do
+          res <-
+            if v
+              then test f
+              else do
+                logWarning "Produced invalid code"
                 liftIO $ copyFile f (f <.> "fail")
-                cleanup f
-              pure False
+                when pedandic do
+                  cleanup f
+                pure False
+          logInfo ("Predicate was " <> Text.pack (show res))
+          pure res
 
       let bak = file <.> "bak"
 
-- 
GitLab