jon.recoil.org

Module Ocaml_typing.Errortrace

type position =
  1. | First
  2. | Second
type expanded_type = {
  1. ty : Ocaml_typing.Types.type_expr;
  2. expanded : Ocaml_typing.Types.type_expr;
}

trivial_expansion ty creates an expanded_type whose expansion is also ty. Usually, you want Ctype.expand_type instead, since the expansion carries useful information; however, in certain circumstances, the error is about the expansion of the type, meaning that actually performing the expansion produces more confusing or inaccurate output.

type 'a diff = {
  1. got : 'a;
  2. expected : 'a;
}
val map_diff : ('a -> 'b) -> 'a Ocaml_typing.Errortrace.diff -> 'b Ocaml_typing.Errortrace.diff

map_diff f {expected;got} is {expected=f expected; got=f got}

type 'a escape_kind =
  1. | Constructor of Ocaml_typing.Path.t
  2. | Univ of Ocaml_typing.Types.type_expr
  3. | Self
  4. | Module_type of Ocaml_typing.Path.t
  5. | Equation of 'a
  6. | Constraint

Scope escape related errors

type 'a escape = {
  1. kind : 'a Ocaml_typing.Errortrace.escape_kind;
  2. context : Ocaml_typing.Types.type_expr option;
}
val map_escape : ('a -> 'b) -> 'a Ocaml_typing.Errortrace.escape -> 'b Ocaml_typing.Errortrace.escape
val explain : 'a list -> (prev:'a option -> 'a -> 'b option) -> 'b option
type unification = private
  1. | Unification

Type indices

type comparison = private
  1. | Comparison
type fixed_row_case =
  1. | Cannot_be_closed
  2. | Cannot_add_tags of string list
type ('a, 'variety) t = ('a, 'variety) Ocaml_typing.Errortrace.elt list
val map : ('a -> 'b) -> ('a, 'variety) Ocaml_typing.Errortrace.t -> ('b, 'variety) Ocaml_typing.Errortrace.t
val swap_trace : ('a, 'variety) Ocaml_typing.Errortrace.t -> ('a, 'variety) Ocaml_typing.Errortrace.t

The traces ('variety t) are the core error types. However, we bundle them up into three "top-level" error types, which are used elsewhere: unification_error, equality_error, and moregen_error. In the case of equality_error, this has to bundle in extra information; in general, it distinguishes the three types of errors and allows us to distinguish traces that are being built (or processed) from those that are complete and have become the final error. These error types have the invariants that their traces are nonempty; we ensure that through three smart constructors with matching names.

type unification_error = private {
  1. trace : Ocaml_typing.Errortrace.unification Ocaml_typing.Errortrace.error;
}
type comparison_error =
  1. | Equality_error of Ocaml_typing.Errortrace.equality_error
  2. | Moregen_error of Ocaml_typing.Errortrace.moregen_error

Wraps up the two different kinds of comparison errors in one type

Lift swap_trace to unification_error

module Subtype : sig ... end