Gist.FieldOperating on fields.
Fields represent components of products which are used to represent OCaml's tuples, records and variants cases.
type 'a gist := 'a ttype ('p, 'f) t = ('p, 'f) fieldThe type for representing the field of type 'f of a product of type 'p.
val make :
?meta:('p, 'f) field Meta.t ->
?name:string ->
?inject:('p -> 'f -> 'p) ->
?set:('p -> 'f -> unit) ->
?default:'f ->
'f gist ->
('p -> 'f) ->
('p, 'f) fieldv g project is a field such that:
g is the type representation of the field.project projects the field value from the product.meta is the metadata (defaults to Meta.empty).name is the name for the field (defaults to ""). For record fields this is the field name. For variant case this is the case name. For tuples this is the empty string or a name for a type abbreviation.inject is an immutable update function to update the field of the prodcut (defaults to None).set is a mutable update function to set the field of the product, for mutable record fields (defaults to None).default is a default value for the dimension (defaults to None).val name : ('p, 'f) field -> stringname f is the name of f (if any).
val project : ('p, 'f) field -> 'p -> 'fproject f is the projection function of f.
val inject : ('p, 'f) field -> ('p -> 'f -> 'p) optioninject f is the optional immutable function of f.
val set : ('p, 'f) field -> ('p -> 'f -> unit) optionset f is the optional mutable function of f.
val default : ('p, 'f) field -> 'f optiondefault f is a default value for the field.