more informative show output
This commit is contained in:
parent
165945cf20
commit
b3ba124ce9
@ -37,11 +37,14 @@ import Ledger.Entry
|
||||
|
||||
|
||||
instance Show Ledger where
|
||||
show l = printf "Ledger with %d entries, %d accounts"
|
||||
show l = printf "Ledger with %d entries, %d accounts: %s"
|
||||
((length $ entries $ rawledger l) +
|
||||
(length $ modifier_entries $ rawledger l) +
|
||||
(length $ periodic_entries $ rawledger l))
|
||||
(length $ accountnames l)
|
||||
(show $ accountnames l)
|
||||
++ "\n" ++ (showtree $ accountnametree l)
|
||||
++ "\n" ++ (showtree $ filteredaccountnametree l)
|
||||
|
||||
-- | Convert a raw ledger to a more efficient cached type, described above.
|
||||
cacheLedger :: RawLedger -> Ledger
|
||||
|
||||
@ -109,6 +109,9 @@ treeany f t = (f $ root t) || (any (treeany f) $ branches t)
|
||||
-- treedrop -- remove the leaves which do fulfill predicate.
|
||||
-- treedropall -- do this repeatedly.
|
||||
|
||||
showtree :: Show a => Tree a -> String
|
||||
showtree = drawTree . treemap show
|
||||
|
||||
-- debugging
|
||||
|
||||
strace a = trace (show a) a -- trace a showable expression
|
||||
|
||||
Loading…
Reference in New Issue
Block a user