package diff
Module Diff.FieldSource
This module contains what might be described as faux lenses. This includes support for composition, getting, setting, etc.
An open type that represents a field on a record.
For example,
type t = {
x : int
}would be described as X : (t, int) field.
A polymorphic function that returns the field's value from the type.
A polymorphic function that returns the type with the field set to the value.
name f returns the previously registered name for f, if one exists.
cons l r is a field that first indexes l and then r.
opt_map f monadically binds f into an optional field.
register ?name field getter setter registers getter and setter (and optionally name) to field.
get v field gets field from v, raising Diff_field error on exception.
get_opt v field gets field from v, returning None on exception.
get_opt v field gets field from v, returning Error (`Diff_field e) on exception.
set v field x sets field in v to x, raising Diff_field error on exception
set_opt v field x sets field in v to x, returning None on exception