lib: drop "assertion" alias for nullassertion

Perhaps we'll stick with the null* convention. Fixes a warning in Transaction.hs.
This commit is contained in:
Simon Michael 2019-12-07 09:05:41 -08:00
parent 63aec5ef56
commit 13e6c7dfdf
3 changed files with 8 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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