HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Modulehledger-lib-1.52.4GHC2021

Hledger.Data.Account

An Account has a name, a list of subaccounts, an optional parent account, and subaccounting-excluding and -including balances.

  • 27 values

Derive 1. an account tree and 2. each account's total exclusive and inclusive changes associated with dates from a list of postings and a function for associating a date to each posting (usually representing the start dates of report subperiods). This is the core of the balance command (and of *ledger). The accounts are returned as a tree.

Derive 1. an account tree and 2. each account's total exclusive and inclusive changes associated with dates from a list of postings and a function for associating a date to each posting (usually representing the start dates of report subperiods). This is the core of the balance command (and of *ledger). The accounts are returned as a list in flattened tree order, and also reference each other as a tree. (The first account is the root of the tree.)

valueaccountTree :: Monoid a => AccountName -> [AccountName] -> Account a
#

Convert a list of account names to a tree of Account objects, with just the account names filled in and an empty balance. A single root account with the given name is added.

Remove subaccounts below the specified depth, aggregating their balance at the depth limit (accounts at the depth limit will have any sub-balances merged into their exclusive balance). If the depth is Nothing, return the original accounts

valueflattenAccounts :: Account a -> [Account a]
#

Flatten an account tree into a list, which is sometimes convenient. Note since accounts link to their parents/subs, the tree's structure remains intact and can still be used. It's a tree/list!

Sort account names by the order in which they were declared in the journal, at each level of the account tree (ie within each group of siblings). Undeclared accounts are sorted last and alphabetically. This is hledger's default sort for reports organised by account. The account list is converted to a tree temporarily, adding any missing parents; these can be kept (suitable for a tree-mode report) or removed (suitable for a flat-mode report).

Sort each group of siblings in an account tree by declaration order, then account name. So each group will contain first the declared accounts, in the same order as their account directives were parsed, and then the undeclared accounts, sorted by account name.

Orphan instances

2 instances