From 598129ad6a56957f7147d5e61c09851c36efb79c Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 22 Sep 2018 21:06:29 -1000 Subject: [PATCH] lib: pushAccount -> pushDeclaredAccount --- hledger-lib/Hledger/Read/Common.hs | 6 +++--- hledger-lib/Hledger/Read/JournalReader.hs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index bd985e74c..c760c3d3a 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -39,7 +39,7 @@ module Hledger.Read.Common ( getDefaultCommodityAndStyle, getDefaultAmountStyle, getAmountStyle, - pushAccount, + pushDeclaredAccount, pushParentAccount, popParentAccount, getParentAccount, @@ -265,8 +265,8 @@ getAmountStyle commodity = do let effectiveStyle = listToMaybe $ catMaybes [specificStyle, defaultStyle] return effectiveStyle -pushAccount :: AccountName -> JournalParser m () -pushAccount acct = modify' (\j -> j{jdeclaredaccounts = (acct, Nothing) : jdeclaredaccounts j}) +pushDeclaredAccount :: AccountName -> JournalParser m () +pushDeclaredAccount acct = modify' (\j -> j{jdeclaredaccounts = acct : jdeclaredaccounts j}) pushParentAccount :: AccountName -> JournalParser m () pushParentAccount acct = modify' (\j -> j{jparseparentaccounts = acct : jparseparentaccounts j}) diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index 11eff94d9..50a7e32c3 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -265,8 +265,7 @@ accountdirectivep = do let macode :: Maybe AccountCode = read <$> macode' newline skipMany indentedlinep - - modify' (\j -> j{jdeclaredaccounts = (acct, macode) : jdeclaredaccounts j}) + pushDeclaredAccount acct indentedlinep :: JournalParser m String indentedlinep = lift (skipSome spacenonewline) >> (rstrip <$> lift restofline)