1 {-| 2 3 A compound data type for efficiency. An 'Account' stores 4 5 - an 'AccountName', 6 7 - all 'Transaction's (postings plus ledger transaction info) in the 8 account, excluding subaccounts 9 10 - a 'MixedAmount' representing the account balance, including subaccounts. 11 12 -} 13 14 module Ledger.Account 15 where 16 import Ledger.Utils 17 import Ledger.Types 18 import Ledger.Amount 19 20 21 instance Show Account where 22 show (Account a ts b) = printf "Account %s with %d txns and %s balance" a (length ts) (showMixedAmount b) 23 24 instance Eq Account where 25 (==) (Account n1 t1 b1) (Account n2 t2 b2) = n1 == n2 && t1 == t2 && b1 == b2 26 27 nullacct = Account "" [] nullmixedamt 28