From 66267780125b691e4b7db4c30e25b0868029154d Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 25 Apr 2019 18:07:36 -0700 Subject: [PATCH] lib: amountValue, commodityValue doc cleanups --- hledger-lib/Hledger/Data/Amount.hs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/hledger-lib/Hledger/Data/Amount.hs b/hledger-lib/Hledger/Data/Amount.hs index 17c032b19..8485d39a8 100644 --- a/hledger-lib/Hledger/Data/Amount.hs +++ b/hledger-lib/Hledger/Data/Amount.hs @@ -444,9 +444,10 @@ canonicaliseAmount styles a@Amount{acommodity=c, astyle=s} = a{astyle=s'} where s' = findWithDefault s c styles --- | Find the market value of this amount on the given date in its --- default valuation commodity, using the given market prices which --- are expected to be in parse order. +-- | Find the market value of this amount on the given valuation date +-- in its default valuation commodity (that of the latest applicable +-- market price before the valuation date). +-- The given market prices are expected to be in parse order. -- If no default valuation commodity can be found, the amount is left -- unchanged. amountValue :: [MarketPrice] -> Day -> Amount -> Amount @@ -457,14 +458,10 @@ amountValue ps d a@Amount{acommodity=c} = -- (This is here not in Commodity.hs to use the Amount Show instance above for debugging.) -- --- | Find the market value, if known, of one unit of the given --- commodity (A), on the given valuation date, in the commodity (B) --- mentioned in the latest applicable market price. --- The applicable price is obtained from the given market prices, --- which are expected to be in parse order. --- It is the price with the latest date on or before the valuation --- date, or if there are multiple prices on that date, the last one --- parsed. +-- | Find the market value of one unit of the given commodity +-- on the given valuation date in its default valuation commodity +-- (that of the latest applicable market price before the valuation date). +-- The given market prices are expected to be in parse order. commodityValue :: [MarketPrice] -> Day -> CommoditySymbol -> Maybe Amount commodityValue ps valuationdate c = case ps' of