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', vpost',
nullsourcepos, nullsourcepos,
nullassertion, nullassertion,
assertion,
balassert, balassert,
balassertTot, balassertTot,
balassertParInc, balassertParInc,
@ -128,14 +127,13 @@ vpost' acc amt ass = (post' acc amt ass){ptype=VirtualPosting, pbalanceassertion
nullsourcepos :: GenericSourcePos nullsourcepos :: GenericSourcePos
nullsourcepos = JournalSourcePos "" (1,1) nullsourcepos = JournalSourcePos "" (1,1)
nullassertion, assertion :: BalanceAssertion nullassertion :: BalanceAssertion
nullassertion = BalanceAssertion nullassertion = BalanceAssertion
{baamount=nullamt {baamount=nullamt
,batotal=False ,batotal=False
,bainclusive=False ,bainclusive=False
,baposition=nullsourcepos ,baposition=nullsourcepos
} }
assertion = nullassertion
-- | Make a partial, exclusive balance assertion. -- | Make a partial, exclusive balance assertion.
balassert :: Amount -> Maybe BalanceAssertion balassert :: Amount -> Maybe BalanceAssertion

View File

@ -827,11 +827,11 @@ transactionFromCsvRecord sourcepos rules record = t
defaultAssertion = defaultAssertion =
case mdirective "balance-type" of case mdirective "balance-type" of
Nothing -> assertion Nothing -> nullassertion
Just "=" -> assertion Just "=" -> nullassertion
Just "==" -> assertion {batotal=True} Just "==" -> nullassertion{batotal=True}
Just "=*" -> assertion {bainclusive=True} Just "=*" -> nullassertion{bainclusive=True}
Just "==*" -> assertion{batotal=True, bainclusive=True} Just "==*" -> nullassertion{batotal=True, bainclusive=True}
Just x -> error' $ unlines Just x -> error' $ unlines
[ "balance-type \"" ++ x ++"\" is invalid. Use =, ==, =* or ==*." [ "balance-type \"" ++ x ++"\" is invalid. Use =, ==, =* or ==*."
, showRecord record , 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) -- only the last posting in each commodity will have a balance assertion (#1035)
closingps = [posting{paccount = a closingps = [posting{paccount = a
,pamount = mixed [setprec $ negate b] ,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 | (a,_,_,mb) <- acctbals
-- the balances in each commodity, and for each transaction price -- 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 openingps = [posting{paccount = a
,pamount = mixed [setprec b] ,pamount = mixed [setprec b]
,pbalanceassertion = case mcommoditysum of ,pbalanceassertion = case mcommoditysum of
Just s -> Just assertion{baamount=setprec s{aprice=Nothing}} Just s -> Just nullassertion{baamount=setprec s{aprice=Nothing}}
Nothing -> Nothing Nothing -> Nothing
} }
| (a,_,_,mb) <- acctbals | (a,_,_,mb) <- acctbals