extra: update, stackify hledger-check-dates

This commit is contained in:
Simon Michael 2016-05-19 16:29:39 -07:00
parent 7f5e09096f
commit e7c457f970

View File

@ -1,4 +1,9 @@
#!/usr/bin/env runhaskell
#!/usr/bin/env stack
{- stack runghc --verbosity info
--package hledger-lib
--package hledger
-}
{-|
hledger-check-dates [--strict] [--date2] [-f JOURNALFILE]
@ -32,10 +37,10 @@ data FoldAcc a b = FoldAcc
}
foldWhile :: (a -> FoldAcc a b -> FoldAcc a b) -> FoldAcc a b -> [a] -> FoldAcc a b
foldWhile fold acc [] = acc
foldWhile _ acc [] = acc
foldWhile fold acc (a:as) =
case fold a acc of
acc@FoldAcc{fa_error=Just a} -> acc
acc@FoldAcc{fa_error=Just _} -> acc
acc -> foldWhile fold acc as
checkTransactions :: (Transaction -> Transaction -> Bool)
@ -53,9 +58,9 @@ main :: IO ()
main = do
opts <- getCliOpts argsmode
withJournalDo opts $
\cliopts@CliOpts{rawopts_=opts,reportopts_=ropts} j -> do
\CliOpts{rawopts_=opts,reportopts_=ropts} j -> do
d <- getCurrentDay
let ropts_ = ropts{flat_=True}
let ropts_ = ropts{accountlistmode_=ALFlat}
let q = queryFromOpts d ropts_
let ts = filter (q `matchesTransaction`) $
jtxns $ journalSelectingAmountFromOpts ropts j