lib: add journalDbg, for inspecting Journal fields

This commit is contained in:
Simon Michael 2024-06-10 08:25:09 +01:00
parent a3a0f87997
commit 8d1ad8a3fe

View File

@ -21,6 +21,7 @@ module Hledger.Data.Journal (
addTransactionModifier, addTransactionModifier,
addPeriodicTransaction, addPeriodicTransaction,
addTransaction, addTransaction,
journalDbg,
journalInferMarketPricesFromTransactions, journalInferMarketPricesFromTransactions,
journalInferCommodityStyles, journalInferCommodityStyles,
journalStyleAmounts, journalStyleAmounts,
@ -182,17 +183,39 @@ instance Show Journal where
-- ++ (show $ journalTransactions l) -- ++ (show $ journalTransactions l)
where accounts = filter (/= "root") $ flatten $ journalAccountNameTree j where accounts = filter (/= "root") $ flatten $ journalAccountNameTree j
-- showJournalDebug j = unlines [ journalDbg j@Journal{..} = chomp $ unlines $
-- show j ("Journal " ++ takeFileName (journalFilePath j)++":") : -- ++ " {"
-- ,show (jtxns j) map (" "<>) [
-- ,show (jtxnmodifiers j) "jparsedefaultyear: " <> shw jparsedefaultyear
-- ,show (jperiodictxns j) ,"jparsedefaultcommodity: " <> shw jparsedefaultcommodity
-- ,show $ jparsetimeclockentries j ,"jparsedecimalmark: " <> shw jparsedecimalmark
-- ,show $ jpricedirectives j ,"jparseparentaccounts: " <> shw jparseparentaccounts
-- ,show $ jfinalcommentlines j ,"jparsealiases: " <> shw jparsealiases
-- ,show $ jparsestate j -- ,"jparsetimeclockentries: " <> shw jparsetimeclockentries
-- ,show $ map fst $ jfiles j ,"jincludefilestack: " <> shw jincludefilestack
-- ] ,"jdeclaredpayees: " <> shw jdeclaredpayees
,"jdeclaredtags: " <> shw jdeclaredtags
,"jdeclaredaccounts: " <> shw jdeclaredaccounts
,"jdeclaredaccounttags: " <> shw jdeclaredaccounttags
,"jdeclaredaccounttypes: " <> shw jdeclaredaccounttypes
,"jaccounttypes: " <> shw jaccounttypes
,"jglobalcommoditystyles: " <> shw jglobalcommoditystyles
,"jcommodities: " <> shw jcommodities
,"jinferredcommodities: " <> shw jinferredcommodities
,"jpricedirectives: " <> shw jpricedirectives
,"jinferredmarketprices: " <> shw jinferredmarketprices
,"jtxnmodifiers: " <> shw jtxnmodifiers
-- ,"jperiodictxns: " <> shw jperiodictxns
,"jtxns: " <> shw jtxns
,"jfinalcommentlines: " <> shw jfinalcommentlines
,"jfiles: " <> shw jfiles
,"jlastreadtime: " <> shw jlastreadtime
]
-- ++ ["}"]
where
shw :: Show a => a -> String
shw = show
-- shw = pshow
-- The semigroup instance for Journal is useful for two situations. -- The semigroup instance for Journal is useful for two situations.
-- --