pubgrub/report

Conflict reporting and derivation tree formatting.

Types

Formatter configuration for string output.

pub type DefaultStringReportFormatter(p, v, m) {
  DefaultStringReportFormatter(
    package_to_string: fn(p) -> String,
    version_to_string: fn(v) -> String,
  )
}

Constructors

  • DefaultStringReportFormatter(
      package_to_string: fn(p) -> String,
      version_to_string: fn(v) -> String,
    )

Tree describing a conflict and its causes.

pub type DerivationTree(p, v, m) {
  External(External(p, v, m))
  Derived(DerivedNode(p, v, m))
}

Constructors

A derived incompatibility with two causes.

pub type DerivedNode(p, v, m) {
  DerivedNode(
    terms: dict.Dict(p, term.Term(v)),
    shared_id: option.Option(Int),
    cause1: DerivationTree(p, v, m),
    cause2: DerivationTree(p, v, m),
  )
}

Constructors

External reasons for incompatibilities.

pub type External(p, v, m) {
  NotRoot(p, v)
  NoVersions(p, version_ranges.Ranges(v))
  FromDependencyOf(
    p,
    version_ranges.Ranges(v),
    p,
    version_ranges.Ranges(v),
  )
  Custom(p, version_ranges.Ranges(v), m)
}

Constructors

Formatter for producing reports in any output type.

pub type ReportFormatter(p, v, m, a) {
  ReportFormatter(
    format_external: fn(External(p, v, m)) -> a,
    format_terms: fn(dict.Dict(p, term.Term(v))) -> a,
    explain_both_external: fn(
      External(p, v, m),
      External(p, v, m),
      dict.Dict(p, term.Term(v)),
    ) -> a,
    explain_both_ref: fn(
      Int,
      DerivedNode(p, v, m),
      Int,
      DerivedNode(p, v, m),
      dict.Dict(p, term.Term(v)),
    ) -> a,
    explain_ref_and_external: fn(
      Int,
      DerivedNode(p, v, m),
      External(p, v, m),
      dict.Dict(p, term.Term(v)),
    ) -> a,
    and_explain_external: fn(
      External(p, v, m),
      dict.Dict(p, term.Term(v)),
    ) -> a,
    and_explain_ref: fn(
      Int,
      DerivedNode(p, v, m),
      dict.Dict(p, term.Term(v)),
    ) -> a,
    and_explain_prior_and_external: fn(
      External(p, v, m),
      External(p, v, m),
      dict.Dict(p, term.Term(v)),
    ) -> a,
  )
}

Constructors

Values

pub fn collapse_no_versions(
  tree: DerivationTree(p, v, m),
) -> DerivationTree(p, v, m)

Simplify a derivation tree by collapsing NoVersions nodes.

pub fn default_formatter(
  package_to_string: fn(p) -> String,
  version_to_string: fn(v) -> String,
) -> DefaultStringReportFormatter(p, v, m)

Build a default string formatter.

pub fn default_report_formatter(
  package_to_string: fn(p) -> String,
  version_to_string: fn(v) -> String,
) -> ReportFormatter(p, v, m, String)

Build a report formatter that produces strings.

pub fn packages(tree: DerivationTree(p, v, m)) -> set.Set(p)

Collect package names mentioned in a derivation tree.

pub fn report(
  derivation_tree: DerivationTree(p, v, m),
  formatter: ReportFormatter(p, v, m, String),
) -> String

Render a derivation tree using the provided formatter.

Search Document