From 13e6c7dfdfe0ffa461c0b6e71e9a0e49751097e7 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 7 Dec 2019 09:05:41 -0800 Subject: [PATCH] lib: drop "assertion" alias for nullassertion Perhaps we'll stick with the null* convention. Fixes a warning in Transaction.hs. --- hledger-lib/Hledger/Data/Posting.hs | 4 +--- hledger-lib/Hledger/Read/CsvReader.hs | 10 +++++----- hledger/Hledger/Cli/Commands/Close.hs | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/hledger-lib/Hledger/Data/Posting.hs b/hledger-lib/Hledger/Data/Posting.hs index 6b9122c4c..bb330a749 100644 --- a/hledger-lib/Hledger/Data/Posting.hs +++ b/hledger-lib/Hledger/Data/Posting.hs @@ -20,7 +20,6 @@ module Hledger.Data.Posting ( vpost', nullsourcepos, nullassertion, - assertion, balassert, balassertTot, balassertParInc, @@ -128,14 +127,13 @@ vpost' acc amt ass = (post' acc amt ass){ptype=VirtualPosting, pbalanceassertion nullsourcepos :: GenericSourcePos nullsourcepos = JournalSourcePos "" (1,1) -nullassertion, assertion :: BalanceAssertion +nullassertion :: BalanceAssertion nullassertion = BalanceAssertion {baamount=nullamt ,batotal=False ,bainclusive=False ,baposition=nullsourcepos } -assertion = nullassertion -- | Make a partial, exclusive balance assertion. balassert :: Amount -> Maybe BalanceAssertion diff --git a/hledger-lib/Hledger/Read/CsvReader.hs b/hledger-lib/Hledger/Read/CsvReader.hs index 9d0add2d5..db04cb903 100644 --- a/hledger-lib/Hledger/Read/CsvReader.hs +++ b/hledger-lib/Hledger/Read/CsvReader.hs @@ -827,11 +827,11 @@ transactionFromCsvRecord sourcepos rules record = t defaultAssertion = case mdirective "balance-type" of - Nothing -> assertion - Just "=" -> assertion - Just "==" -> assertion {batotal=True} - Just "=*" -> assertion {bainclusive=True} - Just "==*" -> assertion{batotal=True, bainclusive=True} + Nothing -> nullassertion + Just "=" -> nullassertion + Just "==" -> nullassertion{batotal=True} + Just "=*" -> nullassertion{bainclusive=True} + Just "==*" -> nullassertion{batotal=True, bainclusive=True} Just x -> error' $ unlines [ "balance-type \"" ++ x ++"\" is invalid. Use =, ==, =* or ==*." , showRecord record diff --git a/hledger/Hledger/Cli/Commands/Close.hs b/hledger/Hledger/Cli/Commands/Close.hs index 41a40f645..d8a02e6db 100755 --- a/hledger/Hledger/Cli/Commands/Close.hs +++ b/hledger/Hledger/Cli/Commands/Close.hs @@ -55,7 +55,7 @@ close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do -- only the last posting in each commodity will have a balance assertion (#1035) closingps = [posting{paccount = a ,pamount = mixed [setprec $ negate b] - ,pbalanceassertion = if islast then Just assertion{baamount=setprec b{aquantity=0, aprice=Nothing}} else Nothing + ,pbalanceassertion = if islast then Just nullassertion{baamount=setprec b{aquantity=0, aprice=Nothing}} else Nothing } | (a,_,_,mb) <- acctbals -- the balances in each commodity, and for each transaction price @@ -76,7 +76,7 @@ close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do openingps = [posting{paccount = a ,pamount = mixed [setprec b] ,pbalanceassertion = case mcommoditysum of - Just s -> Just assertion{baamount=setprec s{aprice=Nothing}} + Just s -> Just nullassertion{baamount=setprec s{aprice=Nothing}} Nothing -> Nothing } | (a,_,_,mb) <- acctbals