penny-lib-0.4.0.0: Extensible double-entry accounting system - library

Safe HaskellSafe-Infered

Penny.Lincoln.Transaction

Contents

Description

Transactions, the heart of Penny. The Transaction data type is abstract, so that only this module can create Transactions. This provides assurance that if a Transaction exists, it is a valid, balanced Transaction. In addition, the Posting data type is abstract as well, so you know that if you have a Posting, it was created as part of a balanced Transaction.

Functions prefixed with a p query a particular posting for its properties. Functions prefixed with a t query transactions. Every transaction has a single DateTime, and all the postings have this same DateTime, so there is no function to query a posting's DateTime. Just query the parent transaction. For other things such as Number and Flag, the transaction might have data and the posting might have data as well, so functions are provided to query both.

Often you will want to query a single posting and have a function that gives you, for example, the posting's flag if it has one, or the transaction's flag if it has one, or Nothing if neither the posting nor the transaction has a flag. The functions in Penny.Lincoln.Queries do that.

Synopsis

Postings and transactions

data Posting Source

Each Transaction consists of at least two Postings.

Instances

data Transaction Source

All the Postings in a Transaction must produce a Total whose debits and credits are equal. That is, the Transaction must be balanced. No Transactions are created that are not balanced.

data PostFam Source

Instances

Making transactions

data Error Source

Errors that can arise when making a Transaction.

Instances

Querying postings

data Inferred Source

Indicates whether the entry for this posting was inferred. That is, if the user did not supply an entry for this posting, then it was inferred.

Constructors

Inferred 
NotInferred 

Instances

changePostingMeta :: (PostingMeta -> PostingMeta) -> Transaction -> TransactionSource

Change the metadata on a posting.

Querying transactions

data TopLine Source

The TopLine holds information that applies to all the postings in a transaction (so named because in a ledger file, this information appears on the top line.)

Instances

postFam :: Transaction -> [PostFam]Source

Get the Postings from a Transaction, with information on the sibling Postings.

changeTransactionMetaSource

Arguments

:: (TopLineMeta -> TopLineMeta)

Function that, when applied to the old top line meta, returns the new meta.

-> Transaction

The old transaction with metadata

-> Transaction

Transaction with new metadata

Change the metadata on a transaction.

Adding serials

Box

data Box m Source

A box stores a family of transaction data along with metadata. The transaction is stored in child form, indicating a particular posting of interest. The metadata is in addition to the metadata associated with the TopLine and with each posting.

Constructors

Box 

Fields

boxMeta :: m
 
boxPostFam :: PostFam
 

Instances

Functor Box 
Show m => Show (Box m)