# Index of values

A
add_register_hook [Ppx_deriving] | `add_register_hook hook` adds `hook` to be executed whenever a new deriver is registered.
attr [Ppx_deriving] | `attr ~deriver name attrs` searches for an attribute `[@deriving.deriver.attr]` in `attrs` if any attribute with name starting with `@deriving.deriver` exists, or `[@deriver.attr]` if any attribute with name starting with `@deriver` exists, or `[@attr]` otherwise.
attr_warning [Ppx_deriving] | `attr_warning expr` builds the attribute `@ocaml.warning expr`
B
binop_reduce [Ppx_deriving] | `binop_reduce` ≡ `fun x a b -> [%expr [%e x] [%e a] [%e b]]`.
bool [Ppx_deriving.Arg] | `bool expr` extracts a boolean constant from `expr`, or returns `Result.Error "boolean"` if `expr` does not contain a boolean literal.
C
char [Ppx_deriving.Arg] | `char expr` extracts a char constant from `expr`, or returns `Result.Error "char"` if `expr` does not contain a char literal.
core_type_of_type_decl [Ppx_deriving] | `core_type_of_type_decl type_` constructs type `('a, 'b, ...) t` for type declaration `type ('a, 'b, ...) t = ...`.
core_type_of_type_ext [Ppx_deriving] | Same as `Ppx_deriving.core_type_of_type_decl` but for type extension.
create [Ppx_deriving] | Creating `Ppx_deriving.deriver` structure.
create_quoter [Ppx_deriving] | `quoter ()` creates an empty quoter.
D
derivers [Ppx_deriving] | `derivers ()` returns all currently registered derivers.
E
enum [Ppx_deriving.Arg] | `enum values expr` extracts a polymorphic variant constant from `expr`, or returns `Result.Error "one of: `a, `b, ..."` if `expr` does not contain a polymorphic variant constructor included in `values`.
expand_path [Ppx_deriving] | `expand_path name` returns `name` with the `path` module path prepended, e.g.
expr [Ppx_deriving.Arg] | `expr` returns the input expression as-is.
F
fold_exprs [Ppx_deriving] | `fold_exprs ~unit fn exprs` folds `exprs` using head of `exprs` as initial accumulator value, or `unit` if `exprs = []`.
fold_left_type_decl [Ppx_deriving] | `fold_left_type_decl fn accum type_` performs a left fold over all type variable (i.e.
fold_left_type_ext [Ppx_deriving] | `fold_left_type_ext fn accum type_` performs a left fold over all type variable (i.e.
fold_right_type_decl [Ppx_deriving] | `fold_right_type_decl fn accum type_` performs a right fold over all type variable (i.e.
fold_right_type_ext [Ppx_deriving] | `fold_right_type_ext fn accum type_` performs a right fold over all type variable (i.e.
free_vars_in_core_type [Ppx_deriving] | `free_vars_in_core_type typ` returns unique free variables in `typ` in lexical order.
fresh_var [Ppx_deriving] | `fresh_var bound` returns a fresh variable name not present in `bound`.
G
get_attr [Ppx_deriving.Arg] | `get_attr ~deriver conv attr` extracts the expression from `attr` and converts it with `conv`, raising `Location.Error` if `attr` is not a structure with a single expression or `conv` fails; or returns `None` if `attr` is `None`.
get_expr [Ppx_deriving.Arg] | `get_expr ~deriver conv exp` converts expression `exp` with `conv`, raising `Location.Error` if `conv` fails.
get_flag [Ppx_deriving.Arg] | `get_flag ~deriver attr` returns `true` if `attr` is an empty attribute or `false` if it is absent, raising `Location.Error` if `attr` is not a structure.
H
hash_variant [Ppx_deriving] | `hash_variant x` ≡ `Btype.hash_variant x`.
I
instantiate [Ppx_deriving] | `instantiate bound type_` returns `typ, vars, bound'` where `typ` is a type instantiated from type declaration `type_`, `vars` ≡ `free_vars_in_core_type typ` and `bound'` ≡ `bound @ vars`.
int [Ppx_deriving.Arg] | `int expr` extracts an integer constant from `expr`, or returns `Result.Error "integer"` if `expr` does not contain an integer literal.
L
list [Ppx_deriving.Arg] | `list f expr` extracts a list constant from `expr` and maps every element through `f`, or returns `Result.Error "list:..."` where `...` is the error returned by `f`, or returns `Result.Error "list"` if `expr` does not contain a list.
lookup [Ppx_deriving] | `lookup name` looks up a deriver called `name`.
M
mangle_lid [Ppx_deriving] | `mangle_lid ~fixpoint affix lid` does the same as `Ppx_deriving.mangle_type_decl`, but for the last component of `lid`.
mangle_type_decl [Ppx_deriving] | `mangle_type_decl ~fixpoint affix type_` derives a function name from `type_` name by doing nothing if `type_` is named `fixpoint` (`"t"` by default), or appending and/or prepending `affix` via an underscore.
mapper [Ppx_deriving] | The mapper for the currently loaded deriving plugins.
P
path_of_type_decl [Ppx_deriving] | `path_of_type_decl ~path type_` returns `path` if `type_` does not have a manifest or the manifest is not a constructor, and the module path of manifest otherwise.
poly_apply_of_type_decl [Ppx_deriving] | `poly_apply_of_type_decl type_ expr` wraps `expr` into `expr poly_N` for every type parameter `'N` present in `type_`.
poly_apply_of_type_ext [Ppx_deriving] | Same as `Ppx_deriving.poly_apply_of_type_decl` but for type extension.
poly_arrow_of_type_decl [Ppx_deriving] | `poly_arrow_of_type_decl fn type_ typ` wraps `typ` in an arrow with `fn [%type: 'N]` as argument for every type parameter `'N` present in `type_`.
poly_arrow_of_type_ext [Ppx_deriving] | Same as `Ppx_deriving.poly_arrow_of_type_decl` but for type extension.
poly_fun_of_type_decl [Ppx_deriving] | `poly_fun_of_type_decl type_ expr` wraps `expr` into `fun poly_N -> ...` for every type parameter `'N` present in `type_`.
poly_fun_of_type_ext [Ppx_deriving] | Same as `Ppx_deriving.poly_fun_of_type_decl` but for type extension.
Q
quote [Ppx_deriving] | `quote quoter expr` records a pure expression `expr` within `quoter` and returns an expression which has the same value as `expr` in the context that `sanitize` provides.
R
raise_errorf [Ppx_deriving] | `raise_error` is a shorthand for raising `Location.Error` with the result of `Location.errorf`.
register [Ppx_deriving] | `register deriver` registers `deriver` according to its `name` field.
remove_pervasives [Ppx_deriving] | `remove_pervasives ~deriver typ` removes the leading "Pervasives." module name in longidents.
S
sanitize [Ppx_deriving] | `sanitize module_ quoter expr` wraps `expr` in a way that ensures that the contents of `module_` and `Pervasives`, as well as the identifiers in expressions returned by `quote` are in scope, and returns the wrapped expression.
seq_reduce [Ppx_deriving] | When `sep` is present: `seq_reduce` ≡ `fun x a b -> [%expr [%e a]; [%e x]; [%e b]]`.
string [Ppx_deriving.Arg] | `string expr` extracts a string constant from `expr`, or returns `Result.Error "string"` if `expr` does not contain a string literal.
string_of_core_type [Ppx_deriving] | `string_of_core_type typ` unparses `typ`, omitting any attributes.
strong_type_of_type [Ppx_deriving] | `strong_type_of_type ty` transform a type ty to `freevars . ty`, giving a strong polymorphic type
W
with_quoter [Ppx_deriving] | `with_quoter fn` ≡ `fun fn a -> let quoter = create_quoter () in sanitize ~quoter (fn quoter a)`