Ppxlib.Expansion_helpers
Various helpers for expansion, such as quoting expressions in their context, or mangling names.
Derive mangled names from type names in a deriver. For instance, the t
can be turned into t_of_yojson
or yojson_of_t
with the functions from this module.
val mangle : ?fixpoint:string -> affix -> string -> string
mangle ~fixpoint affix s
derives a mangled name from s
with the mangling specified by affix
. If s
is equal to fixpoint
("t"
by default), then s
is omitted from the mangled name.
val mangle_type_decl :
?fixpoint:string ->
affix ->
Astlib.Ast_500.Parsetree.type_declaration ->
string
mangle_type_decl ~fixpoint affix td
does the same as mangle
, but for the name of td
.
val mangle_lid : ?fixpoint:string -> affix -> Longident.t -> Longident.t
mangle_lid ~fixpoint affix lid
does the same as mangle
, but for the last component of lid
.
module Quoter : sig ... end
Generate expressions in a hygienic way.