diff --git a/hledger-lib/Hledger/Data/Types.hs b/hledger-lib/Hledger/Data/Types.hs index dbb2c722d..457373131 100644 --- a/hledger-lib/Hledger/Data/Types.hs +++ b/hledger-lib/Hledger/Data/Types.hs @@ -367,10 +367,7 @@ data Account = Account { -- Assets and expenses are normally positive (debit), while liabilities, equity -- and income are normally negative (credit). -- https://en.wikipedia.org/wiki/Normal_balance -data NormalSign = - NormallyPositive -- ^ normally debit - assets, expenses... - | NormallyNegative -- ^ normally credit - liabilities, equity, income... - deriving (Show, Data, Eq) +data NormalSign = NormallyPositive | NormallyNegative deriving (Show, Data, Eq) -- | A Ledger has the journal it derives from, and the accounts -- derived from that. Accounts are accessible both list-wise and diff --git a/hledger/Hledger/Cli/CompoundBalanceCommand.hs b/hledger/Hledger/Cli/CompoundBalanceCommand.hs index 920c538dc..4c9d1e9c5 100644 --- a/hledger/Hledger/Cli/CompoundBalanceCommand.hs +++ b/hledger/Hledger/Cli/CompoundBalanceCommand.hs @@ -45,6 +45,26 @@ data CompoundBalanceCommandSpec = CompoundBalanceCommandSpec { cbctype :: BalanceType -- ^ the type of "balance" this report shows (overrides command line flags) } +-- | A compound balance report has: +-- +-- * an overall title +-- +-- * the period (date span) of each column +-- +-- * one or more named multi balance reports, with columns corresponding to the above +-- +-- * a list of overall totals for each column, and their grand total and average +-- +-- It is used in compound balance report commands like balancesheet, +-- cashflow and incomestatement. +type CompoundBalanceReport = + ( String + , [DateSpan] + , [(String, MultiBalanceReport)] + , ([MixedAmount], MixedAmount, MixedAmount) + ) + + -- | Generate a cmdargs option-parsing mode from a compound balance command -- specification. compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts @@ -212,25 +232,6 @@ compoundBalanceCommandSingleColumnReport ropts userq j subreporttitle subreportq | otherwise = balanceReport ropts' q j subreportstr = intercalate "\n" [subreporttitle <> ":", balanceReportAsText ropts r] --- | A compound balance report has: --- --- * an overall title --- --- * the period (date span) of each column --- --- * one or more named multi balance reports, with columns corresponding to the above --- --- * a list of overall totals for each column, and their grand total and average --- --- It is used in compound balance report commands like balancesheet, --- cashflow and incomestatement. -type CompoundBalanceReport = - ( String - , [DateSpan] - , [(String, MultiBalanceReport)] - , ([MixedAmount], MixedAmount, MixedAmount) - ) - -- | Run one subreport for a compound balance command in multi-column mode. -- This returns a MultiBalanceReport. compoundBalanceSubreport :: ReportOpts -> Query -> Journal -> (Journal -> Query) -> Maybe NormalSign -> MultiBalanceReport