hledger/Ledger/Account.hs

29 lines
644 B
Haskell
Raw Normal View History

{-|
2009-04-04 00:55:49 +04:00
A compound data type for efficiency. An 'Account' stores
- an 'AccountName',
2009-04-05 02:38:36 +04:00
- all 'Transaction's (postings plus ledger transaction info) in the
2009-04-04 00:55:49 +04:00
account, excluding subaccounts
2009-04-05 02:38:36 +04:00
- a 'MixedAmount' representing the account balance, including subaccounts.
-}
module Ledger.Account
where
import Ledger.Utils
2008-10-03 04:12:59 +04:00
import Ledger.Types
import Ledger.Amount
instance Show Account where
show (Account a ts b) = printf "Account %s with %d txns and %s balance" a (length ts) (showMixedAmount b)
2008-10-18 04:52:49 +04:00
instance Eq Account where
(==) (Account n1 t1 b1) (Account n2 t2 b2) = n1 == n2 && t1 == t2 && b1 == b2
2008-11-22 20:21:49 +03:00
nullacct = Account "" [] nullmixedamt