cleanup
This commit is contained in:
		
							parent
							
								
									dabc30e115
								
							
						
					
					
						commit
						8a5ed9c8b9
					
				| @ -1,5 +1,7 @@ | |||||||
| module Account | module Account | ||||||
| where | where | ||||||
|  | import qualified Data.Map as Map | ||||||
|  | 
 | ||||||
| import Utils | import Utils | ||||||
| import BasicTypes | import BasicTypes | ||||||
| import AccountName | import AccountName | ||||||
| @ -13,6 +15,8 @@ import Ledger | |||||||
| -- and transactions (not including sub-accounts) | -- and transactions (not including sub-accounts) | ||||||
| type Account = (AccountName,[EntryTransaction],Amount) | type Account = (AccountName,[EntryTransaction],Amount) | ||||||
| 
 | 
 | ||||||
|  | nullacct = ("",[],nullamt) | ||||||
|  | 
 | ||||||
| aname (a,_,_) = a | aname (a,_,_) = a | ||||||
| atransactions (_,ts,_) = ts | atransactions (_,ts,_) = ts | ||||||
| abalance (_,_,b) = b | abalance (_,_,b) = b | ||||||
| @ -30,7 +34,7 @@ aggregateBalanceInAccountNamed l a = | |||||||
|     sumEntryTransactions (aggregateTransactionsInAccountNamed l a) |     sumEntryTransactions (aggregateTransactionsInAccountNamed l a) | ||||||
| 
 | 
 | ||||||
| transactionsInAccountNamed :: Ledger -> AccountName -> [EntryTransaction] | transactionsInAccountNamed :: Ledger -> AccountName -> [EntryTransaction] | ||||||
| transactionsInAccountNamed l a =  | transactionsInAccountNamed l a = | ||||||
|     ledgerTransactionsMatching (["^" ++ a ++ "$"], []) l |     ledgerTransactionsMatching (["^" ++ a ++ "$"], []) l | ||||||
| 
 | 
 | ||||||
| aggregateTransactionsInAccountNamed :: Ledger -> AccountName -> [EntryTransaction] | aggregateTransactionsInAccountNamed :: Ledger -> AccountName -> [EntryTransaction] | ||||||
|  | |||||||
| @ -22,7 +22,7 @@ branches = snd . node | |||||||
|    GOOG 500 |    GOOG 500 | ||||||
| 
 | 
 | ||||||
|    a mixed amount is one or more simple amounts: |    a mixed amount is one or more simple amounts: | ||||||
|    $50, EUR 3, APPL 500 |    $50, EUR 3, AAPL 500 | ||||||
|    HRS 16, $13.55, oranges 6 |    HRS 16, $13.55, oranges 6 | ||||||
| 
 | 
 | ||||||
|    arithmetic: |    arithmetic: | ||||||
| @ -31,9 +31,9 @@ branches = snd . node | |||||||
|    EUR0.76 + $1 = EUR 1.52 |    EUR0.76 + $1 = EUR 1.52 | ||||||
|    EUR0.76 - $1 = 0 |    EUR0.76 - $1 = 0 | ||||||
|    ($5, HRS 2) + $1 = ($6, HRS 2) |    ($5, HRS 2) + $1 = ($6, HRS 2) | ||||||
|    ($50, EUR 3, APPL 500) + ($13.55, oranges 6) = $67.51, APPL 500, oranges 6 |    ($50, EUR 3, AAPL 500) + ($13.55, oranges 6) = $67.51, AAPL 500, oranges 6 | ||||||
|    ($50, EUR 3) * $-1 = $-53.96 |    ($50, EUR 3) * $-1 = $-53.96 | ||||||
|    ($50, APPL 500) * $-1 = error |    ($50, AAPL 500) * $-1 = error | ||||||
|     |     | ||||||
| -} | -} | ||||||
| 
 | 
 | ||||||
| @ -46,6 +46,8 @@ data Amount = Amount { | |||||||
| 
 | 
 | ||||||
| instance Show Amount where show = showAmountRoundedOrZero | instance Show Amount where show = showAmountRoundedOrZero | ||||||
| 
 | 
 | ||||||
|  | nullamt = Amount "" 0 | ||||||
|  | 
 | ||||||
| showAmountRoundedOrZero :: Amount -> String | showAmountRoundedOrZero :: Amount -> String | ||||||
| showAmountRoundedOrZero (Amount cur qty) = | showAmountRoundedOrZero (Amount cur qty) = | ||||||
|     let rounded = printf "%.2f" qty in |     let rounded = printf "%.2f" qty in | ||||||
|  | |||||||
| @ -9,6 +9,8 @@ module Models ( | |||||||
|                module Account |                module Account | ||||||
|               ) |               ) | ||||||
| where | where | ||||||
|  | import qualified Data.Map as Map | ||||||
|  | 
 | ||||||
| import BasicTypes | import BasicTypes | ||||||
| import AccountName | import AccountName | ||||||
| import Entry | import Entry | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								hledger.hs
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								hledger.hs
									
									
									
									
									
								
							| @ -1,10 +1,10 @@ | |||||||
| #!/usr/bin/env runhaskell |  | ||||||
| {- | {- | ||||||
| hledger - ledger-compatible money management utilities (& haskell study) | hledger - ledger-compatible money management tool (& haskell study) | ||||||
| GPLv3, (c) Simon Michael & contributors,  | GPLv3, (c) Simon Michael & contributors | ||||||
| John Wiegley's ledger is at http://newartisans.com/ledger.html | inspired by John Wiegley's ledger at http://newartisans.com/ledger.html | ||||||
| 
 | 
 | ||||||
| modules/models are organized roughly like this: | modules/models are organized roughly like this; each layer can only | ||||||
|  | reference things below it: | ||||||
| 
 | 
 | ||||||
| hledger | hledger | ||||||
|  Options |  Options | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user