| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Hledger.Data.AccountType
Description
Helpers for working with AccountTypes.
Subtypes (Cash, Conversion, Gain, UnrealisedGain, Imbalance) are recognised as their parent type
where appropriate.
Synopsis
- isAccountSubtypeOf :: AccountType -> AccountType -> Bool
- isAssetType :: AccountType -> Bool
- isLiabilityType :: AccountType -> Bool
- isEquityType :: AccountType -> Bool
- isRevenueType :: AccountType -> Bool
- isExpenseType :: AccountType -> Bool
- accountTypeName :: AccountType -> Text
- parseAccountType :: Bool -> Text -> Either String AccountType
- accountTypeChoices :: Bool -> String
- data LotDirection
- accountTypeLotDirection :: AccountType -> Maybe LotDirection
- lotDirectionSign :: LotDirection -> Quantity
Documentation
isAccountSubtypeOf :: AccountType -> AccountType -> Bool Source #
Check whether the first argument is a subtype of the second: either equal or one of the defined subtypes.
isAssetType :: AccountType -> Bool Source #
Is this an Asset or Cash (subtype of Asset) account type ?
isLiabilityType :: AccountType -> Bool Source #
Is this a Liability account type ?
isEquityType :: AccountType -> Bool Source #
Is this an Equity or Conversion (subtype of Equity) account type ?
isRevenueType :: AccountType -> Bool Source #
Is this a Revenue or Gain (subtype of Revenue) account type ?
isExpenseType :: AccountType -> Bool Source #
Is this an Expense account type ?
accountTypeName :: AccountType -> Text Source #
An account type's long-form name (its one-letter code is its show value).
parseAccountType :: Bool -> Text -> Either String AccountType Source #
Case-insensitively parse an account type's one-letter code, or if permitted, its long-form name (or another accepted spelling of that). On failure, returns the unparseable text.
accountTypeChoices :: Bool -> String Source #
The account type codes, and if permitted their long-form names, for showing in messages.
data LotDirection Source #
Which way lots flow in a lot-tracking account. In a Long account (assets) a positive posting opens a lot and a negative one closes it; in a Short account (liabilities, holding short positions) it is the reverse: a negative posting opens a short lot and a positive one closes (covers) it.
Instances
| Eq LotDirection Source # | |
Defined in Hledger.Data.AccountType | |
| Ord LotDirection Source # | |
Defined in Hledger.Data.AccountType Methods compare :: LotDirection -> LotDirection -> Ordering (<) :: LotDirection -> LotDirection -> Bool (<=) :: LotDirection -> LotDirection -> Bool (>) :: LotDirection -> LotDirection -> Bool (>=) :: LotDirection -> LotDirection -> Bool max :: LotDirection -> LotDirection -> LotDirection min :: LotDirection -> LotDirection -> LotDirection | |
| Show LotDirection Source # | |
Defined in Hledger.Data.AccountType Methods showsPrec :: Int -> LotDirection -> ShowS show :: LotDirection -> String showList :: [LotDirection] -> ShowS | |
accountTypeLotDirection :: AccountType -> Maybe LotDirection Source #
The lot direction of an account type: Long for assets (and Cash), Short for liabilities, none for other types, which don't hold lots.
lotDirectionSign :: LotDirection -> Quantity Source #
The sign of a posting that opens a lot in this direction: 1 or -1. Multiplying a posting quantity by this gives its lot flow: positive when it opens or receives a lot, negative when it closes or sends one.