From 29b75f3949959629be9ab55b32ff3f4b70e7f54c Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 2 Oct 2008 21:47:26 +0000 Subject: [PATCH] get rid of cacheLedgerAndDo --- Ledger.hs | 5 +---- Parse.hs | 8 +------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Ledger.hs b/Ledger.hs index af639f0d3..50359de78 100644 --- a/Ledger.hs +++ b/Ledger.hs @@ -37,10 +37,7 @@ instance Show Ledger where -- | at startup, to improve performance, we refine the parsed ledger entries: -- 1. filter based on account/description patterns, if any -- 2. cache per-account info --- also, figure out the precision(s) to use -cacheLedgerAndDo :: LedgerFile -> (Regex,Regex) -> (Ledger -> IO ()) -> IO () -cacheLedgerAndDo l pats cmd = do cmd $ cacheLedger l pats - +-- 3. figure out the precision(s) to use cacheLedger :: LedgerFile -> (Regex,Regex) -> Ledger cacheLedger l pats = let diff --git a/Parse.hs b/Parse.hs index 8f2b70d3b..62c7e57ee 100644 --- a/Parse.hs +++ b/Parse.hs @@ -123,13 +123,7 @@ parseLedgerAndDo opts pats cmd = do path <- ledgerFilePath opts parsed <- parseLedgerFile path case parsed of Left err -> parseError err - Right l -> cacheLedgerAndDo l pats cmd - --- do some action with the ledger parse result, or report a parse error --- withParsedLedgerOrErrorDo :: (Either ParseError LedgerFile) -> (Regex,Regex) -> (Ledger -> IO ()) -> IO () --- withParsedLedgerOrErrorDo parsed pats cmd = do --- case parsed of Left err -> parseError err --- Right l -> cacheLedgerAndDo l pats cmd + Right l -> cmd $ cacheLedger l pats parseLedgerFile :: String -> IO (Either ParseError LedgerFile) parseLedgerFile "-" = fmap (parse ledgerfile "-") $ hGetContents stdin