get rid of cacheLedgerAndDo

This commit is contained in:
Simon Michael 2008-10-02 21:47:26 +00:00
parent 5cb1ea228f
commit 29b75f3949
2 changed files with 2 additions and 11 deletions

View File

@ -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

View File

@ -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