lib: Improve documentation for StringFormat, remove type alias for Valuation.
This commit is contained in:
		
							parent
							
								
									1171c23eee
								
							
						
					
					
						commit
						64e3e5c54d
					
				| @ -31,10 +31,12 @@ import Hledger.Utils.Test | |||||||
| 
 | 
 | ||||||
| -- | A format specification/template to use when rendering a report line item as text. | -- | A format specification/template to use when rendering a report line item as text. | ||||||
| -- | -- | ||||||
| -- A format is a sequence of components; each is either a literal | -- A format is an optional width, along with a sequence of components; | ||||||
| -- string, or a hledger report item field with specified width and | -- each is either a literal string, or a hledger report item field with | ||||||
| -- justification whose value will be interpolated at render time. | -- specified width and justification whose value will be interpolated | ||||||
| -- This includes an optional width for any overlines. | -- at render time. The optional width determines the length of the | ||||||
|  | -- overline to draw above the totals row; if it is Nothing, then the | ||||||
|  | -- maximum width of all lines is used. | ||||||
| -- | -- | ||||||
| -- A component's value may be a multi-line string (or a | -- A component's value may be a multi-line string (or a | ||||||
| -- multi-commodity amount), in which case the final string will be | -- multi-commodity amount), in which case the final string will be | ||||||
|  | |||||||
| @ -82,9 +82,6 @@ type CompoundBalanceReport = CompoundPeriodicReport DisplayName MixedAmount | |||||||
| -- type alias just to remind us which AccountNames might be depth-clipped, below. | -- type alias just to remind us which AccountNames might be depth-clipped, below. | ||||||
| type ClippedAccountName = AccountName | type ClippedAccountName = AccountName | ||||||
| 
 | 
 | ||||||
| -- Type alias for a valuation function |  | ||||||
| type Valuation = Day -> MixedAmount -> MixedAmount |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| -- | Generate a multicolumn balance report for the matched accounts, | -- | Generate a multicolumn balance report for the matched accounts, | ||||||
| -- showing the change of balance, accumulated balance, or historical balance | -- showing the change of balance, accumulated balance, or historical balance | ||||||
| @ -241,7 +238,7 @@ makeReportQuery ropts reportspan | |||||||
|     dateqcons        = if date2_ ropts then Date2 else Date |     dateqcons        = if date2_ ropts then Date2 else Date | ||||||
| 
 | 
 | ||||||
| -- | Make a valuation function for valuating MixedAmounts and a given Day | -- | Make a valuation function for valuating MixedAmounts and a given Day | ||||||
| makeValuation :: ReportOpts -> Journal -> PriceOracle -> Valuation | makeValuation :: ReportOpts -> Journal -> PriceOracle -> Day -> MixedAmount -> MixedAmount | ||||||
| makeValuation ropts j priceoracle day = case value_ ropts of | makeValuation ropts j priceoracle day = case value_ ropts of | ||||||
|     Nothing -> id |     Nothing -> id | ||||||
|     Just v  -> mixedAmountApplyValuation priceoracle styles day mreportlast (today_ ropts) multiperiod v |     Just v  -> mixedAmountApplyValuation priceoracle styles day mreportlast (today_ ropts) multiperiod v | ||||||
| @ -331,7 +328,7 @@ acctChangesFromPostings ropts ps = HM.fromList [(aname a, a) | a <- as] | |||||||
| -- | Accumulate and value amounts, as specified by the report options. | -- | Accumulate and value amounts, as specified by the report options. | ||||||
| -- | -- | ||||||
| -- Makes sure all report columns have an entry. | -- Makes sure all report columns have an entry. | ||||||
| accumValueAmounts :: ReportOpts -> Valuation -> [DateSpan] | accumValueAmounts :: ReportOpts -> (Day -> MixedAmount -> MixedAmount) -> [DateSpan] | ||||||
|                   -> HashMap ClippedAccountName Account |                   -> HashMap ClippedAccountName Account | ||||||
|                   -> HashMap ClippedAccountName (Map DateSpan Account) |                   -> HashMap ClippedAccountName (Map DateSpan Account) | ||||||
|                   -> HashMap ClippedAccountName (Map DateSpan Account) |                   -> HashMap ClippedAccountName (Map DateSpan Account) | ||||||
| @ -369,7 +366,7 @@ accumValueAmounts ropts valuation colspans startbals acctchanges =  -- PARTIAL: | |||||||
| -- | Lay out a set of postings grouped by date span into a regular matrix with rows | -- | Lay out a set of postings grouped by date span into a regular matrix with rows | ||||||
| -- given by AccountName and columns by DateSpan, then generate a MultiBalanceReport | -- given by AccountName and columns by DateSpan, then generate a MultiBalanceReport | ||||||
| -- from the columns. | -- from the columns. | ||||||
| generateMultiBalanceReport :: ReportOpts -> Journal -> Valuation -> [DateSpan] | generateMultiBalanceReport :: ReportOpts -> Journal -> (Day -> MixedAmount -> MixedAmount) -> [DateSpan] | ||||||
|                            -> Map DateSpan [Posting] -> HashMap AccountName Account |                            -> Map DateSpan [Posting] -> HashMap AccountName Account | ||||||
|                            -> MultiBalanceReport |                            -> MultiBalanceReport | ||||||
| generateMultiBalanceReport ropts j valuation colspans colps startbals = report | generateMultiBalanceReport ropts j valuation colspans colps startbals = report | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user