Common utilities for hledger data readers, such as the context (state) that is kept while parsing a journal.
- data Reader = Reader {}
- type JournalUpdate = ErrorT String IO (Journal -> Journal)
- parseJournalWith :: GenParser Char JournalContext JournalUpdate -> FilePath -> String -> ErrorT String IO Journal
- data JournalContext = Ctx {}
- emptyCtx :: JournalContext
- setYear :: Integer -> GenParser tok JournalContext ()
- getYear :: GenParser tok JournalContext (Maybe Integer)
- pushParentAccount :: String -> GenParser tok JournalContext ()
- popParentAccount :: GenParser tok JournalContext ()
- getParentAccount :: GenParser tok JournalContext String
- expandPath :: MonadIO m => SourcePos -> FilePath -> m FilePath
- fileSuffix :: FilePath -> String
Documentation
A hledger data reader is a triple of format name, format-detecting predicate, and a parser to Journal.
type JournalUpdate = ErrorT String IO (Journal -> Journal)Source
A JournalUpdate is some transformation of a Journal. It can do I/O or raise an error.
parseJournalWith :: GenParser Char JournalContext JournalUpdate -> FilePath -> String -> ErrorT String IO JournalSource
Given a JournalUpdate-generating parsec parser, file path and data string, parse and post-process a Journal so that it's ready to use, or give an error.
pushParentAccount :: String -> GenParser tok JournalContext ()Source
fileSuffix :: FilePath -> StringSource