;lib: derive NFData for MultiBalanceReport, PriceGraph for criterion
Allow these to be timed with criterion at ghci prompt.
This commit is contained in:
		
							parent
							
								
									fe5c49dc36
								
							
						
					
					
						commit
						70986769ef
					
				| @ -464,7 +464,9 @@ data PriceGraph = PriceGraph { | |||||||
|     --   but those have to be Real for shortest path finding, |     --   but those have to be Real for shortest path finding, | ||||||
|     --   so we'd have to transform them all first. |     --   so we'd have to transform them all first. | ||||||
|   } |   } | ||||||
|   deriving (Show) |   deriving (Show,Generic) | ||||||
|  | 
 | ||||||
|  | instance NFData PriceGraph | ||||||
| 
 | 
 | ||||||
| -- | What kind of value conversion should be done on amounts ? | -- | What kind of value conversion should be done on amounts ? | ||||||
| -- UI: --value=cost|end|now|DATE[,COMM] | -- UI: --value=cost|end|now|DATE[,COMM] | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| {-# LANGUAGE FlexibleInstances, RecordWildCards, ScopedTypeVariables, OverloadedStrings #-} | {-# LANGUAGE FlexibleInstances, RecordWildCards, ScopedTypeVariables, OverloadedStrings, DeriveGeneric #-} | ||||||
| {-| | {-| | ||||||
| 
 | 
 | ||||||
| Multi-column balance reports, used by the balance command. | Multi-column balance reports, used by the balance command. | ||||||
| @ -20,6 +20,8 @@ module Hledger.Reports.MultiBalanceReport ( | |||||||
| ) | ) | ||||||
| where | where | ||||||
| 
 | 
 | ||||||
|  | import GHC.Generics (Generic) | ||||||
|  | import Control.DeepSeq (NFData) | ||||||
| import Data.List | import Data.List | ||||||
| import Data.Maybe | import Data.Maybe | ||||||
| import Data.Ord | import Data.Ord | ||||||
| @ -69,9 +71,13 @@ newtype MultiBalanceReport = | |||||||
|                      ,[MultiBalanceReportRow] |                      ,[MultiBalanceReportRow] | ||||||
|                      ,MultiBalanceReportTotals |                      ,MultiBalanceReportTotals | ||||||
|                      ) |                      ) | ||||||
|  |   deriving (Generic) | ||||||
|  | 
 | ||||||
| type MultiBalanceReportRow    = (AccountName, AccountName, Int, [MixedAmount], MixedAmount, MixedAmount) | type MultiBalanceReportRow    = (AccountName, AccountName, Int, [MixedAmount], MixedAmount, MixedAmount) | ||||||
| type MultiBalanceReportTotals = ([MixedAmount], MixedAmount, MixedAmount) -- (Totals list, sum of totals, average of totals) | type MultiBalanceReportTotals = ([MixedAmount], MixedAmount, MixedAmount) -- (Totals list, sum of totals, average of totals) | ||||||
| 
 | 
 | ||||||
|  | instance NFData MultiBalanceReport | ||||||
|  | 
 | ||||||
| instance Show MultiBalanceReport where | instance Show MultiBalanceReport where | ||||||
|     -- use pshow (pretty-show's ppShow) to break long lists onto multiple lines |     -- use pshow (pretty-show's ppShow) to break long lists onto multiple lines | ||||||
|     -- we add some bogus extra shows here to help it parse the output |     -- we add some bogus extra shows here to help it parse the output | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user