Ppx_type_conv: Preprocessing Module for Registering Type Conversions
module Generator : sig ... end
val add : ?str_type_decl:(Ppx_core.structure, Ppx_core.rec_flag * Ppx_core.type_declaration Ppx_core.list) Generator.t ‑> ?str_type_ext:(Ppx_core.structure, Ppx_core.type_extension) Generator.t ‑> ?str_exception:(Ppx_core.structure, Ppx_core.extension_constructor) Generator.t ‑> ?sig_type_decl:(Ppx_core.signature, Ppx_core.rec_flag * Ppx_core.type_declaration Ppx_core.list) Generator.t ‑> ?sig_type_ext:(Ppx_core.signature, Ppx_core.type_extension) Generator.t ‑> ?sig_exception:(Ppx_core.signature, Ppx_core.extension_constructor) Generator.t ‑> ?extension:(loc:Ppx_core.Location.t ‑> path:Ppx_core.string ‑> Ppx_core.core_type ‑> Ppx_core.expression) ‑> Ppx_core.string ‑> t
Register a new type-conv generator.
The various arguments are for the various items on which derivers can be attached in structure and signatures.
We distinguish exception
from type_extension
as exception E
is not exactly the
same as type exn += E
. Indeed if the type exn
is redefined, then type exn += E
will add E
to the new exn
type while exception E
will add E
to the predefined
exn
type.
extension
register an expander for extension with the name of the deriver. This is
here mostly to support the ppx_deriving backend.
val add_alias : Ppx_core.string ‑> ?str_type_decl:t Ppx_core.list ‑> ?str_type_ext:t Ppx_core.list ‑> ?str_exception:t Ppx_core.list ‑> ?sig_type_decl:t Ppx_core.list ‑> ?sig_type_ext:t Ppx_core.list ‑> ?sig_exception:t Ppx_core.list ‑> t Ppx_core.list ‑> t
add_alias name set
add an alias. When the user write the alias, all the generator of
set
will be used instead. It is possible to override the set for any of the context
by passing the specific set in the approriate optional argument of add_alias
.
val ignore : t ‑> Ppx_core.unit
Ignore a deriver. So that one can write: Type_conv.add ... |> Type_conv.ignore