jon.recoil.org

Module Ppxlib_janeSource

Sourcemodule Shim : sig ... end

This file can have a different implementation in the Jane Street experimental compiler and the upstream compiler, allowing ppxes to easily work with both versions

Sourcemodule Ast_builder : sig ... end

Jane Street-internal extensions to Ppxlib.Ast_builder. The bindings below (Default, Make, etc.) are parallel to bindings exported from Ppxlib.Ast_builder.

Sourcemodule Ast_traverse : sig ... end
Sourcemodule Legacy_pexp_function : sig ... end

Use of this module is discouraged.

Sourcemodule Language_feature_name : sig ... end

A human-readable name for the language feature corresponding to the construct.

Sourcemodule Constructor_name : sig ... end

The literal name of the constructor corresponding to the construct (e.g. Pexp_ident)

Common helper functions

Similar to Ppxlib.get_type_param_name, but also tells you the jkind of the variable. Raises a located error in case of failure. The type parameter should not be _. One way to ensure this is to get the type from Ppxlib.name_type_params_in_td (or one of the similarly-named functions).

Sourceval get_type_param_name_and_jkind_of_core_type : Ppxlib_ast.Parsetree.core_type -> string Location.loc * Ppxlib_jane.Shim.jkind_annotation option
Sourceval as_unlabeled_tuple : (string option * 'a) list -> 'a list option

Check if the parsetree is of an unlabeled tuple (i.e. all labels are None), and return the components of the tuple dropping its None labels.

Modifies an include_description to append "__local" to the module type name. In particular, this is useful for modifying the result of Ppxlib.mk_named_sig. For example, if the latter produces some incl representing include Bin_prot.Binable.S1 with type 'a t := 'a t, calling localize_include_sig incl will turn this into include Bin_prot.Binable.S1__local with type 'a t := 'a t.

Like localize_include_sig, but appends "__stack" rather than "__local".

Sourceval append_arbitrary_suffix_to_include_signature : Ppxlib_ast.Ast.include_description -> suffix:string -> Ppxlib_ast.Ast.include_description

Like localize_include_sig, but appends an arbitrary suffix.

This is useful when the suffix for your signature is not a standard mangling suffix as produced by ppx_template.

Common Jane Street helper types

Sourcetype modality = Shim.Modality.t =
  1. | Modality of string
Sourcetype modalities = Shim.Modalities.t
Sourcetype mode = Shim.Mode.t =
  1. | Mode of string
Sourcetype modes = Shim.Modes.t
Sourcetype arrow_result = Shim.arrow_result = {
  1. result_modes : Ppxlib_jane.modes;
  2. result_type : Ppxlib_ast.Parsetree.core_type;
}
Sourcetype jkind_annotation_desc = Shim.jkind_annotation_desc =
  1. | Pjk_default
  2. | Pjk_abbreviation of string
  3. | Pjk_mod of Shim.jkind_annotation * Shim.Modes.t
  4. | Pjk_with of Shim.jkind_annotation * Ppxlib_ast.Parsetree.core_type * Shim.Modalities.t
  5. | Pjk_kind_of of Ppxlib_ast.Parsetree.core_type
  6. | Pjk_product of Shim.jkind_annotation list
Sourcetype jkind_annotation = Shim.jkind_annotation = {
  1. pjkind_loc : Location.t;
  2. pjkind_desc : Shim.jkind_annotation_desc;
}