Skip to content
Snippets Groups Projects
Commit 41054fe5 authored by chrg's avatar chrg
Browse files

Quality of life stuff

parent a9918e16
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ import ReduceC ...@@ -11,6 +11,7 @@ import ReduceC
import Colog import Colog
import Control.Applicative import Control.Applicative
import Control.Monad import Control.Monad
import Control.Monad.IRTree qualified as RPath
import Control.Monad.State import Control.Monad.State
import Data.Foldable import Data.Foldable
import Data.Functor import Data.Functor
...@@ -106,7 +107,7 @@ run = do ...@@ -106,7 +107,7 @@ run = do
<> fmtMessage m <> fmtMessage m
) )
usingLoggerT (cmapM fmt logTextStderr) do usingLoggerT (filterBySeverity Info msgSeverity $ cmapM fmt logTextStderr) do
let let
test f = process D ("test " <> Text.pack f) do test f = process D ("test " <> Text.pack f) do
err <- liftIO $ runProcess cmd err <- liftIO $ runProcess cmd
...@@ -131,21 +132,25 @@ run = do ...@@ -131,21 +132,25 @@ run = do
removeFile (f <.> "bak") removeFile (f <.> "bak")
liftIO exitFailure liftIO exitFailure
check' f _ c = process I "Checking predictate" do check' f l c = process D "Checking predictate" do
when debug do when debug do
pPrint (void c) pPrint (void c)
when pedandic do when pedandic do
liftIO $ copyFile f (f <.> "last") liftIO $ copyFile f (f <.> "last")
logDebug (Text.pack . show $ RPath.fromChoiceList $ map fst l)
output f c output f c
v <- validiate f v <- validiate f
res <-
if v if v
then test f then test f
else do else do
logWarning "Produced invalid code" logWarning "Produced invalid code"
when pedandic do
liftIO $ copyFile f (f <.> "fail") liftIO $ copyFile f (f <.> "fail")
when pedandic do
cleanup f cleanup f
pure False pure False
logInfo ("Predicate was " <> Text.pack (show res))
pure res
let bak = file <.> "bak" let bak = file <.> "bak"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment