Skip to content

Commit

Permalink
lib: Hledger.Read notes
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichael committed May 18, 2016
1 parent 20bfcef commit ae490d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions hledger-lib/Hledger/Read.hs
Expand Up @@ -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
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion hledger-lib/Hledger/Read/Common.hs
Expand Up @@ -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.
-}

Expand Down

0 comments on commit ae490d7

Please sign in to comment.