package ppx_typed_fields

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file product_kind_intf.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
open Base
open Ppxlib

module type S = sig
  type t

  (* Generates the name with which an individual element is
     identified. This name is used to generate the constructor for each element. *)
  val name : int -> t -> label

  (* Retrieves the type of an element. This is the type that defines the type of
     each constructor in the t GADT.*)
  val to_type : t -> core_type

  (*
     Generates the expression which sets an element in the original
     tuple/record.

     The element to be changed is identified by the index which is position
     based in the order that the fields/elements where defined.
  *)
  val set_rhs_expression
    :  loc:location
    -> index:int
    -> element:t
    -> number_of_elements:int
    -> expression_to_set:expression
    -> expression

  (*
     Generates the expression which gets an element from the original
     tuple/record.

     The element to be retrieved is identified by the index which is position
     based in the order that the fields/elements where defined.
  *)
  val get_rhs_expression
    :  loc:location
    -> index:int
    -> element:t
    -> number_of_elements:int
    -> expression

  (*
     Generates an expression that creates a tuple/record from a creator function.
  *)
  val create_expression
    :  loc:location
    -> constructor_declarations:
         ((t * Type_kind_intf.granularity) * constructor_declaration) list
    -> expression
end