HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-9.10.3GHC2021

GHC.Tc.Errors.Hole

  • 4 types
  • 15 values
  • Packageghc-9.10.3
  • Exports19
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceHole.hs
valuetcCheckHoleFit
  1. :: TypedHole

    The hole to check against

  2. -> TcSigmaType

    The type of the hole to check against (possibly modified, e.g. refined with additional holes for refinement hole-fits.)

  3. -> TcSigmaType

    The type to check whether fits.

  4. -> TcM (Bool, HsWrapper)

    Whether it was a match, and the wrapper from hole_ty to ty.

#

A tcSubsumes which takes into account relevant constraints, to fix #14273. This makes sure that when checking whether a type fits the hole, the type has to be subsumed by type of the hole as well as fulfill all constraints on the type of the hole.

valuewithoutUnification :: FV -> TcM a -> TcM a
#

Takes a list of free variables and restores any Flexi type variables in free_vars after the action is run.

Reports whether first type (ty_a) subsumes the second type (ty_b), discarding any errors. Subsumption here means that the ty_b can fit into the ty_a, i.e. `tcSubsumes a b == True` if b is a subtype of a.

valuetcFilterHoleFits
  1. :: Maybe Int

    How many we should output, if limited

  2. -> TypedHole

    The hole to filter against

  3. -> (TcType, [TcTyVar])

    The type to check for fits and a list of refinement variables (free type variables in the type) for emulating additional holes.

  4. -> [HoleFitCandidate]

    The candidates to check whether fit.

  5. -> TcM (Bool, [HoleFit])

    We return whether or not we stopped due to hitting the limit and the fits we found.

#

tcFilterHoleFits filters the candidates by whether, given the implications and the relevant constraints, they can be made to match the type by running the type checker. Stops after finding limit matches.

Sort by size uses as a measure for relevance the sizes of the different types needed to instantiate the fit to the type of the hole. This is much quicker than sorting by subsumption, and gives reasonable results in most cases.

datadata HoleFitPluginR
#

HoleFitPluginR adds a TcRef to hole fit plugins so that plugins can track internal state. Note the existential quantification, ensuring that the state cannot be modified from outside the plugin.

Constructors