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.Read.RulesReader

A reader for a CSV rules file. This reads the actual data from a file specified by a source rule or from a similarly-named file in the same directory.

Most of the code for reading rules files and csv files is in this module.

  • 9 values
  • Packagehledger-lib-1.52.4
  • Exports9
  • LanguageGHC2021
  • LicenceGPL-3.0-or-later
  • SourceRulesReader.hs

Reader

1 declaration

Misc.

7 declarations
valuereadRules :: FilePath -> ExceptT String IO CsvRules
#

An exception-throwing IO action that reads and validates the specified CSV rules file (which may include other rules files).

Read a Journal from the given CSV data (and filename, used for error messages), or return an error. Proceed as follows:

  1. Conversion rules are provided, or they are parsed from the specified rules file, or from the default rules file for the CSV data file. If rules parsing fails, or the required rules file does not exist, throw an error.

  2. Parse the CSV data using the rules, or throw an error.

  3. Convert the CSV records to hledger transactions using the rules.

  4. Return the transactions as a Journal.

Detect from a balance assertion's syntax (=, ==, =*, ==*) whether it is (a) total (multi-commodity) and (b) subaccount-inclusive. Returns nothing if invalid syntax was provided.

Tests

1 declaration

Orphan instances

1 instance