Module Rel_query.Private

Low-level private representations.

For the language extender and backend writer. Subject to change even between minor versions of the library.

Rows

Operators

type ('a, 'b) unop = ..

The type for unary operations on base values of type 'a returning values of type 'b.

type unop +=
  1. | Neg : 'a Rel.Type.t -> ('a, 'a) unop
    (*

    Negation.

    *)

Predefined unary operations.

type ('a, 'b) binop = ..

The type for binary operations on base values of type 'a returning values of type 'b.

type arith =
  1. | Add
  2. | Sub
  3. | Div
  4. | Mul
    (*

    The type for arithmetic operators.

    *)
type cmp =
  1. | Eq
  2. | Neq
  3. | Lt
  4. | Leq
  5. | Gt
  6. | Geq
    (*

    The type for comparison operators.

    *)
type binop +=
  1. | Arith : arith * 'a Rel.Type.t -> ('a, 'a) binop
  2. | Cmp : cmp * 'a Rel.Type.t -> ('a, bool) binop
  3. | And : (bool, bool) binop
  4. | Or : (bool, bool) binop

Predefined binary operations.

Values and bags

type 'a value' = 'a value
type 'a value =
  1. | Var : string -> 'a value
  2. | Const : 'a Rel.Type.t * 'a -> 'a value
  3. | Unop : ('a, 'b) unop * 'a value -> 'b value
  4. | Binop : ('a, 'b) binop * 'a value * 'a value -> 'b value
  5. | Proj : 'b value * ('b, 'a) Rel.Col.t -> 'a value
  6. | Row : 'a -> 'a value
  7. | Tuple : ('a -> 'b) value * 'a value -> 'b value
  8. | Exists : ('b, 'e) bag -> bool value

The type for values of type 'a. This represents an expression computing a value of type 'a.

and ('a, 'e) bag =
  1. | Table : 'a Rel.Table.t -> ('a, 'e) bag
  2. | Empty : ('a, 'e) bag
  3. | Yield : 'a value -> ('a, 'e) bag
  4. | Union : ('a, 'e) bag * ('a, 'e) bag -> ('a, 'e) bag
  5. | Foreach : ('a, _) bag * ('a value -> ('b, 'e) bag) -> ('b, 'e) bag
  6. | Where : bool value * ('a, 'e) bag -> ('a, 'e) bag

The type for bags. See Bag.t.

val value_to_value : 'a value' -> 'a value

value_to_value v is the repressentation of v.

val bag_to_bag : ('a, 'e) Bag.t -> ('a, 'e) bag

bag_to_bag b is the representation of b.

Formatters

val pp_value : Stdlib.Format.formatter -> 'a value -> unit

pp_value formats values.

val pp_bag : Stdlib.Format.formatter -> ('a, 'e) bag -> unit

pp_bag formats bags.