hledger-lib-1.3: Core data types, parsers and functionality for the hledger accounting tools

Safe Haskell | None
Language | Haskell2010

Hledger.Read.CsvReader

Contents

- Reader
- Misc.
- Tests
- Orphan instances

Description

A reader for CSV data, using an extra rules file to help interpret the data.

Synopsis

- reader :: Reader
- type CsvRecord = [String]
- rulesFileFor :: FilePath -> FilePath
- parseRulesFile :: FilePath -> ExceptT String IO CsvRules
- parseAndValidateCsvRules :: FilePath -> Text -> ExceptT String IO CsvRules
- expandIncludes :: FilePath -> Text -> IO Text
- transactionFromCsvRecord :: SourcePos -> CsvRules -> CsvRecord -> Transaction
- tests_Hledger_Read_CsvReader :: Test

# Reader

reader :: Reader #

# Misc.

type CsvRecord = [String] #

rulesFileFor :: FilePath -> FilePath #

parseRulesFile :: FilePath -> ExceptT String IO CsvRules #

An error-throwing action that parses this file's content as CSV conversion rules, interpolating any included files first, and runs some extra validation checks.

parseAndValidateCsvRules :: FilePath -> Text -> ExceptT String IO CsvRules #

An error-throwing action that parses this text as CSV conversion rules and runs some extra validation checks. The file path is for error messages.

expandIncludes :: FilePath -> Text -> IO Text #

Look for hledger rules file-style include directives in this text, and interpolate the included files, recursively. Included file paths may be relative to the directory of the provided file path. This is a cheap hack to avoid rewriting the CSV rules parser.

transactionFromCsvRecord :: SourcePos -> CsvRules -> CsvRecord -> Transaction #

# Tests

tests_Hledger_Read_CsvReader :: Test #

# Orphan instances

ShowErrorComponent String # |
Methods showErrorComponent :: String -> String #