From ae490d738ff1880921cf379649432ecbed2a6ab2 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 18 May 2016 16:37:31 -0700 Subject: [PATCH] lib: Hledger.Read notes --- hledger-lib/Hledger/Read.hs | 10 ++++++---- hledger-lib/Hledger/Read/Common.hs | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hledger-lib/Hledger/Read.hs b/hledger-lib/Hledger/Read.hs index e970aef2d..2cd9a6014 100644 --- a/hledger-lib/Hledger/Read.hs +++ b/hledger-lib/Hledger/Read.hs @@ -135,7 +135,8 @@ readJournalFile :: Maybe StorageFormat -> Maybe FilePath -> Bool -> FilePath -> readJournalFile mformat mrulesfile assrt f = readFileOrStdinAnyNewline f >>= readJournal mformat mrulesfile assrt (Just f) --- | Read the given file, or standard input if the path is "-". +-- | Read the given file, or standard input if the path is "-", using +-- universal newline mode. readFileOrStdinAnyNewline :: String -> IO String readFileOrStdinAnyNewline f = do requireJournalFileExists f @@ -149,9 +150,10 @@ readFileOrStdinAnyNewline f = do -- | Call readJournalFile on each specified file path, and combine the -- resulting journals into one. If there are any errors, the first is -- returned, otherwise they are combined per Journal's monoid instance --- (concatenated, basically). Currently the parse state (eg directives --- & aliases in effect) resets at the start of each file (though the --- final parse states from all files are combined at the end). +-- (concatenated, basically). Parse context (eg directives & aliases) +-- is not maintained across file boundaries, it resets at the start of +-- each file (though the rfinal parse state saved in the resulting +-- journal is the combination of parse states from all files). readJournalFiles :: Maybe StorageFormat -> Maybe FilePath -> Bool -> [FilePath] -> IO (Either String Journal) readJournalFiles mformat mrulesfile assrt fs = do (either Left (Right . mconcat) . sequence) diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index 260ca7387..334f5ac08 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -7,7 +7,8 @@ {-| -Some common parsers and parsing helpers used by several readers. +Some common parsers and helpers used by several readers. +Some of these might belong in Hledger.Read.JournalReader or Hledger.Read. -}