hax-0.0.2: Haskell cash-flow and tax simulation

Safe HaskellNone
LanguageHaskell2010

HAX.Accounting

Contents

Description

This module provides

  • the types to build a World of accounting Entitys 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.

Synopsis

Accounting Entities

data World Source #

Constructors

World 

Fields

data Entity Source #

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

nominalAccounts, bodyMonthly

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} alter
56

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.

withRWT :: (r' -> r) -> RWST r w () m a -> RWST r' w () m a Source #

evalRWT :: Monad m => RWST r () () m a -> r -> m a Source #

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.

readBody :: Monoid w => (s -> a) -> Acc s l w a Source #

constructs an action reading an information from the current body

withBody :: Monoid w => (s -> Acc s l w a) -> Acc s l w a Source #

construct an action that depends on the body