remove unused functions
This commit is contained in:
		
							parent
							
								
									9ab9d460c1
								
							
						
					
					
						commit
						e08b2c1ea6
					
				| @ -46,18 +46,6 @@ s `isSubAccountNameOf` p = | ||||
| subAccountNamesFrom :: [AccountName] -> AccountName -> [AccountName] | ||||
| subAccountNamesFrom accts a = filter (`isSubAccountNameOf` a) accts | ||||
| 
 | ||||
| matchAccountName :: Regex -> AccountName -> Bool | ||||
| matchAccountName r a = | ||||
|     case matchRegex r a of | ||||
|       Nothing -> False | ||||
|       otherwise -> True | ||||
| 
 | ||||
| indentAccountName ::  Int -> AccountName -> String | ||||
| indentAccountName indentcorrection a =  | ||||
|     replicate (indentlevel * 2) ' ' ++ (accountLeafName a) | ||||
|     where indentlevel = ((accountNameLevel a) - 1) + indentcorrection | ||||
| 
 | ||||
| 
 | ||||
| -- We could almost get by with just the above, but we need smarter | ||||
| -- structures to eg display the account tree with boring accounts elided. | ||||
| -- first, here is a tree of AccountNames; Account and Account tree are | ||||
|  | ||||
							
								
								
									
										7
									
								
								Parse.hs
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								Parse.hs
									
									
									
									
									
								
							| @ -257,9 +257,6 @@ ledgeramount = | ||||
|       stripcommas = filter (',' /=) | ||||
|       striptrailingpoint = reverse . dropWhile (=='.') . reverse | ||||
| 
 | ||||
| ledgereol :: Parser String | ||||
| ledgereol = do {newline; return []} | ||||
| 
 | ||||
| spacenonewline :: Parser Char | ||||
| spacenonewline = satisfy (\c -> c `elem` " \v\f\t") | ||||
| 
 | ||||
| @ -336,10 +333,6 @@ timelogentry = do | ||||
| parseError :: (Show a) => a -> IO () | ||||
| parseError e = do putStr "ledger parse error at "; print e | ||||
| 
 | ||||
| printParseResult :: Show v => Either ParseError v -> IO () | ||||
| printParseResult r = case r of Left e -> parseError e | ||||
|                                Right v -> print v | ||||
| 
 | ||||
| parseLedgerFile :: String -> IO (Either ParseError LedgerFile) | ||||
| parseLedgerFile "-" = fmap (parse ledgerfile "-") $ hGetContents stdin | ||||
| parseLedgerFile f   = parseFromFile ledgerfile f | ||||
|  | ||||
							
								
								
									
										7
									
								
								Tests.hs
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								Tests.hs
									
									
									
									
									
								
							| @ -20,12 +20,6 @@ assertParseEqual expected parsed = | ||||
|       Left e -> parseError e | ||||
|       Right v -> assertEqual " " expected v | ||||
| 
 | ||||
| parseEqual :: Eq a => (Either ParseError a) -> a -> Bool | ||||
| parseEqual parsed other = | ||||
|     case parsed of | ||||
|       Left e -> False | ||||
|       Right v -> v == other | ||||
| 
 | ||||
| -- find tests with template haskell | ||||
| -- | ||||
| -- {-# OPTIONS_GHC -fno-warn-unused-imports -no-recomp -fth #-} | ||||
| @ -319,6 +313,7 @@ hunit = runTestTT $ "hunit" ~: test ([ | ||||
|         ,"" ~: test_cacheLedger | ||||
|         ,"" ~: test_showLedgerAccounts | ||||
|         ,"" ~: test_Amount | ||||
|         ,"" ~: test_ledgeramount | ||||
|         ] :: [Test]) | ||||
| 
 | ||||
| test_ledgeramount :: Assertion | ||||
|  | ||||
| @ -27,18 +27,6 @@ accountNamesFromTransactions ts = nub $ map account ts | ||||
| sumTransactions :: [Transaction] -> Amount | ||||
| sumTransactions = sum . map amount | ||||
| 
 | ||||
| matchTransactionAccount :: Regex -> Transaction -> Bool | ||||
| matchTransactionAccount r t = | ||||
|     case matchRegex r (account t) of | ||||
|       Nothing -> False | ||||
|       otherwise -> True | ||||
| 
 | ||||
| matchTransactionDescription :: Regex -> Transaction -> Bool | ||||
| matchTransactionDescription r t = | ||||
|     case matchRegex r (description t) of | ||||
|       Nothing -> False | ||||
|       otherwise -> True | ||||
| 
 | ||||
| -- for register command  | ||||
| 
 | ||||
| showTransactionsWithBalances :: [Transaction] -> Amount -> String | ||||
| @ -69,9 +57,3 @@ showTransactionAndBalance t b = | ||||
| showBalance :: Amount -> String | ||||
| showBalance b = printf " %12s" (showAmountRoundedOrZero b) | ||||
| 
 | ||||
| transactionsWithAccountName :: AccountName -> [Transaction] -> [Transaction] | ||||
| transactionsWithAccountName a ts = [t | t <- ts, account t == a] | ||||
|      | ||||
| transactionsWithOrBelowAccountName :: AccountName -> [Transaction] -> [Transaction] | ||||
| transactionsWithOrBelowAccountName a ts =  | ||||
|     [t | t <- ts, account t == a || a `isAccountNamePrefixOf` (account t)] | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user