| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
HAX.Accounting
Description
This module provides
- the types to build a
Worldof accountingEntitys and - functions to compute the ledger resulting from the entities' accounting actions
- built from combinators found in Bookkeeping and Assets.
Use Report to display the results.
- data World = World {}
- data Entity = Body body => Entity {
- entName :: EntityName
- entAssets :: [AssetName]
- entMonthlyAction :: AccountingRW body ()
- entBody :: body
- class Body body where
- simple :: ADate -> body -> AccountingRW body a -> IO a
- generate :: World -> IO FullLedger
- withRWT :: (r' -> r) -> RWST r w () m a -> RWST r' w () m a
- evalRWT :: Monad m => RWST r () () m a -> r -> m a
- checkTransactionalAcountSymmetry :: (Monoid w, Ledger l) => [EntityName] -> Acc s l w ()
- readBody :: Monoid w => (s -> a) -> Acc s l w a
- withBody :: Monoid w => (s -> Acc s l w a) -> Acc s l w a
Accounting Entities
An entity keeping accounts over its assets.
Constructors
| Body body => Entity | |
Fields
| |
class Body body where Source #
The body of an entity.
Minimal complete definition
Methods
nominalAccounts :: body -> [String] Source #
The only requirement is that each Body has a list of nominal accounts associated with it. See Germany for instances.
bodyMonthly :: AccountingRW body () -> AccountingRW body () Source #
Running actions and generating ledgers
simple :: ADate -> body -> AccountingRW body a -> IO a Source #
Executes an accounting action in a simple environment (for testing purposes) with no accounts.
>>>simple (date 12 2016) NatuerlichePerson{pGeburt=date 12 1960} alter56
generate :: World -> IO FullLedger Source #
Generate the ledger of the World. It will include all nominal
and asset accounts of all n entities, as well as 'n*(n-1)'
transactional accounts between each pair of entities.
Furthermore, it will check the balances of these transactional
accounts at the end of every month using
checkTransactionalAcountSymmetry.
Helpers
checkTransactionalAcountSymmetry :: (Monoid w, Ledger l) => [EntityName] -> Acc s l w () Source #
For each pair of entities, entity1 and entity2, there are two
transactional accounts, as each entity keeps its own books about
its transactions with the other entity. If no entity made a
mistake, the accounts should have opposite balances that cancel
each other. This function informs about a violation of this
property.