diff --git a/Ledger/Account.hs b/Ledger/Account.hs index ccb3dbed7..d71ae47cd 100644 --- a/Ledger/Account.hs +++ b/Ledger/Account.hs @@ -19,5 +19,5 @@ instance Show Account where instance Eq Account where (==) (Account n1 t1 b1) (Account n2 t2 b2) = n1 == n2 && t1 == t2 && b1 == b2 -nullacct = Account "" [] nullamt +nullacct = Account "" [] nullmixedamt diff --git a/Ledger/Amount.hs b/Ledger/Amount.hs index 7bc860fc2..1843afc7b 100644 --- a/Ledger/Amount.hs +++ b/Ledger/Amount.hs @@ -137,9 +137,14 @@ normaliseMixedAmount (Mixed as) = Mixed $ map sum $ grouped symbols = sort $ nub $ map (symbol . commodity) as hassymbol s a = s == (symbol $ commodity a) + +-- | The empty simple amount. +nullamt :: Amount +nullamt = Amount unknown 0 Nothing + -- | The empty mixed amount. -nullamt :: MixedAmount -nullamt = Mixed [] +nullmixedamt :: MixedAmount +nullmixedamt = Mixed [] -- | A temporary value for parsed transactions which had no amount specified. missingamt :: MixedAmount diff --git a/Ledger/RawTransaction.hs b/Ledger/RawTransaction.hs index c797d525d..243407276 100644 --- a/Ledger/RawTransaction.hs +++ b/Ledger/RawTransaction.hs @@ -15,7 +15,7 @@ import Ledger.AccountName instance Show RawTransaction where show = showRawTransaction -nullrawtxn = RawTransaction "" nullamt "" RegularTransaction +nullrawtxn = RawTransaction "" nullmixedamt "" RegularTransaction showRawTransaction :: RawTransaction -> String showRawTransaction (RawTransaction a amt _ ttype) = diff --git a/Ledger/Transaction.hs b/Ledger/Transaction.hs index 4c41df58e..d1bc92251 100644 --- a/Ledger/Transaction.hs +++ b/Ledger/Transaction.hs @@ -32,4 +32,4 @@ accountNamesFromTransactions ts = nub $ map account ts sumTransactions :: [Transaction] -> MixedAmount sumTransactions = sum . map amount -nulltxn = Transaction 0 (parsedate "1900/1/1") "" "" nullamt RegularTransaction +nulltxn = Transaction 0 (parsedate "1900/1/1") "" "" nullmixedamt RegularTransaction diff --git a/RegisterCommand.hs b/RegisterCommand.hs index ee92ca7d7..d9a4edc89 100644 --- a/RegisterCommand.hs +++ b/RegisterCommand.hs @@ -26,7 +26,7 @@ DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaaaaa AAAAAAAAAAA AAAAAAAAAAAA @ -} showRegisterReport :: [Opt] -> [String] -> Ledger -> String -showRegisterReport opts args l = showtxns ts nulltxn nullamt +showRegisterReport opts args l = showtxns ts nulltxn nullmixedamt where ts = filter matchtxn $ ledgerTransactions l matchtxn Transaction{account=a} = matchpats apats a