unison-parser-typechecker-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.PatternMatchCoverage.Solve

Synopsis

Documentation

uncoverAnnotate :: forall vt v loc m l. Pmc vt v loc m => Set (NormalizedConstraints vt v loc) -> GrdTree (PmGrd vt v loc) l -> m (Set (NormalizedConstraints vt v loc), GrdTree (Set (NormalizedConstraints vt v loc)) (Set (NormalizedConstraints vt v loc), l)) Source #

top-down traversal of the GrdTree that produces:

  • a refinement type describing values that do not match the GrdTree (the "uncovered" set)
  • a new GrdTree annotated with refinement types at the nodes describing values that cause an effect to be performed and values that match the case at the leaves.

If the former is inhabited then its inhabitants are unmatched values. If the leaves of the latter are inhabited then the case is redundant.

classify :: forall vt v loc l. GrdTree (Set (NormalizedConstraints vt v loc)) (Set (NormalizedConstraints vt v loc), l) -> ([l], [l], [l]) Source #

Collect accessible, inaccessible, and redundant GRHSs

expandSolution :: forall vt v loc m. Pmc vt v loc m => v -> NormalizedConstraints vt v loc -> m (Set (NormalizedConstraints vt v loc)) Source #

Given a variable and a term in DNF, expand it to an identical DNF expression with enough positive info to print pattern suggestions.

generateInhabitants :: forall vt v loc. Var v => v -> NormalizedConstraints vt v loc -> Pattern () Source #

Expand a full DNF term (i.e. each term identifies exactly one solution) into an inhabiting pattern.