From 9f565157e0897fe74fe39d1d1461aa03e866bcf1 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 9 Mar 2010 04:19:20 +0000 Subject: [PATCH] fix recent compilation breakage --- Commands/Register.hs | 15 ++++++++------- Commands/UI.hs | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Commands/Register.hs b/Commands/Register.hs index 69b6c6897..ac80f7d93 100644 --- a/Commands/Register.hs +++ b/Commands/Register.hs @@ -8,6 +8,7 @@ A ledger-compatible @register@ command. module Commands.Register ( register ,showRegisterReport + ,showPostingWithBalance ,tests_Register ) where @@ -29,7 +30,7 @@ register opts args l = do -- | Generate the register report, which is a list of postings with transaction -- info and a running balance. showRegisterReport :: [Opt] -> FilterSpec -> Ledger -> String -showRegisterReport opts filterspec l = showpostings ps nullposting startbal +showRegisterReport opts filterspec l = showPostingsWithBalance ps nullposting startbal where ps | interval == NoInterval = displayableps | otherwise = summarisePostings interval depth empty filterspan displayableps @@ -116,17 +117,17 @@ DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaaaaa AAAAAAAAAAA AAAAAAAAAAAA aaaaaaaaaaaaaaaaaaaaaa AAAAAAAAAAA AAAAAAAAAAAA @ -} -showpostings :: [Posting] -> Posting -> MixedAmount -> String -showpostings [] _ _ = "" -showpostings (p:ps) pprev bal = this ++ showpostings ps p bal' +showPostingsWithBalance :: [Posting] -> Posting -> MixedAmount -> String +showPostingsWithBalance [] _ _ = "" +showPostingsWithBalance (p:ps) pprev bal = this ++ showPostingsWithBalance ps p bal' where - this = showposting isfirst p bal' + this = showPostingWithBalance isfirst p bal' isfirst = ptransaction p /= ptransaction pprev bal' = bal + pamount p -- | Show one posting and running balance, with or without transaction info. -showposting :: Bool -> Posting -> MixedAmount -> String -showposting withtxninfo p b = concatBottomPadded [txninfo ++ pstr ++ " ", bal] ++ "\n" +showPostingWithBalance :: Bool -> Posting -> MixedAmount -> String +showPostingWithBalance withtxninfo p b = concatBottomPadded [txninfo ++ pstr ++ " ", bal] ++ "\n" where ledger3ishlayout = False datedescwidth = if ledger3ishlayout then 34 else 32 diff --git a/Commands/UI.hs b/Commands/UI.hs index 008139e26..d29e62460 100644 --- a/Commands/UI.hs +++ b/Commands/UI.hs @@ -280,7 +280,7 @@ currentTransaction a@AppState{aledger=l,abuf=buf} = ptransaction p where p = safehead nullposting $ filter ismatch $ ledgerPostings l ismatch p = postingDate p == parsedate (take 10 datedesc) - && take 70 (showposting False p nullmixedamt) == (datedesc ++ acctamt) + && take 70 (showPostingWithBalance False p nullmixedamt) == (datedesc ++ acctamt) datedesc = take 32 $ fromMaybe "" $ find (not . (" " `isPrefixOf`)) $ safehead "" rest : reverse above acctamt = drop 32 $ safehead "" rest safehead d ls = if null ls then d else head ls