From 8215f19baa9261827b3f7062e924276f7e89be3e Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 15 Jul 2025 10:50:34 -0700 Subject: [PATCH] dev: include: cleanup --- hledger-lib/Hledger/Read/JournalReader.hs | 7 +++---- hledger/test/journal/include/.cycle/cycleglob.j | 1 + hledger/test/journal/include/selfglob.j | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 hledger/test/journal/include/.cycle/cycleglob.j create mode 100644 hledger/test/journal/include/selfglob.j diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index e77afdf64..ef7209161 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -71,7 +71,6 @@ module Hledger.Read.JournalReader ( where --- ** imports -import qualified Control.Monad.Fail as Fail (fail) import qualified Control.Exception as C import Control.Monad (forM_, when, void, unless, filterM) import Control.Monad.IO.Class (MonadIO, liftIO) @@ -387,10 +386,10 @@ includedirectivep = do g <- case tryCompileWith compDefault{errorRecovery=False} expandedglob of Left e -> customFailure $ parseErrorAt off $ "Invalid glob pattern: " ++ e + Right _ | regexMatch (toRegex' "\\*\\*[^/]") expandedglob -> + customFailure $ parseErrorAt off $ "Invalid glob pattern: double star requires slash, use * or **/" Right _ | "***" `isInfixOf` expandedglob -> customFailure $ parseErrorAt off $ "Invalid glob pattern: too many stars, use * or **/" - Right _ | regexMatch (toRegex' "\\*\\*[^/]") expandedglob -> - customFailure $ parseErrorAt off $ "Invalid glob pattern: double star requires slash, use **/" Right x -> pure x let isglob = not $ isLiteral g @@ -507,7 +506,7 @@ orRethrowIOError io msg = do eResult <- liftIO $ (Right <$> io) `C.catch` \(e::C.IOException) -> pure $ Left $ printf "%s:\n%s" msg (show e) case eResult of Right res -> pure res - Left errMsg -> Fail.fail errMsg + Left errMsg -> fail errMsg -- Parse an account directive, adding its info to the journal's -- list of account declarations. diff --git a/hledger/test/journal/include/.cycle/cycleglob.j b/hledger/test/journal/include/.cycle/cycleglob.j new file mode 100644 index 000000000..bd09962f6 --- /dev/null +++ b/hledger/test/journal/include/.cycle/cycleglob.j @@ -0,0 +1 @@ +include */*.j diff --git a/hledger/test/journal/include/selfglob.j b/hledger/test/journal/include/selfglob.j new file mode 100644 index 000000000..0323e0b54 --- /dev/null +++ b/hledger/test/journal/include/selfglob.j @@ -0,0 +1 @@ +include selfg*.j