get rid of cacheLedgerAndDo
This commit is contained in:
parent
5cb1ea228f
commit
29b75f3949
@ -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
|
||||
|
||||
8
Parse.hs
8
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user