| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Haspara.Accounting.Account
Contents
Description
This module provides definitions for acccounts and types of accounts as they are used in accounting reporting.
Synopsis
- data AccountKind
- accountKindText :: AccountKind -> Text
- data Account o = Account {
- accountKind :: !AccountKind
- accountObject :: !o
Account Kind
data AccountKind Source #
Type encoding for ledger account type.
This type covers both balance sheet and income statement account types:
- For balance sheet accounts:
- Asset (
AccountKindAsset) - Liability (
AccountKindLiability) - Equity (
AccountKindEquity) - For income statement accounts:
- Revenue (
AccountKindRevenue) - Expense (
AccountKindExpense)
FromJSON and ToJSON instances, too:
>>>Data.Aeson.decode @AccountKind "\"ASSET\""Just AccountKindAsset>>>Data.Aeson.decode @AccountKind "\"LIABILITY\""Just AccountKindLiability>>>Data.Aeson.decode @AccountKind "\"EQUITY\""Just AccountKindEquity>>>Data.Aeson.decode @AccountKind "\"REVENUE\""Just AccountKindRevenue>>>Data.Aeson.decode @AccountKind "\"EXPENSE\""Just AccountKindExpense>>>Data.Aeson.encode AccountKindAsset"\"ASSET\"">>>Data.Aeson.encode AccountKindLiability"\"LIABILITY\"">>>Data.Aeson.encode AccountKindEquity"\"EQUITY\"">>>Data.Aeson.encode AccountKindRevenue"\"REVENUE\"">>>Data.Aeson.encode AccountKindExpense"\"EXPENSE\""
Constructors
| AccountKindAsset | |
| AccountKindLiability | |
| AccountKindEquity | |
| AccountKindRevenue | |
| AccountKindExpense |
Instances
accountKindText :: AccountKind -> Text Source #
Provides textual representation of a given AccountKind.
>>>accountKindText AccountKindAsset"Asset">>>accountKindText AccountKindLiability"Liability">>>accountKindText AccountKindEquity"Equity">>>accountKindText AccountKindRevenue"Revenue">>>accountKindText AccountKindExpense"Expense"
Account
Type encoding for account values.
This definition provides both the AccountKind and an arbitrary object
identifying the account. This arbitrary nature provides flexibility to
use-site to use its own account identity and accompanying information when
required.
>>>let acc = Account AccountKindAsset (1 ::Int)>>>Data.Aeson.encode acc"{\"kind\":\"ASSET\",\"object\":1}">>>Data.Aeson.decode @(Account Int) (Data.Aeson.encode acc)Just (Account {accountKind = AccountKindAsset, accountObject = 1})>>>Data.Aeson.decode (Data.Aeson.encode acc) == Just accTrue
Constructors
| Account | |
Fields
| |
Instances
| Eq o => Eq (Account o) Source # | |
| Ord o => Ord (Account o) Source # | |
| Show o => Show (Account o) Source # | |
| Generic (Account o) Source # | |
| Hashable o => Hashable (Account o) Source # | |
Defined in Haspara.Accounting.Account | |
| ToJSON o => ToJSON (Account o) Source # | |
Defined in Haspara.Accounting.Account | |
| FromJSON o => FromJSON (Account o) Source # | |
| type Rep (Account o) Source # | |
Defined in Haspara.Accounting.Account type Rep (Account o) = D1 ('MetaData "Account" "Haspara.Accounting.Account" "haspara-0.0.0.5-EkkfyzMRwPgIJNppmBSdYM" 'False) (C1 ('MetaCons "Account" 'PrefixI 'True) (S1 ('MetaSel ('Just "accountKind") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 AccountKind) :*: S1 ('MetaSel ('Just "accountObject") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 o))) | |