From 73c49ec0600a7303e158897e8c5eac6ae8aaf50e Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 10 Oct 2008 02:19:53 +0000 Subject: [PATCH] reduce unnecessary imports --- Ledger.hs | 34 ++++++++++++++++++---------------- Ledger/Account.hs | 4 ---- Ledger/Currency.hs | 2 +- Ledger/Parse.hs | 3 +-- Ledger/RawLedger.hs | 1 - Ledger/RawTransaction.hs | 1 - Ledger/TimeLog.hs | 3 --- Ledger/Transaction.hs | 2 -- Ledger/Utils.hs | 37 +++++++++++++++++++------------------ Options.hs | 4 ---- Tests.hs | 5 +---- hledger.hs | 5 +---- 12 files changed, 41 insertions(+), 60 deletions(-) diff --git a/Ledger.hs b/Ledger.hs index 9f57d985f..669732ee6 100644 --- a/Ledger.hs +++ b/Ledger.hs @@ -6,29 +6,31 @@ It generally provides a compatible subset of C++ ledger's functionality. -} module Ledger ( - module Ledger.Types, - module Ledger.Currency, - module Ledger.Amount, + module Ledger.Account, module Ledger.AccountName, - module Ledger.RawTransaction, + module Ledger.Amount, + module Ledger.Currency, module Ledger.Entry, + module Ledger.Ledger, + module Ledger.Parse, + module Ledger.RawLedger, + module Ledger.RawTransaction, module Ledger.TimeLog, module Ledger.Transaction, - -- module Ledger.RawLedger, - module Ledger.Account, - module Ledger.Ledger, + module Ledger.Types, + module Ledger.Utils, ) where -import qualified Data.Map as Map -import Ledger.Types -import Ledger.Currency -import Ledger.Amount +import Ledger.Account import Ledger.AccountName -import Ledger.RawTransaction +import Ledger.Amount +import Ledger.Currency import Ledger.Entry +import Ledger.Ledger +import Ledger.Parse +import Ledger.RawLedger +import Ledger.RawTransaction import Ledger.TimeLog import Ledger.Transaction -import Ledger.RawLedger -import Ledger.Account -import Ledger.Ledger - +import Ledger.Types +import Ledger.Utils diff --git a/Ledger/Account.hs b/Ledger/Account.hs index eb8cb3892..3cca60d28 100644 --- a/Ledger/Account.hs +++ b/Ledger/Account.hs @@ -10,11 +10,7 @@ module Ledger.Account where import Ledger.Utils import Ledger.Types -import Ledger.AccountName import Ledger.Amount -import Ledger.Entry -import Ledger.RawTransaction -import Ledger.Transaction instance Show Account where diff --git a/Ledger/Currency.hs b/Ledger/Currency.hs index 55a6607dd..4649ad187 100644 --- a/Ledger/Currency.hs +++ b/Ledger/Currency.hs @@ -8,10 +8,10 @@ currently hard-coded. module Ledger.Currency where import qualified Data.Map as Map -import Data.Map ((!)) import Ledger.Utils import Ledger.Types + currencies = [ Currency "$" 1 diff --git a/Ledger/Parse.hs b/Ledger/Parse.hs index 5b9b91d53..50f3edef9 100644 --- a/Ledger/Parse.hs +++ b/Ledger/Parse.hs @@ -6,7 +6,6 @@ Parsers for standard ledger and timelog files. module Ledger.Parse where -import qualified Data.Map as Map import Text.ParserCombinators.Parsec import Text.ParserCombinators.Parsec.Language import qualified Text.ParserCombinators.Parsec.Token as P @@ -44,7 +43,7 @@ ledgerLanguageDef = LanguageDef { lexer = P.makeTokenParser ledgerLanguageDef whiteSpace = P.whiteSpace lexer lexeme = P.lexeme lexer -symbol = P.symbol lexer +--symbol = P.symbol lexer natural = P.natural lexer parens = P.parens lexer semi = P.semi lexer diff --git a/Ledger/RawLedger.hs b/Ledger/RawLedger.hs index 7f2b552a0..01dc06d27 100644 --- a/Ledger/RawLedger.hs +++ b/Ledger/RawLedger.hs @@ -7,7 +7,6 @@ the cached 'Ledger'. module Ledger.RawLedger where -import qualified Data.Map as Map import Ledger.Utils import Ledger.Types import Ledger.AccountName diff --git a/Ledger/RawTransaction.hs b/Ledger/RawTransaction.hs index c285e7ae3..74b1688ea 100644 --- a/Ledger/RawTransaction.hs +++ b/Ledger/RawTransaction.hs @@ -9,7 +9,6 @@ module Ledger.RawTransaction where import Ledger.Utils import Ledger.Types -import Ledger.AccountName import Ledger.Amount diff --git a/Ledger/TimeLog.hs b/Ledger/TimeLog.hs index eee3eb720..b5582b4d0 100644 --- a/Ledger/TimeLog.hs +++ b/Ledger/TimeLog.hs @@ -12,9 +12,6 @@ import Ledger.Utils import Ledger.Types import Ledger.Currency import Ledger.Amount -import Ledger.RawTransaction -import Ledger.Entry -import Ledger.RawLedger instance Show TimeLogEntry where diff --git a/Ledger/Transaction.hs b/Ledger/Transaction.hs index a9c0e367e..5ff75f42f 100644 --- a/Ledger/Transaction.hs +++ b/Ledger/Transaction.hs @@ -9,11 +9,9 @@ module Ledger.Transaction where import Ledger.Utils import Ledger.Types -import Ledger.AccountName import Ledger.Entry import Ledger.RawTransaction import Ledger.Amount -import Ledger.Currency instance Show Transaction where diff --git a/Ledger/Utils.hs b/Ledger/Utils.hs index afe0554d6..40ccd5806 100644 --- a/Ledger/Utils.hs +++ b/Ledger/Utils.hs @@ -5,36 +5,37 @@ Standard always-available imports and utilities. -} module Ledger.Utils ( -module Ledger.Utils, module Char, module Data.List, -module Data.Tree, -module Data.Ord, +--module Data.Map, module Data.Maybe, +module Data.Ord, +module Data.Time.Clock, +module Data.Time.Format, +module Data.Tree, +module Debug.Trace, +module Ledger.Utils, +module System.Locale, +module Test.HUnit, +module Test.QuickCheck, module Text.Printf, module Text.Regex, -module Debug.Trace, -module Test.QuickCheck, -module Test.HUnit, -module System.Locale, -module Data.Time.Clock, -module Data.Time.Format ) where import Char import Data.List -import Data.Tree -import qualified Data.Map -import Data.Ord +--import qualified Data.Map as Map import Data.Maybe -import Text.Printf -import Text.Regex -import Debug.Trace -import Test.QuickCheck hiding (test, Testable) -import Test.HUnit -import System.Locale (defaultTimeLocale) +import Data.Ord import Data.Time.Clock (UTCTime, diffUTCTime) import Data.Time.Format (ParseTime, parseTime, formatTime) +import Data.Tree +import Debug.Trace +import System.Locale (defaultTimeLocale) +import Test.HUnit +import Test.QuickCheck hiding (test, Testable) +import Text.Printf +import Text.Regex -- regexps diff --git a/Options.hs b/Options.hs index d774f57dc..67e6f9dac 100644 --- a/Options.hs +++ b/Options.hs @@ -3,10 +3,6 @@ where import System import System.Console.GetOpt import System.Directory -import System.Environment (getEnv) -import Data.Maybe (fromMaybe) -import Ledger.Utils -import Ledger.Types usagehdr = "Usage: hledger [OPTIONS] "++commands++" [ACCTPATTERNS] [-- DESCPATTERNS]\nOptions:" diff --git a/Tests.hs b/Tests.hs index 7231d9ea0..d9965ec21 100644 --- a/Tests.hs +++ b/Tests.hs @@ -2,11 +2,8 @@ module Tests where import qualified Data.Map as Map import Text.ParserCombinators.Parsec - -import Options import Ledger -import Ledger.Parse -import Ledger.Utils + -- utils diff --git a/hledger.hs b/hledger.hs index 3fa41a5ef..04c103012 100644 --- a/hledger.hs +++ b/hledger.hs @@ -32,13 +32,10 @@ This module includes some helpers for working with your ledger in ghci. Examples module Main where -import System import qualified Data.Map as Map (lookup) +import Ledger import Options import Tests -import Ledger.Parse -import Ledger.Utils -import Ledger main :: IO ()