lib: reorder Amount fields for clearer debug output
This commit is contained in:
parent
2b49e17b61
commit
3b0cb701ac
@ -203,10 +203,10 @@ instance NFData Commodity
|
||||
data Amount = Amount {
|
||||
acommodity :: CommoditySymbol,
|
||||
aquantity :: Quantity,
|
||||
aprice :: Price, -- ^ the (fixed) price for this amount, if any
|
||||
astyle :: AmountStyle,
|
||||
amultiplier :: Bool -- ^ kludge: a flag marking this amount and posting as a multiplier
|
||||
amultiplier :: Bool, -- ^ kludge: a flag marking this amount and posting as a multiplier
|
||||
-- in a TMPostingRule. In a regular Posting, should always be false.
|
||||
astyle :: AmountStyle,
|
||||
aprice :: Price -- ^ the (fixed, transaction-specific) price for this amount, if any
|
||||
} deriving (Eq,Ord,Typeable,Data,Generic,Show)
|
||||
|
||||
instance NFData Amount
|
||||
|
||||
@ -630,7 +630,7 @@ amountwithoutpricep = do
|
||||
let numRegion = (offBeforeNum, offAfterNum)
|
||||
(q,prec,mdec,mgrps) <- lift $ interpretNumber numRegion suggestedStyle ambiguousRawNum mExponent
|
||||
let s = amountstyle{ascommodityside=L, ascommodityspaced=commodityspaced, asprecision=prec, asdecimalpoint=mdec, asdigitgroups=mgrps}
|
||||
return $ Amount c (sign (sign2 q)) NoPrice s mult
|
||||
return $ nullamt{acommodity=c, aquantity=sign (sign2 q), amultiplier=mult, astyle=s, aprice=NoPrice}
|
||||
|
||||
rightornosymbolamountp :: Bool -> (Decimal -> Decimal) -> JournalParser m Amount
|
||||
rightornosymbolamountp mult sign = label "amount" $ do
|
||||
@ -646,7 +646,7 @@ amountwithoutpricep = do
|
||||
suggestedStyle <- getAmountStyle c
|
||||
(q,prec,mdec,mgrps) <- lift $ interpretNumber numRegion suggestedStyle ambiguousRawNum mExponent
|
||||
let s = amountstyle{ascommodityside=R, ascommodityspaced=commodityspaced, asprecision=prec, asdecimalpoint=mdec, asdigitgroups=mgrps}
|
||||
return $ Amount c (sign q) NoPrice s mult
|
||||
return $ nullamt{acommodity=c, aquantity=sign q, amultiplier=mult, astyle=s, aprice=NoPrice}
|
||||
-- no symbol amount
|
||||
Nothing -> do
|
||||
suggestedStyle <- getDefaultAmountStyle
|
||||
@ -657,7 +657,7 @@ amountwithoutpricep = do
|
||||
let (c,s) = case (mult, defcs) of
|
||||
(False, Just (defc,defs)) -> (defc, defs{asprecision=max (asprecision defs) prec})
|
||||
_ -> ("", amountstyle{asprecision=prec, asdecimalpoint=mdec, asdigitgroups=mgrps})
|
||||
return $ Amount c (sign q) NoPrice s mult
|
||||
return $ nullamt{acommodity=c, aquantity=sign q, amultiplier=mult, astyle=s, aprice=NoPrice}
|
||||
|
||||
-- For reducing code duplication. Doesn't parse anything. Has the type
|
||||
-- of a parser only in order to throw parse errors (for convenience).
|
||||
|
||||
Loading…
Reference in New Issue
Block a user