move raw ledger functions to RawLedger
This commit is contained in:
		
							parent
							
								
									26b6130a9b
								
							
						
					
					
						commit
						48700f323f
					
				| @ -287,21 +287,3 @@ pruneBoringBranches = | |||||||
|       hasbalance = (/= 0) . abalance |       hasbalance = (/= 0) . abalance | ||||||
|       hastxns = (> 0) . length . atransactions |       hastxns = (> 0) . length . atransactions | ||||||
| 
 | 
 | ||||||
| -- helpers |  | ||||||
| 
 |  | ||||||
| rawLedgerTransactions :: RawLedger -> [Transaction] |  | ||||||
| rawLedgerTransactions = txns . entries |  | ||||||
|     where |  | ||||||
|       txns :: [Entry] -> [Transaction] |  | ||||||
|       txns es = concat $ map flattenEntry $ zip es (iterate (+1) 1) |  | ||||||
| 
 |  | ||||||
| rawLedgerAccountNamesUsed :: RawLedger -> [AccountName] |  | ||||||
| rawLedgerAccountNamesUsed = accountNamesFromTransactions . rawLedgerTransactions |  | ||||||
| 
 |  | ||||||
| rawLedgerAccountNames :: RawLedger -> [AccountName] |  | ||||||
| rawLedgerAccountNames = sort . expandAccountNames . rawLedgerAccountNamesUsed |  | ||||||
| 
 |  | ||||||
| rawLedgerAccountNameTree :: RawLedger -> Tree AccountName |  | ||||||
| rawLedgerAccountNameTree l = accountNameTreeFrom $ rawLedgerAccountNames l |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -13,6 +13,7 @@ import Ledger.Utils | |||||||
| import Ledger.Types | import Ledger.Types | ||||||
| import Ledger.AccountName | import Ledger.AccountName | ||||||
| import Ledger.Entry | import Ledger.Entry | ||||||
|  | import Ledger.Transaction | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| instance Show RawLedger where | instance Show RawLedger where | ||||||
| @ -20,3 +21,18 @@ instance Show RawLedger where | |||||||
|              ((length $ entries l) + |              ((length $ entries l) + | ||||||
|               (length $ modifier_entries l) + |               (length $ modifier_entries l) + | ||||||
|               (length $ periodic_entries l)) |               (length $ periodic_entries l)) | ||||||
|  | 
 | ||||||
|  | rawLedgerTransactions :: RawLedger -> [Transaction] | ||||||
|  | rawLedgerTransactions = txns . entries | ||||||
|  |     where | ||||||
|  |       txns :: [Entry] -> [Transaction] | ||||||
|  |       txns es = concat $ map flattenEntry $ zip es (iterate (+1) 1) | ||||||
|  | 
 | ||||||
|  | rawLedgerAccountNamesUsed :: RawLedger -> [AccountName] | ||||||
|  | rawLedgerAccountNamesUsed = accountNamesFromTransactions . rawLedgerTransactions | ||||||
|  | 
 | ||||||
|  | rawLedgerAccountNames :: RawLedger -> [AccountName] | ||||||
|  | rawLedgerAccountNames = sort . expandAccountNames . rawLedgerAccountNamesUsed | ||||||
|  | 
 | ||||||
|  | rawLedgerAccountNameTree :: RawLedger -> Tree AccountName | ||||||
|  | rawLedgerAccountNameTree l = accountNameTreeFrom $ rawLedgerAccountNames l | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user