Module Valet

val unsingleton : 'a list -> 'a

Returns the one element in a list, and fails if there are none or multiple.

val map_vars_in_pattern : (string Ppxlib.Asttypes.loc -> Ppxlib.pattern_desc) -> Ppxlib.pattern -> Ppxlib.pattern

Map over variables in a pattern, calling its argument for each Ppat_var.

val vars_in_pattern : Ppxlib.pattern -> string list

Returns the variables from a pattern.

val add_type_constraints_to_binding : (string * (Ppxlib.location * Ppxlib.core_type)) list -> Ppxlib.value_binding -> Ppxlib.value_binding

Add type constraints from vals to a binding. If the pattern is a simple variable, uses pvb_constraint. Otherwise, uses Ppat_constraint on all variables in the pattern.

val merge_vals_let : loc:Ppxlib__.Location.t -> (string * (Ppxlib.location * Ppxlib.core_type)) list -> Ppxlib__.Import.Asttypes.rec_flag -> Ppxlib.value_binding list -> Ppxlib__.Import.structure_item

Merge a list of val statements into the let-binding that directly follows them.

val impl : Ppxlib.structure_item list -> Ppxlib.structure_item list

Go through the whole file, collect val statements and merge them into the let-binding that directly follows them, using merge_vals_let.