Module Typerep_lib.Type_generic.Computation.Field

Witness of a field, that is an item in a record type. The first parameter is the record type, the second is the type of the field. Example:

     type t = { x : int ; y : string }

This type has two fields. for each of them we'll have a corresponding Field.t

val field_x : (t, int) Field.t val field_y : (t, string) Field.t

type ('record, 'field) t
val label : ('a'bt ‑> string

The name of the field as it is given in the concrete syntax Examples:

       { x   : int;     (* "x" *)
         foo : string;  (* "foo" *)
         bar : float;   (* "bar" *)
       }
val index : ('a'bt ‑> int

The 0-based index of the field in the list of all fields for this record type. Example:

       type t = {
         x   : int;     (* 0 *)
         foo : string;  (* 1 *)
         bar : string;  (* 2 *)
       }
val get : ('record'fieldt ‑> 'record ‑> 'field

Field accessors. This corresponds to the dot operation. Field.get bar_field t returns the field bar of the record value t, just the same as t.bar

val is_mutable : ('a'bt ‑> bool

return whether the field is mutable, i.e. whether its declaration is prefixed with the keyword mutable

val tyid : ('a'fieldt ‑> 'field Typename.t

return the type_name of the arguments. Might be used to perform some lookup based on it

val traverse : ('a'fieldt ‑> 'field t

get the computation of the arguments

val internal_use_only : ('a'bField_internal.t ‑> ('a'bt