lib: Hledger.Data.Amount: showAmountCost

This commit is contained in:
Simon Michael 2025-01-15 13:21:25 -10:00
parent 90415875f5
commit e7e0b5c868

View File

@ -88,6 +88,7 @@ module Hledger.Data.Amount (
showAmount,
showAmountWith,
showAmountB,
showAmountCost,
showAmountCostB,
cshowAmount,
showAmountWithZeroCommodity,
@ -672,6 +673,10 @@ showAmountB
space = if not (T.null comm) && ascommodityspaced style then WideBuilder (TB.singleton ' ') 1 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).
showAmountCostB :: AmountFormat -> Amount -> WideBuilder
showAmountCostB afmt amt = case acost amt of