Safe Haskell | None |
---|---|
Language | Haskell2010 |
Hledger.Data.AccountName
Description
AccountName
s are strings like assets:cash:petty
, with multiple
components separated by :
. From a set of these we derive the account
hierarchy.
- acctsepchar :: Char
- acctsep :: Text
- accountNameComponents :: AccountName -> [Text]
- accountNameFromComponents :: [Text] -> AccountName
- accountLeafName :: AccountName -> Text
- accountSummarisedName :: AccountName -> Text
- accountNameLevel :: AccountName -> Int
- accountNameDrop :: Int -> AccountName -> AccountName
- expandAccountNames :: [AccountName] -> [AccountName]
- expandAccountName :: AccountName -> [AccountName]
- topAccountNames :: [AccountName] -> [AccountName]
- parentAccountName :: AccountName -> AccountName
- parentAccountNames :: AccountName -> [AccountName]
- isAccountNamePrefixOf :: AccountName -> AccountName -> Bool
- isSubAccountNameOf :: AccountName -> AccountName -> Bool
- subAccountNamesFrom :: [AccountName] -> AccountName -> [AccountName]
- accountNameTreeFrom :: [AccountName] -> Tree AccountName
- nullaccountnametree :: IsString a => Tree a
- elideAccountName :: Int -> AccountName -> AccountName
- clipAccountName :: Int -> AccountName -> AccountName
- clipOrEllipsifyAccountName :: Int -> AccountName -> AccountName
- escapeName :: AccountName -> Regexp
- accountNameToAccountRegex :: AccountName -> Regexp
- accountNameToAccountOnlyRegex :: AccountName -> Regexp
- accountRegexToAccountName :: Regexp -> AccountName
- isAccountRegex :: String -> Bool
- tests_Hledger_Data_AccountName :: Test
Documentation
acctsepchar :: Char #
accountNameComponents :: AccountName -> [Text] #
accountNameFromComponents :: [Text] -> AccountName #
accountLeafName :: AccountName -> Text #
accountSummarisedName :: AccountName -> Text #
Truncate all account name components but the last to two characters.
accountNameLevel :: AccountName -> Int #
accountNameDrop :: Int -> AccountName -> AccountName #
expandAccountNames :: [AccountName] -> [AccountName] #
- "a:b:c","d:e"
- -> ["a","a:b","a:b:c","d","d:e"]
expandAccountName :: AccountName -> [AccountName] #
"a:b:c" -> ["a","a:b","a:b:c"]
topAccountNames :: [AccountName] -> [AccountName] #
- "a:b:c","d:e"
- -> ["a","d"]
parentAccountNames :: AccountName -> [AccountName] #
isAccountNamePrefixOf :: AccountName -> AccountName -> Bool #
Is the first account a parent or other ancestor of (and not the same as) the second ?
isSubAccountNameOf :: AccountName -> AccountName -> Bool #
subAccountNamesFrom :: [AccountName] -> AccountName -> [AccountName] #
From a list of account names, select those which are direct subaccounts of the given account name.
accountNameTreeFrom :: [AccountName] -> Tree AccountName #
Convert a list of account names to a tree.
nullaccountnametree :: IsString a => Tree a #
elideAccountName :: Int -> AccountName -> AccountName #
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!
clipAccountName :: Int -> AccountName -> AccountName #
Keep only the first n components of an account name, where n is a positive integer. If n is 0, returns the empty string.
clipOrEllipsifyAccountName :: Int -> AccountName -> AccountName #
Keep only the first n components of an account name, where n is a positive integer. If n is 0, returns "...".
escapeName :: AccountName -> Regexp #
accountNameToAccountRegex :: AccountName -> Regexp #
Convert an account name to a regular expression matching it and its subaccounts.
accountNameToAccountOnlyRegex :: AccountName -> Regexp #
Convert an account name to a regular expression matching it but not its subaccounts.
accountRegexToAccountName :: Regexp -> AccountName #
Convert an exact account-matching regular expression to a plain account name.
isAccountRegex :: String -> Bool #
Does this string look like an exact account-matching regular expression ?