Validate a complete UTF-8 source for quotation or file import.
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.
from_quote : Str -> Try(QIF, [BadQuotedBytes(Str)])
Convert a checked source quotation.
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 one completely framed bank, cash, or credit-card record.
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.
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.
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.
A single ordered field, including repeated split/address/extension lines.
A terminated raw record. Section is the current !Type value or Account.
Header changes and complete records in original order.
Gregorian date, without an invented timezone or time of day.
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.