github ↗
docs menu

Module Talon.Kind

Kinds: the OCaml types that cells read as.

A column's Type.t is what it stores, and its kind is the OCaml type its cells read as. Several types share a kind: int8 through uint64 all read as int. Handles name a kind, never a type, so storage width never appears in user code.

Binding. A handle of kind k binds a column of type t iff provably_equal k (Type.kind t) is Some Equal. An extension column's kind is the extension kind, which no kind is provably equal to, so a handle never binds one: only an extension's declaration reads its cells.

#type 'a t

The type for kinds whose cells read as OCaml values of type 'a.

Kinds

Record columns read through Record.kind.

#val bool : bool t

bool reads bool columns.

#val int : int t

int reads the integer columns, int8 through int64 and uint8 through uint64. A value outside OCaml's int range fails when it is read.

#val float : float t

float reads float16, float32 and float64 columns.

#val string : string t

string reads string and categorical columns.

#val binary : Binary.t t

binary reads binary columns.

#val date : Time.date t

date reads date columns.

#val instant : Time.instant t

instant reads datetime columns of every unit whose clock is UTC (Instants and wall clocks). A value outside the range of Time.instant fails when it is read.

#val wall : Time.wall t

wall reads datetime columns of every unit whose clock is a wall clock (Instants and wall clocks). A value outside the range of Time.wall fails when it is read.

#val span : Time.span t

span reads duration and clock columns of every unit. A time of day reads as its span from midnight. A value outside the range of Time.span fails when it is read.

#val list : 'a t -> 'a array t

list k reads list columns whose elements k reads.

#val tensor : ('a, 'b) Nx.dtype -> ('a, 'b, Nx.host) Nx.t t

tensor dt reads tensor columns of dtype dt and any cell shape.

Comparing and formatting

#val provably_equal : 'a t -> 'b t -> ('a, 'b) Stdlib.Type.eq option

provably_equal k0 k1 is Some Equal iff k0 and k1 are the same kind, neither being nor containing the extension kind: lists are equal when their elements are, and tensors when their dtypes are. It is None otherwise, in particular for two extension kinds.

#val pp : Stdlib.Format.formatter -> 'a t -> unit

pp ppf k formats k by the name of the value that builds it: bool, int, float, string, binary, date, instant, wall and span. The record kind formats as record and the extension kind as ext. A list kind formats its element kind in brackets, as in list[float], and a tensor kind its dtype, as in tensor[float32].