Module Ppxlib__Common
val lident : Ppxlib__.Import.string -> Ppxlib.Longident.t
val core_type_of_type_declaration : Ppxlib__.Import.type_declaration -> Ppxlib__.Import.core_type
val name_type_params_in_td : Ppxlib__.Import.type_declaration -> Ppxlib__.Import.type_declaration
val combinator_type_of_type_declaration : Ppxlib__.Import.type_declaration -> f:(loc:Ppxlib.Location.t -> Ppxlib__.Import.core_type -> Ppxlib__.Import.core_type) -> Ppxlib__.Import.core_type
val gen_symbol : ?prefix:Ppxlib__.Import.string -> Ppxlib__.Import.unit -> Ppxlib__.Import.string
gen_symbol ?prefix ()
generates a fresh variable name withprefix
.- parameter prefix
default = "_x"
val string_of_core_type : Ppxlib__.Import.core_type -> Ppxlib__.Import.string
val assert_no_attributes : Ppxlib__.Import.attributes -> Ppxlib__.Import.unit
val assert_no_attributes_in : Ppxlib.Ast_traverse.iter
val get_type_param_name : (Ppxlib__.Import.core_type * Ppxlib__.Import.variance) -> Ppxlib__.Import.string Ppxlib.Loc.t
get_tparam_id tp
- returns
the string identifier associated with
tp
if it is a type parameter.
class type_is_recursive : Ppxlib__.Import.rec_flag -> Ppxlib__.Import.type_declaration Ppxlib__.Import.list -> object ... end
(new type_is_recursive rec_flag tds)#go ()
returns whetherrec_flag, tds
is really a recursive type. We disregard recursive occurrences appearing in arrow types. You can override the search for certain type expressions by inheriting from this class.
val really_recursive : Ppxlib__.Import.rec_flag -> Ppxlib__.Import.type_declaration Ppxlib__.Import.list -> Ppxlib__.Import.rec_flag
really_recursive rec_flag tds = (new type_is_recursive rec_flag tds)#go ()
val loc_of_payload : Ppxlib__.Import.attribute -> Ppxlib.Location.t
val loc_of_attribute : Ppxlib__.Import.attribute -> Ppxlib.Location.t
val loc_of_extension : Ppxlib__.Import.extension -> Ppxlib.Location.t
val curry_applications : Ppxlib__.Import.expression -> Ppxlib__.Import.expression
convert multi-arg function applications into a cascade of 1-arg applications
val attribute_of_warning : Ppxlib.Location.t -> Ppxlib__.Import.string -> Ppxlib__.Import.attribute
Encode a warning message into an 'ocaml.ppwarning' attribute which can be inserted in a generated Parsetree. The compiler will be responsible for reporting the warning.
val is_polymorphic_variant : Ppxlib__.Import.type_declaration -> sig_:Ppxlib__.Import.bool -> [> `Definitely | `Maybe | `Surely_not ]
val mk_named_sig : loc:Ppxlib.Location.t -> sg_name:Ppxlib__.Import.string -> handle_polymorphic_variant:Ppxlib__.Import.bool -> Ppxlib__.Import.type_declaration Ppxlib__.Import.list -> Ppxlib__.Import.include_description Ppxlib__.Import.option
mk_named_sig ~loc ~sg_name:"Foo" ~handle_polymorphic_variant tds
will generateinclude Foo (* or Foo1, Foo2, Foo3 *) with type (* ('a, 'b, 'c) *) t := (* ('a, 'b, 'c) *) t
when:
- there is only one type declaration
- the type is named t
- there are less than 4 type parameters
- there are no constraints on the type parameters
It will take care of giving fresh names to unnamed type parameters.