Safe Haskell | None |
---|---|
Language | Haskell2010 |
Most data types are defined here to avoid import cycles. Here is an overview of the hledger data model:
Journal -- a journal is read from one or more data files. It contains.. [Transaction] -- journal transactions (aka entries), which have date, status, code, description and.. [Posting] -- multiple account postings, which have account name and amount [HistoricalPrice] -- historical commodity prices Ledger -- a ledger is derived from a journal, by applying a filter specification and doing some further processing. It contains.. Journal -- a filtered copy of the original journal, containing only the transactions and postings we are interested in [Account] -- all accounts, in tree order beginning with a "root" account", with their balances and sub/parent accounts
For more detailed documentation on each type, see the corresponding modules.
- type SmartDate = (String, String, String)
- data WhichDate
- data DateSpan = DateSpan (Maybe Day) (Maybe Day)
- data Interval
- type AccountName = String
- type AccountAlias = (Regexp, Replacement)
- data Side
- type Commodity = String
- numberRepresentation :: String
- type Quantity = Decimal
- data Price
- data AmountStyle = AmountStyle {}
- data DigitGroupStyle = DigitGroups Char [Int]
- data Amount = Amount {
- acommodity :: Commodity
- aquantity :: Quantity
- aprice :: Price
- astyle :: AmountStyle
- newtype MixedAmount = Mixed [Amount]
- data PostingType
- type Tag = (String, String)
- data Posting = Posting {
- pdate :: Maybe Day
- pdate2 :: Maybe Day
- pstatus :: Bool
- paccount :: AccountName
- pamount :: MixedAmount
- pcomment :: String
- ptype :: PostingType
- ptags :: [Tag]
- pbalanceassertion :: Maybe MixedAmount
- ptransaction :: Maybe Transaction
- data Transaction = Transaction {}
- data ModifierTransaction = ModifierTransaction {
- mtvalueexpr :: String
- mtpostings :: [Posting]
- data PeriodicTransaction = PeriodicTransaction {
- ptperiodicexpr :: String
- ptpostings :: [Posting]
- data TimeLogCode
- = SetBalance
- | SetRequiredHours
- | In
- | Out
- | FinalOut
- data TimeLogEntry = TimeLogEntry {}
- data HistoricalPrice = HistoricalPrice {}
- type Year = Integer
- data JournalContext = Ctx {
- ctxYear :: !(Maybe Year)
- ctxDefaultCommodityAndStyle :: !(Maybe (Commodity, AmountStyle))
- ctxAccount :: ![AccountName]
- ctxAliases :: ![AccountAlias]
- data Journal = Journal {
- jmodifiertxns :: [ModifierTransaction]
- jperiodictxns :: [PeriodicTransaction]
- jtxns :: [Transaction]
- open_timelog_entries :: [TimeLogEntry]
- historical_prices :: [HistoricalPrice]
- final_comment_lines :: String
- jContext :: JournalContext
- files :: [(FilePath, String)]
- filereadtime :: ClockTime
- jcommoditystyles :: Map Commodity AmountStyle
- type JournalUpdate = ErrorT String IO (Journal -> Journal)
- type StorageFormat = String
- data Reader = Reader {}
- data HledgerFormatField
- data OutputFormat
- data Account = Account {
- aname :: AccountName
- aebalance :: MixedAmount
- asubs :: [Account]
- anumpostings :: Int
- aibalance :: MixedAmount
- aparent :: Maybe Account
- aboring :: Bool
- data Ledger = Ledger {}
Documentation
type AccountName = String Source
type AccountAlias = (Regexp, Replacement) Source
numberRepresentation :: String Source
The basic numeric type used in amounts. Different implementations can be selected via cabal flag for testing and benchmarking purposes.
An amount's price (none, per unit, or total) in another commodity. Note the price should be a positive number, although this is not enforced.
data AmountStyle Source
Display style for an amount.
AmountStyle | |
|
data DigitGroupStyle Source
A style for displaying digit groups in the integer part of a floating point number. It consists of the character used to separate groups (comma or period, whichever is not used as decimal point), and the size of each group, starting with the one nearest the decimal point. The last group size is assumed to repeat. Eg, comma between thousands is DigitGroups ',' [3].
Amount | |
|
newtype MixedAmount Source
data PostingType Source
Posting | |
|
data Transaction Source
Transaction | |
|
data TimeLogCode Source
data TimeLogEntry Source
data JournalContext Source
A journal "context" is some data which can change in the course of parsing a journal. An example is the default year, which changes when a Y directive is encountered. At the end of parsing, the final context is saved for later use by eg the add command.
Ctx | |
|
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.
type StorageFormat = String Source
The id of a data format understood by hledger, eg journal
or csv
.
A hledger journal reader is a triple of format name, format-detecting predicate, and a parser to Journal.
data HledgerFormatField Source
data OutputFormat Source
An account, with name, balances and links to parent/subaccounts which let you walk up or down the account tree.
Account | |
|
A Ledger has the journal it derives from, and the accounts derived from that. Accounts are accessible both list-wise and tree-wise, since each one knows its parent and subs; the first account is the root of the tree and always exists.