lib: rename finaliseJournal -> journalFinalise

This commit is contained in:
Simon Michael 2020-05-23 09:45:35 -07:00
parent 36a2e311df
commit 40c296a446
2 changed files with 8 additions and 8 deletions

View File

@ -45,7 +45,7 @@ module Hledger.Read.Common (
journalSourcePos, journalSourcePos,
parseAndFinaliseJournal, parseAndFinaliseJournal,
parseAndFinaliseJournal', parseAndFinaliseJournal',
finaliseJournal, journalFinalise,
setYear, setYear,
getYear, getYear,
setDefaultCommodityAndStyle, setDefaultCommodityAndStyle,
@ -260,7 +260,7 @@ parseAndFinaliseJournal parser iopts f txt = do
Left finalParseError -> throwError $ finalErrorBundlePretty $ attachSource f txt finalParseError Left finalParseError -> throwError $ finalErrorBundlePretty $ attachSource f txt finalParseError
Right ep -> case ep of Right ep -> case ep of
Left e -> throwError $ customErrorBundlePretty e Left e -> throwError $ customErrorBundlePretty e
Right pj -> finaliseJournal iopts f txt pj Right pj -> journalFinalise iopts f txt pj
-- | Like parseAndFinaliseJournal but takes a (non-Erroring) JournalParser. -- | Like parseAndFinaliseJournal but takes a (non-Erroring) JournalParser.
-- Used for timeclock/timedot. -- Used for timeclock/timedot.
@ -276,7 +276,7 @@ parseAndFinaliseJournal' parser iopts f txt = do
-- see notes above -- see notes above
case ep of case ep of
Left e -> throwError $ customErrorBundlePretty e Left e -> throwError $ customErrorBundlePretty e
Right pj -> finaliseJournal iopts f txt pj Right pj -> journalFinalise iopts f txt pj
-- | Post-process a Journal that has just been parsed or generated, in this order: -- | Post-process a Journal that has just been parsed or generated, in this order:
-- --
@ -290,8 +290,8 @@ parseAndFinaliseJournal' parser iopts f txt = do
-- --
-- - check balance assertions if enabled. -- - check balance assertions if enabled.
-- --
finaliseJournal :: InputOpts -> FilePath -> Text -> Journal -> ExceptT String IO Journal journalFinalise :: InputOpts -> FilePath -> Text -> Journal -> ExceptT String IO Journal
finaliseJournal iopts f txt pj = do journalFinalise iopts f txt pj = do
t <- liftIO getClockTime t <- liftIO getClockTime
-- Infer and apply canonical styles for each commodity (or fail). -- Infer and apply canonical styles for each commodity (or fail).
-- This affects transaction balancing/assertions/assignments, so needs to be done early. -- This affects transaction balancing/assertions/assignments, so needs to be done early.

View File

@ -81,7 +81,7 @@ import Text.Printf (printf)
import Hledger.Data import Hledger.Data
import Hledger.Utils import Hledger.Utils
import Hledger.Read.Common (Reader(..),InputOpts(..),amountp, statusp, genericSourcePos, finaliseJournal) import Hledger.Read.Common (Reader(..),InputOpts(..),amountp, statusp, genericSourcePos, journalFinalise)
--- ** doctest setup --- ** doctest setup
-- $setup -- $setup
@ -111,9 +111,9 @@ parse iopts f t = do
let rulesfile = mrules_file_ iopts let rulesfile = mrules_file_ iopts
r <- liftIO $ readJournalFromCsv rulesfile f t r <- liftIO $ readJournalFromCsv rulesfile f t
case r of Left e -> throwError e case r of Left e -> throwError e
Right pj -> finaliseJournal iopts{ignore_assertions_=True} f t pj' Right pj -> journalFinalise iopts{ignore_assertions_=True} f t pj'
where where
-- finaliseJournal assumes the journal's items are -- journalFinalise assumes the journal's items are
-- reversed, as produced by JournalReader's parser. -- reversed, as produced by JournalReader's parser.
-- But here they are already properly ordered. So we'd -- But here they are already properly ordered. So we'd
-- better preemptively reverse them once more. XXX inefficient -- better preemptively reverse them once more. XXX inefficient