Module Rel_query.Bag

Bags specification language.

Bags are multisets of values (rows).

TODO

type 'a order

The type for order effects.

type unordered = unit order

The type for unordered.

type ('a, 'e) t

The type for bags, multisets of values o type 'a and an effect 'e that can be applied on it.

Bag construction

val empty : ('a, 'e) t

empty is the empty bag.

val yield : 'a value -> ('a, unordered) t

yield v is the bag with value v.

val union : ('a, 'e) t -> ('a, 'e) t -> ('a, 'e) t

union b0 b1 has the values of b0 and those of b1.

val table : 'a Rel.Table.t -> ('a, unordered) t

table t is a table from t.

Transforming and filtering

val foreach : ('a, _) t -> ('a value -> ('b, 'e) t) -> ('b, 'e) t

foreach b f are the values of b mapped by f and unioned.

val where : bool value -> ('a, 'e) t -> ('a, 'e) t

where c e is the bag e () if b whenever c is true.

Predicates

val exists : ('a, _) t -> bool value

exists b is true if b is non-empty.

val pp : Stdlib.Format.formatter -> ('a, _) t -> unit

Projections

XXX. Fundamentaly this has nothing to do here.

val proj : 'r value -> ('r, 'a) Rel.Col.t -> 'a value
val row : ('a -> 'r) -> ('a -> 'r) value
val inj : 'a -> 'a value
val tuple : ('a -> 'b) value -> 'a value -> 'b value
val const : 'a Rel.Type.t -> 'a -> 'a value