HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Modulehledger-lib-1.52.4GHC2021

Hledger.Data.Balancing

Functions for ensuring transactions and journals are balanced.

  • 1 type
  • 1 class
  • 7 values

BalancingOpts

3 declarations
datadata BalancingOpts
#

Constructors

Instances4Eq, Ord, Show, HasBalancingOpts
classclass HasBalancingOpts c where
#
Instances2HasBalancingOpts

transaction balancing

3 declarations

Balance this isolated transaction, ensuring that its postings (and its balanced virtual postings) sum to 0, by inferring a missing amount or conversion price(s) if needed. Or if balancing is not possible, because the amounts don't sum to 0 or because there's more than one missing amount, return an error message.

Note this is not as accurate as balanceTransactionInJournal, which considers the whole journal when calculating balance assignments and balance assertions.

assertion validation

1 declaration

journal balancing

1 declaration

Infer any missing amounts and/or conversion costs (as needed to balance transactions and satisfy balance assignments); and check that all transactions are balanced; and (optional) check that all balance assertions pass. Or, return an error message (just the first error encountered).

Assumes journalStyleAmounts has been called, since amount styles affect transaction balancing.

This does multiple things at once because amount inferring, balance assignments, balance assertions and posting dates are interdependent.

tests

1 declaration