diff --git a/Ledger/Ledger.hs b/Ledger/Ledger.hs index cd5bf9632..f0bec5a59 100644 --- a/Ledger/Ledger.hs +++ b/Ledger/Ledger.hs @@ -71,7 +71,7 @@ instance Show Ledger where (length $ accountnames l) (showtree $ accountnametree l) --- | Convert a raw ledger to a more efficient cached type, described above. +-- | Convert a journal to a more efficient cached ledger, described above. cacheLedger :: [String] -> Journal -> Ledger cacheLedger apats j = Ledger{journaltext="",journal=j,accountnametree=ant,accountmap=acctmap} where @@ -79,11 +79,10 @@ cacheLedger apats j = Ledger{journaltext="",journal=j,accountnametree=ant,accoun acctmap = Map.fromList [(a, mkacct a) | a <- flatten ant] where mkacct a = Account a (psof a) (inclbalof a) --- | Given a list of transactions, return an account name tree and three --- query functions that fetch transactions, balance, and --- subaccount-including balance by account name. --- This is to factor out common logic from cacheLedger and --- summarisePostingsInDateSpan. +-- | Given a list of postings, return an account name tree and three query +-- functions that fetch postings, balance, and subaccount-including +-- balance by account name. This factors out common logic from +-- cacheLedger and summarisePostingsInDateSpan. groupPostings :: [Posting] -> (Tree AccountName, (AccountName -> [Posting]), (AccountName -> MixedAmount), diff --git a/Ledger/Types.hs b/Ledger/Types.hs index e4d6a778f..c6dc84558 100644 --- a/Ledger/Types.hs +++ b/Ledger/Types.hs @@ -124,17 +124,6 @@ data Journal = Journal { filereadtime :: ClockTime } deriving (Eq) --- | A generic, pure specification of how to filter raw ledger transactions. -data FilterSpec = FilterSpec { - datespan :: DateSpan -- ^ only include transactions in this date span - ,cleared :: Maybe Bool -- ^ only include if cleared\/uncleared\/don't care - ,real :: Bool -- ^ only include if real\/don't care - ,costbasis :: Bool -- ^ convert all amounts to cost basis - ,acctpats :: [String] -- ^ only include if matching these account patterns - ,descpats :: [String] -- ^ only include if matching these description patterns - ,whichdate :: WhichDate -- ^ which dates to use (transaction or effective) - } - data Account = Account { aname :: AccountName, apostings :: [Posting], -- ^ transactions in this account @@ -148,3 +137,14 @@ data Ledger = Ledger { accountmap :: Map.Map AccountName Account } deriving Typeable +-- | A generic, pure specification of how to filter transactions/postings. +data FilterSpec = FilterSpec { + datespan :: DateSpan -- ^ only include if in this date span + ,cleared :: Maybe Bool -- ^ only include if cleared\/uncleared\/don't care + ,real :: Bool -- ^ only include if real\/don't care + ,costbasis :: Bool -- ^ convert all amounts to cost basis + ,acctpats :: [String] -- ^ only include if matching these account patterns + ,descpats :: [String] -- ^ only include if matching these description patterns + ,whichdate :: WhichDate -- ^ which dates to use (actual or effective) + } +