lib: Hledger.Data.Amount: showAmountCost
This commit is contained in:
parent
90415875f5
commit
e7e0b5c868
@ -88,6 +88,7 @@ module Hledger.Data.Amount (
|
|||||||
showAmount,
|
showAmount,
|
||||||
showAmountWith,
|
showAmountWith,
|
||||||
showAmountB,
|
showAmountB,
|
||||||
|
showAmountCost,
|
||||||
showAmountCostB,
|
showAmountCostB,
|
||||||
cshowAmount,
|
cshowAmount,
|
||||||
showAmountWithZeroCommodity,
|
showAmountWithZeroCommodity,
|
||||||
@ -672,6 +673,10 @@ showAmountB
|
|||||||
space = if not (T.null comm) && ascommodityspaced style then WideBuilder (TB.singleton ' ') 1 else mempty
|
space = if not (T.null comm) && ascommodityspaced style then WideBuilder (TB.singleton ' ') 1 else mempty
|
||||||
cost = if displayCost then showAmountCostB afmt a else mempty
|
cost = if displayCost then showAmountCostB afmt a else mempty
|
||||||
|
|
||||||
|
-- Show an amount's cost as @ UNITCOST or @@ TOTALCOST.
|
||||||
|
showAmountCost :: Amount -> String
|
||||||
|
showAmountCost = wbUnpack . showAmountCostB defaultFmt
|
||||||
|
|
||||||
-- Show an amount's cost as @ UNITCOST or @@ TOTALCOST (builder version).
|
-- Show an amount's cost as @ UNITCOST or @@ TOTALCOST (builder version).
|
||||||
showAmountCostB :: AmountFormat -> Amount -> WideBuilder
|
showAmountCostB :: AmountFormat -> Amount -> WideBuilder
|
||||||
showAmountCostB afmt amt = case acost amt of
|
showAmountCostB afmt amt = case acost amt of
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user