lib: Hledger.Read notes
This commit is contained in:
parent
20bfceff2e
commit
ae490d738f
@ -135,7 +135,8 @@ readJournalFile :: Maybe StorageFormat -> Maybe FilePath -> Bool -> FilePath ->
|
|||||||
readJournalFile mformat mrulesfile assrt f =
|
readJournalFile mformat mrulesfile assrt f =
|
||||||
readFileOrStdinAnyNewline f >>= readJournal mformat mrulesfile assrt (Just 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 :: String -> IO String
|
||||||
readFileOrStdinAnyNewline f = do
|
readFileOrStdinAnyNewline f = do
|
||||||
requireJournalFileExists f
|
requireJournalFileExists f
|
||||||
@ -149,9 +150,10 @@ readFileOrStdinAnyNewline f = do
|
|||||||
-- | Call readJournalFile on each specified file path, and combine the
|
-- | Call readJournalFile on each specified file path, and combine the
|
||||||
-- resulting journals into one. If there are any errors, the first is
|
-- resulting journals into one. If there are any errors, the first is
|
||||||
-- returned, otherwise they are combined per Journal's monoid instance
|
-- returned, otherwise they are combined per Journal's monoid instance
|
||||||
-- (concatenated, basically). Currently the parse state (eg directives
|
-- (concatenated, basically). Parse context (eg directives & aliases)
|
||||||
-- & aliases in effect) resets at the start of each file (though the
|
-- is not maintained across file boundaries, it resets at the start of
|
||||||
-- final parse states from all files are combined at the end).
|
-- 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 :: Maybe StorageFormat -> Maybe FilePath -> Bool -> [FilePath] -> IO (Either String Journal)
|
||||||
readJournalFiles mformat mrulesfile assrt fs = do
|
readJournalFiles mformat mrulesfile assrt fs = do
|
||||||
(either Left (Right . mconcat) . sequence)
|
(either Left (Right . mconcat) . sequence)
|
||||||
|
|||||||
@ -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.
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user