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, cleared status, code, description and.. [Posting] -- multiple account postings, which have account name and amount [MarketPrice] -- historical market prices for commodities 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)
- type Year = Integer
- type Month = Int
- type Quarter = Int
- type YearWeek = Int
- type MonthWeek = Int
- type YearDay = Int
- type MonthDay = Int
- type WeekDay = Int
- data Period
- data Interval
- type AccountName = Text
- data AccountAlias
- data Side
- type Quantity = Decimal
- data Price
- data AmountStyle = AmountStyle {}
- data DigitGroupStyle = DigitGroups Char [Int]
- type CommoditySymbol = Text
- data Commodity = Commodity {}
- data Amount = Amount {}
- newtype MixedAmount = Mixed [Amount]
- data PostingType
- type TagName = Text
- type TagValue = Text
- type Tag = (TagName, TagValue)
- data Status
- data Posting = Posting {
- pdate :: Maybe Day
- pdate2 :: Maybe Day
- pstatus :: Status
- paccount :: AccountName
- pamount :: MixedAmount
- pcomment :: Text
- ptype :: PostingType
- ptags :: [Tag]
- pbalanceassertion :: Maybe Amount
- ptransaction :: Maybe Transaction
- porigin :: Maybe Posting
- data GenericSourcePos
- data Transaction = Transaction {}
- data ModifierTransaction = ModifierTransaction {
- mtvalueexpr :: Text
- mtpostings :: [Posting]
- data PeriodicTransaction = PeriodicTransaction {
- ptperiodicexpr :: Text
- ptpostings :: [Posting]
- data TimeclockCode
- = SetBalance
- | SetRequiredHours
- | In
- | Out
- | FinalOut
- data TimeclockEntry = TimeclockEntry {}
- data MarketPrice = MarketPrice {}
- data Journal = Journal {
- jparsedefaultyear :: Maybe Year
- jparsedefaultcommodity :: Maybe (CommoditySymbol, AmountStyle)
- jparseparentaccounts :: [AccountName]
- jparsealiases :: [AccountAlias]
- jparsetimeclockentries :: [TimeclockEntry]
- jaccounts :: [AccountName]
- jcommodities :: Map CommoditySymbol Commodity
- jinferredcommodities :: Map CommoditySymbol AmountStyle
- jmarketprices :: [MarketPrice]
- jmodifiertxns :: [ModifierTransaction]
- jperiodictxns :: [PeriodicTransaction]
- jtxns :: [Transaction]
- jfinalcommentlines :: Text
- jfiles :: [(FilePath, Text)]
- jlastreadtime :: ClockTime
- type ParsedJournal = Journal
- type StorageFormat = String
- data Reader = Reader {}
- data Account = Account {
- aname :: AccountName
- aebalance :: MixedAmount
- asubs :: [Account]
- anumpostings :: Int
- aibalance :: MixedAmount
- aparent :: Maybe Account
- aboring :: Bool
- data Ledger = Ledger {}
Documentation
type AccountName = Text Source #
data AccountAlias Source #
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].
type CommoditySymbol = Text Source #
Amount | |
|
newtype MixedAmount Source #
data PostingType Source #
The status of a transaction or posting, recorded with a status mark (nothing, !, or *). What these mean is ultimately user defined.
Posting | |
|
data GenericSourcePos Source #
The position of parse errors (eg), like parsec's SourcePos but generic.
GenericSourcePos FilePath Int Int | name, 1-based line number and 1-based column number. |
JournalSourcePos FilePath (Int, Int) | file name, inclusive range of 1-based line numbers (first, last). |
data Transaction Source #
Transaction | |
|
data ModifierTransaction Source #
data PeriodicTransaction Source #
data TimeclockCode Source #
data MarketPrice Source #
MarketPrice | |
|
A Journal, containing transactions and various other things. The basic data model for hledger.
This is used during parsing (as the type alias ParsedJournal), and then finalised/validated for use as a Journal. Some extra parsing-related fields are included for convenience, at least for now. In a ParsedJournal these are updated as parsing proceeds, in a Journal they represent the final state at end of parsing (used eg by the add command).
Journal | |
|
type ParsedJournal = Journal Source #
A journal in the process of being parsed, not yet finalised. The data is partial, and list fields are in reverse order.
type StorageFormat = String Source #
The id of a data format understood by hledger, eg journal
or csv
.
The --output-format option selects one of these for output.
A hledger journal reader is a triple of storage format name, a detector of that format, and a parser from that format to Journal.
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.