Ppx_deriving_toolsSourceA collection of tools to make it easy to build ppx deriving plugins.
handles registration of the deriver
val register_combined :
?deps:Ppxlib.Deriving.t list ->
Ppxlib.label ->
deriving list ->
Ppxlib.Deriving.tmultiple derivers can be registered under the same name
not_supported what terminates ppx with an error message telling what unsupported.
val gen_tuple :
loc:Ppxlib.location ->
Ppxlib.label ->
int ->
Ppxlib.pattern list * Ppxlib.expressionlet patts, expr = gen_tuple label n in ... creates a tuple expression and a corresponding list of patterns.
Auxiliary functions to generate record expressions and patterns.
val gen_record :
loc:Ppxlib.location ->
Ppxlib.label ->
(Ppxlib.label Ppxlib.loc * Ppxlib.attributes * 'a) list ->
Ppxlib.pattern list * Ppxlib.expressionlet patts, expr = gen_tuple label n in ... creates a record expression and a corresponding list of patterns.
val gen_pat_tuple :
loc:Ppxlib.location ->
string ->
int ->
Ppxlib.pattern * Ppxlib.expression listlet patt, exprs = gen_pat_tuple ~loc prefix n in ... generates a pattern to match a tuple of size n and a list of expressions exprs to refer to names bound in this pattern.
val gen_pat_record :
loc:Ppxlib.location ->
string ->
Ppxlib.label Ppxlib.loc list ->
Ppxlib.pattern * Ppxlib.expression listlet patt, exprs = gen_pat_record ~loc prefix fs in ... generates a pattern to match record with fields fs and a list of expressions exprs to refer to names bound in this pattern.
val gen_pat_list :
loc:Ppxlib.location ->
string ->
int ->
Ppxlib.pattern * Ppxlib.expression listlet patt, exprs = gen_pat_list ~loc prefix n in ... generates a pattern to match a list of size n and a list of expressions exprs to refer to names bound in this pattern.
A shortcut to define a pattern matching case.
Map over data with location, useful to lift derive_of_label, derive_of_longident
Low-level deriver classes.