Module InferBase.PolyFields

type 'r t

Datastructure for polymorphic getters of record fields

type 'r sub =
| S : ('r'f) InferStdlib.IStd.Field.t * 'f t -> 'r sub
type ('r, 'a) user = {
f : f. string -> ('r -> 'f) -> 'a;
}
val make : ?⁠subfields:'r sub list -> ((_'r'r t) InferStdlib.IStd.Field.user -> 'r t list) -> 'r t

Pass Fields.map_poly generated by @@deriving fields for the record 'r you are interested in to get the polymorphic getters of the fields of 'r. A dummy field "ALL" is added too.

Subfields appearing in subfields will be added too. Each subfield is specified by S (field, poly_fields) where field is the corresponding Field.t value (generated by @@deriving fields) and poly_fields is the result of this function for the field record type.

val map : 'r t -> ('r'a) user -> 'a list

map r f maps each field of r with the function f. f is called with two arguments: the name and the getter of the field.