mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-07 19:28:26 +03:00
29 lines
644 B
Haskell
29 lines
644 B
Haskell
{-|
|
|
|
|
A compound data type for efficiency. An 'Account' stores
|
|
|
|
- an 'AccountName',
|
|
|
|
- all 'Transaction's (postings plus ledger transaction info) in the
|
|
account, excluding subaccounts
|
|
|
|
- a 'MixedAmount' representing the account balance, including subaccounts.
|
|
|
|
-}
|
|
|
|
module Ledger.Account
|
|
where
|
|
import Ledger.Utils
|
|
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)
|
|
|
|
instance Eq Account where
|
|
(==) (Account n1 t1 b1) (Account n2 t2 b2) = n1 == n2 && t1 == t2 && b1 == b2
|
|
|
|
nullacct = Account "" [] nullmixedamt
|
|
|