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.AccountName

AccountNames are strings like assets:cash:petty, with multiple components separated by :. From a set of these we derive the account hierarchy.

  • 48 values
  • Packagehledger-lib-1.52.4
  • Exports48
  • LanguageGHC2021
  • LicenceGPL-3.0-or-later
  • SourceAccountName.hs

Remove some number of account name components from the front of the account name. If the special "unbudgeted" top-level account is present, it is preserved and dropping affects the rest of the account name.

The level (depth) of an account name.

Example3 expressions
accountNameLevel ""  -- special case0accountNameLevel "assets"1accountNameLevel "assets:cash"2

Regular expressions matching common English top-level account names, used as a fallback when account types are not declared.

Clip an account name to a given DepthSpec, first checking whether it matches any of the regular expressions controlling depth. If so, clip to the depth of the most specific of those matches, i.e. the one which starts matching the latest as you progress up the parents of the account. Otherwise clip to the flat depth provided, or return the full name if Nothing.

Calculate the depth to which an account name should be clipped for a given DepthSpec.

First checking whether the account name matches any of the regular expressions controlling depth. If so, clip to the depth of the most specific of those matches, i.e. the one which starts matching the latest as you progress up the parents of the account. Otherwise clip to the flat depth provided, or return the full name if Nothing.

Elide an account name to fit in the specified width. From the ledger 2.6 news:

  What Ledger now does is that if an account name is too long, it will
  start abbreviating the first parts of the account name down to two
  letters in length.  If this results in a string that is still too
  long, the front will be elided -- not the end.  For example:

    Expenses:Cash           ; OK, not too long
    Ex:Wednesday:Cash       ; Expenses was abbreviated to fit
    Ex:We:Afternoon:Cash    ; Expenses and Wednesday abbreviated
    ; Expenses:Wednesday:Afternoon:Lunch:Snack:Candy:Chocolate:Cash
    ..:Af:Lu:Sn:Ca:Ch:Cash  ; Abbreviated and elided!
valueescapeName :: AccountName -> Text
#

Escape an AccountName for use within a regular expression. >>> putStr . T.unpack $ escapeName "First?!#$*?$(*) !^#*? %)*!#" First?!#$*?$\* !^#*? %)*!#

Sorted unique account names implied by these account names, ie these plus all their parent accounts up to the root. Eg: ["a:b:c","d:e"] -> ["a","a:b","a:b:c","d","d:e"]

A top-level account prefixed to some accounts in budget reports. Defined here so it can be ignored by accountNameDrop.

Join account names into one. If any of them has () or [] posting type indicators, these (the first type encountered) will also be applied to the resulting account name.