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: | -- | at startup, to improve performance, we refine the parsed ledger entries: | ||||||
| -- 1. filter based on account/description patterns, if any | -- 1. filter based on account/description patterns, if any | ||||||
| -- 2. cache per-account info | -- 2. cache per-account info | ||||||
| -- also, figure out the precision(s) to use | -- 3. figure out the precision(s) to use | ||||||
| cacheLedgerAndDo :: LedgerFile -> (Regex,Regex) -> (Ledger -> IO ()) -> IO () |  | ||||||
| cacheLedgerAndDo l pats cmd = do cmd $ cacheLedger l pats |  | ||||||
| 
 |  | ||||||
| cacheLedger :: LedgerFile -> (Regex,Regex) -> Ledger | cacheLedger :: LedgerFile -> (Regex,Regex) -> Ledger | ||||||
| cacheLedger l pats =  | cacheLedger l pats =  | ||||||
|     let  |     let  | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								Parse.hs
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								Parse.hs
									
									
									
									
									
								
							| @ -123,13 +123,7 @@ parseLedgerAndDo opts pats cmd = do | |||||||
|     path <- ledgerFilePath opts |     path <- ledgerFilePath opts | ||||||
|     parsed <- parseLedgerFile path |     parsed <- parseLedgerFile path | ||||||
|     case parsed of Left err -> parseError err |     case parsed of Left err -> parseError err | ||||||
|                    Right l -> cacheLedgerAndDo l pats cmd |                    Right l -> cmd $ cacheLedger l pats | ||||||
| 
 |  | ||||||
| -- 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 |  | ||||||
| 
 | 
 | ||||||
| parseLedgerFile :: String -> IO (Either ParseError LedgerFile) | parseLedgerFile :: String -> IO (Either ParseError LedgerFile) | ||||||
| parseLedgerFile "-" = fmap (parse ledgerfile "-") $ hGetContents stdin | parseLedgerFile "-" = fmap (parse ledgerfile "-") $ hGetContents stdin | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user