hledger-lib-0.11.1: Core types and utilities for working with hledger (or c++ ledger) data.

Hledger.Read.Common

Description

Common utilities for hledger data readers, such as the context (state) that is kept while parsing a journal.

Synopsis

Documentation

data Reader Source

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.

data JournalContext Source

Some state kept while parsing a journal file.

Constructors

Ctx 

Fields

ctxYear :: !(Maybe Integer)

the default year most recently specified with Y

ctxCommod :: !(Maybe String)

I don't know

ctxAccount :: ![String]

the current stack of parent accounts specified by !account