Safe Haskell | None |
---|
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
- = NoInterval
- | Days Int
- | Weeks Int
- | Months Int
- | Quarters Int
- | Years Int
- | DayOfMonth Int
- | DayOfWeek Int
- type AccountName = String
- data Side
- type Commodity = String
- type Quantity = Double
- data Price
- = NoPrice
- | UnitPrice Amount
- | TotalPrice Amount
- data AmountStyle = AmountStyle {
- ascommodityside :: Side
- ascommodityspaced :: Bool
- asprecision :: Int
- asdecimalpoint :: Char
- asseparator :: Char
- asseparatorpositions :: [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 {
- tlcode :: TimeLogCode
- tldatetime :: LocalTime
- tlcomment :: String
- data HistoricalPrice = HistoricalPrice {
- hdate :: Day
- hcommodity :: Commodity
- hamount :: Amount
- type Year = Integer
- data JournalContext = Ctx {
- ctxYear :: !(Maybe Year)
- ctxCommodityAndStyle :: !(Maybe (Commodity, AmountStyle))
- ctxAccount :: ![AccountName]
- ctxAliases :: ![(AccountName, AccountName)]
- 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 Format = String
- data Reader = Reader {}
- data HledgerFormatField
- = AccountField
- | DefaultDateField
- | DescriptionField
- | TotalField
- | DepthSpacerField
- | FieldNo Int
- data FormatString
- = FormatLiteral String
- | FormatField Bool (Maybe Int) (Maybe Int) HledgerFormatField
- data Account = Account {
- aname :: AccountName
- aebalance :: MixedAmount
- asubs :: [Account]
- aibalance :: MixedAmount
- aparent :: Maybe Account
- aboring :: Bool
- data Ledger = Ledger {}
Documentation
DateSpan (Maybe Day) (Maybe Day) |
NoInterval | |
Days Int | |
Weeks Int | |
Months Int | |
Quarters Int | |
Years Int | |
DayOfMonth Int | |
DayOfWeek Int |
type AccountName = StringSource
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 | |
|
Eq AmountStyle | |
Data AmountStyle | |
Ord AmountStyle | |
Read AmountStyle | |
Show AmountStyle | |
Typeable AmountStyle |
Amount | |
|
newtype MixedAmount Source
Eq MixedAmount | |
Data MixedAmount | |
Num MixedAmount | |
Ord MixedAmount | |
Show MixedAmount | |
Typeable MixedAmount |
data PostingType Source
Posting | |
|
data Transaction Source
Transaction | |
|
data ModifierTransaction Source
ModifierTransaction | |
|
data PeriodicTransaction Source
PeriodicTransaction | |
|
data TimeLogCode Source
Eq TimeLogCode | |
Data TimeLogCode | |
Ord TimeLogCode | |
Read TimeLogCode | |
Show TimeLogCode | |
Typeable TimeLogCode |
data TimeLogEntry Source
TimeLogEntry | |
|
Eq TimeLogEntry | |
Data TimeLogEntry | |
Ord TimeLogEntry | |
Show TimeLogEntry | |
Typeable TimeLogEntry |
data HistoricalPrice Source
HistoricalPrice | |
|
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.
A hledger journal reader is a triple of format name, format-detecting predicate, and a parser to Journal.
Show Reader |
data HledgerFormatField Source
Eq HledgerFormatField | |
Show HledgerFormatField |
data FormatString Source
FormatLiteral String | |
FormatField Bool (Maybe Int) (Maybe Int) HledgerFormatField |
Eq FormatString | |
Show FormatString |
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.
Show Ledger |