dev: clarify missingamt/missingmixedamt docs
This commit is contained in:
parent
97943b206c
commit
c9e9145318
@ -253,11 +253,14 @@ instance Num Amount where
|
|||||||
(-) = similarAmountsOp (-)
|
(-) = similarAmountsOp (-)
|
||||||
(*) = similarAmountsOp (*)
|
(*) = similarAmountsOp (*)
|
||||||
|
|
||||||
-- | The empty simple amount.
|
-- | The empty simple amount - a zero with no commodity symbol or cost
|
||||||
|
-- and the default amount display style.
|
||||||
nullamt :: Amount
|
nullamt :: Amount
|
||||||
nullamt = Amount{acommodity="", aquantity=0, aprice=Nothing, astyle=amountstyle}
|
nullamt = Amount{acommodity="", aquantity=0, aprice=Nothing, astyle=amountstyle}
|
||||||
|
|
||||||
-- | A temporary value for parsed transactions which had no amount specified.
|
-- | A special amount used as a marker, meaning
|
||||||
|
-- "no explicit amount provided here, infer it when needed".
|
||||||
|
-- It is nullamt with commodity symbol "AUTO".
|
||||||
missingamt :: Amount
|
missingamt :: Amount
|
||||||
missingamt = nullamt{acommodity="AUTO"}
|
missingamt = nullamt{acommodity="AUTO"}
|
||||||
|
|
||||||
@ -567,11 +570,15 @@ amountKey amt@Amount{acommodity=c} = case aprice amt of
|
|||||||
nullmixedamt :: MixedAmount
|
nullmixedamt :: MixedAmount
|
||||||
nullmixedamt = Mixed mempty
|
nullmixedamt = Mixed mempty
|
||||||
|
|
||||||
-- | A temporary value for parsed transactions which had no amount specified.
|
-- | A special mixed amount used as a marker, meaning
|
||||||
|
-- "no explicit amount provided here, infer it when needed".
|
||||||
missingmixedamt :: MixedAmount
|
missingmixedamt :: MixedAmount
|
||||||
missingmixedamt = mixedAmount missingamt
|
missingmixedamt = mixedAmount missingamt
|
||||||
|
|
||||||
-- | Whether a MixedAmount has a missing amount
|
-- | Does this MixedAmount include the "missing amount" marker ?
|
||||||
|
-- Note: currently does not test for equality with missingmixedamt,
|
||||||
|
-- instead it looks for missingamt among the Amounts.
|
||||||
|
-- missingamt should always be alone, but detect it even if not.
|
||||||
isMissingMixedAmount :: MixedAmount -> Bool
|
isMissingMixedAmount :: MixedAmount -> Bool
|
||||||
isMissingMixedAmount (Mixed ma) = amountKey missingamt `M.member` ma
|
isMissingMixedAmount (Mixed ma) = amountKey missingamt `M.member` ma
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user