QIF

:= { events : List(Event) }

Incremental Quicken Interchange Format records and bank/cash/card decoding. Raw events preserve section changes, field order and repeated unknown fields. Typed decoding requires D and T and rejects ambiguous dates by default.

validate : ValidationProps -> Try(QIF, [InvalidQif(Error)])

Validate a complete UTF-8 source for quotation or file import.

parse_str : Str, Props -> Try(QIF, [InvalidQif(Error)])

Parse all raw QIF events from UTF-8 text. Text is already decoded; encoding applies only to byte entrypoints.

parse_bytes : List(U8), Props -> Try(QIF, [InvalidQif(Error)])

Parse raw bytes with explicit encoding and resource limits.

parser : Props -> Parser(Bytes, QIF, Problem)

Composable complete-document raw parser.

decoder : Props -> Decoder

Configure raw events for .read_iter(chunks) or .read_stream(source).

transaction_decoder : Props -> TransactionDecoder

Configure typed bank, cash, and card transactions.

transactions : QIF, Props -> Try(List(Transaction), [InvalidQif(Error)])

Decode a complete document's bank/cash/card records without losing raw fields.

decode : Record, Props -> Try(Transaction, [InvalidQif(Error)])

Decode one completely framed bank, cash, or credit-card record.

field : Record, U8 -> Try(Str, [Missing])

First matching field. Raw fields retain all duplicate occurrences.

amount_to_dec : Str -> Try(Dec, [BadNumStr])

Convert an exact amount to Roc Dec, failing on unsupported precision/range.

write_event : Event, WriteProps -> Try(List(U8), [InvalidQif(Error)])

Encode a header or complete raw record atomically.

encoder : WriteProps -> Encoder({ section : Str, account : Str }, Event, [InvalidQif(Error)])

Validate each complete event atomically before emitting bytes.

encode : QIF, WriteProps -> Try(List(U8), [InvalidQif(Error), InvalidChunkSize(Diagnostic(ChunkSizeProblem))])

Write a complete document; streaming writers use the same per-record encoder.

Location : { offset : U64, line : U64, column : U64 }

Exact original-byte location of a record or diagnostic.

Resource : [RecordBytes, LineBytes, ContextBytes, Fields]

A located syntax, encoding, limit or decoding failure.

Problem : [LimitExceeded({ resource : Resource, max : U64, observed : Observed }), IncompleteInput, MissingRecordTerminator, UnsupportedSection(Str), DuplicateCoreField, MissingField(U8), InvalidDate({ value : Excerpt, order : DateOrder }), InvalidAmount(Excerpt), InvalidSplitAmount, MissingSplitCategory, InvalidHeader(Str), InvalidField(Field), UnrepresentableCharacter(TextEncoding), InvalidChunkSize, ContextMismatch({ expected : { section : Str, account : Str }, actual : { section : Str, account : Str } }), NulCharacter, HeaderBeforeTerminator, MissingSection, InvalidFieldCode(U8), InvalidEncoding({ encoding : TextEncoding, error : EncodingError })]
Error : Diagnostic(Problem)
TextEncoding : TextEncoding

Supported byte encodings. ASCII input is valid UTF-8.

DateOrder : [RejectAmbiguous, MonthFirst, DayFirst, YearFirst]

Date order is explicit when both first components could be months.

Props

:= { encoding : TextEncoding ?? Utf8, date_order : DateOrder ?? RejectAmbiguous, max_line_bytes : U64 ?? 1_048_576, max_record_bytes : U64 ?? 16_777_216, max_fields : U64 ?? 65_536, max_context_bytes : U64 ?? 65_536, errors : RecoveryProps ?? {} }

Limits apply to original bytes before decoding.

Field : { code : U8, value : Str }

A single ordered field, including repeated split/address/extension lines.

Record : { section : Str, account : Str, fields : List(Field), at : Location }

A terminated raw record. Section is the current !Type value or Account.

Event : [Header(Str), Record(Record)]

Header changes and complete records in original order.

Date : { year : U64, month : U64, day : U64 }

Gregorian date, without an invented timezone or time of day.

Split : { category : Str, memo : Str, amount : Str }

A split retains its exact amount and optional memo.

Transaction : { raw : Record, date : Date, amount : Str, payee : Str, memo : Str, number : Str, category : Str, cleared : Str, splits : List(Split) }

A decoded transaction retains its raw record and exact monetary spelling.

WriteProps

:= { encoding : TextEncoding ?? Utf8, line_ending : [Lf, CrLf, Cr] ?? CrLf, max_record_bytes : U64 ?? 16_777_216, chunk_bytes : U64 ?? 65_536 }

Writer layout and encoding. Invalid values fail before a record is emitted.

ValidationProps

:= { source : Str, name : Str ?? "<literal>", options : Props ?? {} }

Quoted/imported source with the same parser options as runtime parsing.

Decoder : Decoder(DecoderState, Event, [InvalidQif(Error)])

Configured raw-event decoder. Scanner buffers and coordinates are private.

TransactionEvent : [Header(Str), Account(Record), Context(Record), Transaction(Transaction)]

Typed events retain section and account context.

TransactionDecoder : Decoder(DecoderState, TransactionEvent, [InvalidQif(Error)])

Configured transaction decoder with the same bounded scanner state.