package typerep_extended

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

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, 'b) t -> 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, 'b) t -> 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, 'field) t -> '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, 'b) t -> bool

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

val tyid : ('a, 'field) t -> 'field Typerep_lib.Typename.t

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

val traverse : ('a, 'field) t -> 'field t

get the computation of the arguments

val internal_use_only : ('a, 'b) Field_internal.t -> ('a, 'b) t