;lib: reader cleanups

This commit is contained in:
Simon Michael 2020-11-08 07:18:55 -08:00
parent 74ce7be556
commit 0eddbe7a4b
2 changed files with 4 additions and 3 deletions

View File

@ -1006,7 +1006,8 @@ commodityStylesFromAmounts amts =
commamts = groupSort [(acommodity as, as) | as <- amts]
commstyles = [(c, canonicalStyleFrom $ map astyle as) | (c,as) <- commamts]
-- TODO: should probably detect and report inconsistencies here
-- TODO: should probably detect and report inconsistencies here.
-- Though, we don't have the info for a good error message, so maybe elsewhere.
-- | Given a list of amount styles (assumed to be from parsed amounts
-- in a single commodity), in parse order, choose a canonical style.
-- Traditionally it's "the style of the first, with the maximum precision of all".

View File

@ -305,11 +305,11 @@ parseAndFinaliseJournal' parser iopts f txt = do
--
-- - infer transaction-implied market prices from transaction prices
--
journalFinalise :: InputOpts -> FilePath -> Text -> Journal -> ExceptT String IO Journal
journalFinalise :: InputOpts -> FilePath -> Text -> ParsedJournal -> ExceptT String IO Journal
journalFinalise iopts f txt pj = do
t <- liftIO getClockTime
d <- liftIO getCurrentDay
-- Infer and apply canonical styles for each commodity (or fail).
-- Infer and apply canonical styles for each commodity (or throw an error).
-- This affects transaction balancing/assertions/assignments, so needs to be done early.
-- (TODO: since #903's refactoring for hledger 1.12,
-- journalApplyCommodityStyles here is seeing the