package tbls

  1. Overview
  2. Docs

Module Tbls.TypesSource

Shared domain types for the tbls pipeline.

Sourcetype span = {
  1. columns : int;
  2. rows : int;
}

Cell span. Version 1 requires columns = 1 and rows = 1.

Sourcetype cell_content =
  1. | Lines of string list
    (*

    Cell content as a list of display lines. Single-line cells have one element. Embedded line breaks are normalised at construction.

    *)
Sourcetype cell = {
  1. content : cell_content;
  2. span : span;
}

A table cell. Contains no rendering or backend-specific information.

Sourcetype column_type =
  1. | Integer
    (*

    All non-null values parse as integers.

    *)
  2. | Float
    (*

    All non-null values parse as floats.

    *)
  3. | Text
    (*

    Mixed or non-numeric values.

    *)
  4. | Missing
    (*

    All values are null or empty.

    *)

Inferred column type. Determined by Infer; independent of output backend. Null cells do not participate in type inference.

Sourcetype alignment =
  1. | Left
  2. | Right
  3. | Center
    (*

    Horizontal cell alignment. Fully resolved before document generation.

    *)
Sourcetype column_layout = {
  1. width : int;
  2. alignment : alignment;
}

Computed layout for one column. width is the Unicode display width of the widest cell in the column, including the header.

Sourcetype column_metadata = {
  1. label : string option;
  2. inferred_type : column_type;
  3. layout : column_layout;
}

Per-column metadata produced by Analyze. One record per column.

Sourcetype rendered_cell = {
  1. text : string;
  2. semantic_type : column_type;
}

A cell after formatting. text is the display string; semantic_type drives alignment inference and may be discarded after layout.

Sourcetype error =
  1. | Column_count_mismatch of {
    1. expected : int;
    2. got : int;
    }
    (*

    A row has a different column count than expected.

    *)
  2. | Empty_table
    (*

    Input contains no data rows.

    *)
  3. | Span_not_supported
    (*

    A cell span larger than 1×1 was supplied; not supported in v1.

    *)

Expected failures across the pipeline. Always returned as result values; never raised as exceptions.

Sourceval pp_span : Format.formatter -> span -> unit
Sourceval pp_cell_content : Format.formatter -> cell_content -> unit
Sourceval pp_cell : Format.formatter -> cell -> unit
Sourceval pp_column_type : Format.formatter -> column_type -> unit
Sourceval pp_alignment : Format.formatter -> alignment -> unit
Sourceval pp_column_layout : Format.formatter -> column_layout -> unit
Sourceval pp_column_metadata : Format.formatter -> column_metadata -> unit
Sourceval pp_rendered_cell : Format.formatter -> rendered_cell -> unit
Sourceval pp_error : Format.formatter -> error -> unit

Pretty-printers for use with Alcotest.testable.