From e08b2c1ea69c817c67e05ed1d98d5be3a3b67d89 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 11 Jul 2007 08:24:32 +0000 Subject: [PATCH] remove unused functions --- AccountName.hs | 12 ------------ Parse.hs | 7 ------- Tests.hs | 7 +------ Transaction.hs | 18 ------------------ 4 files changed, 1 insertion(+), 43 deletions(-) diff --git a/AccountName.hs b/AccountName.hs index 211fc1d3f..1323a1570 100644 --- a/AccountName.hs +++ b/AccountName.hs @@ -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 diff --git a/Parse.hs b/Parse.hs index 01248fbea..ef9dacfda 100644 --- a/Parse.hs +++ b/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 diff --git a/Tests.hs b/Tests.hs index 3b9c1e781..3e17ce349 100644 --- a/Tests.hs +++ b/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 diff --git a/Transaction.hs b/Transaction.hs index 1bc870cb8..17a356b56 100644 --- a/Transaction.hs +++ b/Transaction.hs @@ -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)]