package merlin-lib

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of struct include Ocaml_typing.Printtyp end
val longident : Format.formatter -> Ocaml_parsing.Longident.t -> unit
val ident : Format.formatter -> Ocaml_typing.Ident.t -> unit
val string_of_path : Ocaml_typing.Path.t -> string
val type_path : Format.formatter -> Ocaml_typing.Path.t -> unit

Print a type path taking account of -short-paths. Calls should be within wrap_printing_env.

type namespace = Ocaml_typing.Printtyp.namespace =
  1. | Type
  2. | Module
  3. | Module_type
  4. | Class
  5. | Class_type
  6. | Other
    (*

    Other bypasses the unique name for identifier mechanism

    *)
val strings_of_paths : namespace -> Ocaml_typing.Path.t list -> string list

Print a list of paths, using the same naming context to avoid name collisions

val raw_type_expr : Format.formatter -> Ocaml_typing.Types.type_expr -> unit
val string_of_label : Ocaml_parsing.Asttypes.arg_label -> string
val shorten_module_type_path : Ocaml_typing.Env.t -> Ocaml_typing.Path.t -> Ocaml_typing.Path.t
val shorten_class_type_path : Ocaml_typing.Env.t -> Ocaml_typing.Path.t -> Ocaml_typing.Path.t
module Naming_context = Ocaml_typing.Printtyp.Naming_context

The Conflicts module keeps track of conflicts arising when attributing names to identifiers and provides functions that can print explanations for these conflict in error messages

val reset : unit -> unit

Print out a type. This will pick names for type variables, and will not reuse names for common type variables shared across multiple type expressions. (It will also reset the printing state, which matters for other type formatters such as prepared_type_expr.) If you want multiple types to use common names for type variables, see prepare_for_printing and prepared_type_expr.

val prepare_for_printing : Ocaml_typing.Types.type_expr list -> unit

prepare_for_printing resets the global printing environment, a la reset, and prepares the types for printing by reserving names and marking loops. Any type variables that are shared between multiple types in the input list will be given the same name when printed with prepared_type_expr.

val add_type_to_preparation : Ocaml_typing.Types.type_expr -> unit

add_type_to_preparation ty extend a previous type expression preparation to the type expression ty

val prepared_type_expr : Format.formatter -> Ocaml_typing.Types.type_expr -> unit

The function prepared_type_expr is a less-safe but more-flexible version of type_expr that should only be called on type_exprs that have been passed to prepare_for_printing. Unlike type_expr, this function does no extra work before printing a type; in particular, this means that any loops in the type expression may cause a stack overflow (see #8860) since this function does not mark any loops. The benefit of this is that if multiple type expressions are prepared simultaneously and then printed with prepared_type_expr, they will use the same names for the same type variables.

val constructor_arguments : Format.formatter -> Ocaml_typing.Types.constructor_arguments -> unit
val shared_type_scheme : Format.formatter -> Ocaml_typing.Types.type_expr -> unit

shared_type_scheme is very similar to type_scheme, but does not reset the printing context first. This is intended to be used in cases where the printing should have a particularly wide context, such as documentation generators; most use cases, such as error messages, have narrower contexts for which type_scheme is better suited.

val functor_parameters : sep:(Format.formatter -> unit -> unit) -> ('b -> Format.formatter -> unit) -> (Ocaml_typing.Ident.t option * 'b) list -> Format.formatter -> unit

Print a list of functor parameters while adjusting the printing environment for each functor argument.

Currently, we are disabling disambiguation for functor argument name to avoid the need to track the moving association between identifiers and syntactic names in situation like:

got: (X: sig module type T end) (Y:X.T) (X:sig module type T end) (Z:X.T) expect: (_: sig end) (Y:X.T) (_:sig end) (Z:X.T)

type type_or_scheme = Ocaml_typing.Printtyp.type_or_scheme =
  1. | Type
  2. | Type_scheme
val report_ambiguous_type_error : Format.formatter -> Ocaml_typing.Env.t -> (Ocaml_typing.Path.t * Ocaml_typing.Path.t) -> (Ocaml_typing.Path.t * Ocaml_typing.Path.t) list -> (Format.formatter -> unit) -> (Format.formatter -> unit) -> (Format.formatter -> unit) -> unit
val report_unification_error : Format.formatter -> Ocaml_typing.Env.t -> Ocaml_typing.Errortrace.unification_error -> ?type_expected_explanation:(Format.formatter -> unit) -> (Format.formatter -> unit) -> (Format.formatter -> unit) -> unit
val rewrite_double_underscore_paths : Ocaml_typing.Env.t -> Ocaml_typing.Path.t -> Ocaml_typing.Path.t
val printed_signature : string -> Format.formatter -> Ocaml_typing.Types.signature -> unit

printed_signature sourcefile ppf sg print the signature sg of sourcefile with potential warnings for name collisions

val wrap_printing_env : Ocaml_typing.Env.t -> verbosity:Merlin_kernel.Mconfig.Verbosity.t -> (unit -> 'a) -> 'a