From 9840ad5dc35525464cc1d13449cec187d951d871 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 30 Apr 2026 21:22:02 +0100 Subject: [PATCH] Improve the check.hell script * Checks the scripts/ dir * Runs all things concurrently * Adds --compiler-stats flag too --- scripts/check.hell | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/scripts/check.hell b/scripts/check.hell index 5d07f2b..b206d6b 100644 --- a/scripts/check.hell +++ b/scripts/check.hell @@ -1,10 +1,22 @@ +data Opts = Opts { + compilerStats :: Bool + } + +options = + (\compilerStats -> Main.Opts { compilerStats }) + <$> Options.switch (Flag.long "compiler-stats" <> Flag.help "Pass --compiler-stats in?") + main = do - examples <- Directory.listDirectory "examples/" - let check = \fp -> do - Text.putStrLn $ Text.concat ["Checking ", fp] - Process.runProcess_ (Process.proc "hell" ["--check", fp]) - Monad.forM_ examples \example -> do - check $ Text.concat ["examples/", example] - check "scripts/static-build.hell" - check "scripts/install-hell.hell" + opts <- Options.execParser (Options.info (Main.options <**> Options.helper) Options.fullDesc) + let extra = if Record.get @"compilerStats" opts + then ["--compiler-stats"] + else [] + let list = \dir -> + Functor.fmap (List.filter (Text.isSuffixOf ".hell") . List.map (\x -> dir <> x)) + $ Directory.listDirectory dir + examples <- list "examples/" + scripts <- list "scripts/" + Async.pooledForConcurrently (examples <> scripts) \fp -> do + Text.putStrLn $ Text.concat ["Checking ", fp] + Process.runProcess_ (Process.proc "hell" (["--check", fp] <> extra)) Text.putStrLn "All OK."