From d544893894676921542b8091db26ad36d2f6f0af Mon Sep 17 00:00:00 2001
From: Christian Gram Kalhauge <chrg@dtu.dk>
Date: Wed, 19 Mar 2025 12:11:15 +0100
Subject: [PATCH] Small changes

---
 rtree-c/bin/Main.hs | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/rtree-c/bin/Main.hs b/rtree-c/bin/Main.hs
index 72b2df0..6176a7f 100644
--- a/rtree-c/bin/Main.hs
+++ b/rtree-c/bin/Main.hs
@@ -69,6 +69,14 @@ run = do
         , value Exp
         ]
 
+  verbose <-
+    flag False True $
+      fold
+        [ long "verbose"
+        , short 'v'
+        , help "log more"
+        ]
+
   checkmode <-
     flag False True $
       fold
@@ -137,7 +145,11 @@ run = do
               <> fmtMessage m
           )
 
-    usingLoggerT (filterBySeverity Info msgSeverity $ cmapM fmt logTextStderr) do
+    let logger =
+          filterBySeverity (if verbose then Debug else Info) msgSeverity $
+            cmapM fmt logTextStderr
+
+    usingLoggerT logger do
       counter <- liftIO (newIORef (0 :: Int))
 
       let
@@ -157,11 +169,11 @@ run = do
             removeFile (f <.> "bak")
           liftIO exitFailure
 
-        check
-          :: FilePath
-          -> [RPath.AnnotatedChoice (String, C.Position)]
-          -> C.CTranslationUnit C.NodeInfo
-          -> LoggerT (Msg Severity) IO Bool
+        check ::
+          FilePath ->
+          [RPath.AnnotatedChoice (String, C.Position)] ->
+          C.CTranslationUnit C.NodeInfo ->
+          LoggerT (Msg Severity) IO Bool
         check f l c = process D "Checking predictate" do
           let xs = NE.nonEmpty (filter ((RPath.Yes ==) . RPath.choice) l)
           let decided = length l - RPath.numberOfUndecided l
@@ -241,7 +253,7 @@ run = do
 
         unless t do
           logError "file did not satisfy predicate"
-          cleanup file
+          liftIO exitFailure
 
       when checkmode do
         logInfo "In checking mode, stopping now"
-- 
GitLab