module Product: Generic_core_product'a product is a GADT whose type parameter is of the form:
t0 * (t1 * (t2 * ... * (tn * unit) ...))
The values are lists of witnesses 'a ty reflecting the
components of the product.
module T:sig..end
product datatype and is meant
to be open so that constructors can be used in pattern
matching.
type'at ='a T.product=
| |
Nil : |
| |
Cons : |
Product.T.product might be refered to as Product.tp0 to p6 build products from 0 to 6 types.val p0 : unit t
val p1 : 'a Ty.T.ty -> ('a * unit) t
val p2 : 'a Ty.T.ty ->
'b Ty.T.ty -> ('a * ('b * unit)) t
val p3 : 'a Ty.T.ty ->
'b Ty.T.ty ->
'c Ty.T.ty -> ('a * ('b * ('c * unit))) t
val p4 : 'a Ty.T.ty ->
'b Ty.T.ty ->
'c Ty.T.ty ->
'd Ty.T.ty ->
('a * ('b * ('c * ('d * unit)))) t
val p5 : 'a Ty.T.ty ->
'b Ty.T.ty ->
'c Ty.T.ty ->
'd Ty.T.ty ->
'e Ty.T.ty ->
('a * ('b * ('c * ('d * ('e * unit))))) t
val p6 : 'a Ty.T.ty ->
'b Ty.T.ty ->
'c Ty.T.ty ->
'd Ty.T.ty ->
'e Ty.T.ty ->
'f Ty.T.ty ->
('a * ('b * ('c * ('d * ('e * ('f * unit)))))) t
module Build:sig..end
open Build to bring p0 to p6 in scope
val fold : (Ty.ty' -> 'b -> 'b) -> 'b -> 'a t -> 'bList.fold_rightval length : 'a t -> intList.lengthval list_of_prod : 'a t -> Ty.ty' list
Just like Generic_core_ty.dyn is the union of all types, we define
Generic_core_product.dynprod, the union of all product types. Each
value must be tagged with the witness of its product type.
type'atuple ='a t * 'a
type dynprod =
| |
Dynprod : |
val list_of_dynprod : dynprod -> Ty.dyn listval dynprod_of_list : Ty.dyn list -> dynprod