Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- findValidHoleFits :: TidyEnv -> [Implication] -> [Ct] -> Ct -> TcM (TidyEnv, SDoc)
- tcFilterHoleFits :: Maybe Int -> TypedHole -> (TcType, [TcTyVar]) -> [HoleFitCandidate] -> TcM (Bool, [HoleFit])
- tcCheckHoleFit :: TypedHole -> TcSigmaType -> TcSigmaType -> TcM (Bool, HsWrapper)
- tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool
- withoutUnification :: FV -> TcM a -> TcM a
- fromPureHFPlugin :: HoleFitPlugin -> HoleFitPluginR
- hfIsLcl :: HoleFit -> Bool
- pprHoleFit :: HoleFitDispConfig -> HoleFit -> SDoc
- debugHoleFitDispConfig :: HoleFitDispConfig
- data TypedHole = TyH {
- tyHRelevantCts :: Cts
- tyHImplics :: [Implication]
- tyHCt :: Maybe Ct
- data HoleFit
- data HoleFitCandidate
- type CandPlugin = TypedHole -> [HoleFitCandidate] -> TcM [HoleFitCandidate]
- type FitPlugin = TypedHole -> [HoleFit] -> TcM [HoleFit]
- data HoleFitPlugin = HoleFitPlugin {}
- data HoleFitPluginR = forall s. HoleFitPluginR {
- hfPluginInit :: TcM (TcRef s)
- hfPluginRun :: TcRef s -> HoleFitPlugin
- hfPluginStop :: TcRef s -> TcM ()
Documentation
:: Maybe Int | How many we should output, if limited |
-> TypedHole | The hole to filter against |
-> (TcType, [TcTyVar]) | The type to check for fits and a list of refinement variables (free type variables in the type) for emulating additional holes. |
-> [HoleFitCandidate] | The candidates to check whether fit. |
-> 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.
:: TypedHole | The hole to check against |
-> TcSigmaType | The type to check against (possibly modified, e.g. refined) |
-> TcSigmaType | The type to check whether fits. |
-> 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 trac #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. Note: The simplifier may perform unification, so make sure to restore any free type variables to avoid side-effects.
tcSubsumes :: TcSigmaType -> TcSigmaType -> TcM Bool Source #
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.
withoutUnification :: FV -> TcM a -> TcM a Source #
Takes a list of free variables and restores any Flexi type variables in free_vars after the action is run.
fromPureHFPlugin :: HoleFitPlugin -> HoleFitPluginR Source #
Maps a plugin that needs no state to one with an empty one.
pprHoleFit :: HoleFitDispConfig -> HoleFit -> SDoc Source #
debugHoleFitDispConfig :: HoleFitDispConfig Source #
TyH | |
|
HoleFit is the type we use for valid hole fits. It contains the
element that was checked, the Id of that element as found by tcLookup
,
and the refinement level of the fit, which is the number of extra argument
holes that this fit uses (e.g. if hfRefLvl is 2, the fit is for `Id _ _`).
HoleFit | |
| |
RawHoleFit SDoc | A fit that is just displayed as is. Here so thatHoleFitPlugins can inject any fit they want. |
data HoleFitCandidate Source #
HoleFitCandidates are passed to hole fit plugins and then checked whether they fit a given typed-hole.
Instances
Eq HoleFitCandidate # | |
Defined in TcHoleFitTypes (==) :: HoleFitCandidate -> HoleFitCandidate -> Bool # (/=) :: HoleFitCandidate -> HoleFitCandidate -> Bool # | |
Ord HoleFitCandidate # | |
Defined in TcHoleFitTypes compare :: HoleFitCandidate -> HoleFitCandidate -> Ordering # (<) :: HoleFitCandidate -> HoleFitCandidate -> Bool # (<=) :: HoleFitCandidate -> HoleFitCandidate -> Bool # (>) :: HoleFitCandidate -> HoleFitCandidate -> Bool # (>=) :: HoleFitCandidate -> HoleFitCandidate -> Bool # max :: HoleFitCandidate -> HoleFitCandidate -> HoleFitCandidate # min :: HoleFitCandidate -> HoleFitCandidate -> HoleFitCandidate # | |
Outputable HoleFitCandidate # | |
Defined in TcHoleFitTypes | |
HasOccName HoleFitCandidate # | |
Defined in TcHoleFitTypes occName :: HoleFitCandidate -> OccName Source # | |
NamedThing HoleFitCandidate # | |
Defined in TcHoleFitTypes getOccName :: HoleFitCandidate -> OccName Source # getName :: HoleFitCandidate -> Name Source # |
type CandPlugin = TypedHole -> [HoleFitCandidate] -> TcM [HoleFitCandidate] Source #
A plugin for modifying the candidate hole fits *before* they're checked.
type FitPlugin = TypedHole -> [HoleFit] -> TcM [HoleFit] Source #
A plugin for modifying hole fits *after* they've been found.
data HoleFitPlugin Source #
A HoleFitPlugin is a pair of candidate and fit plugins.
data HoleFitPluginR Source #
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.
forall s. HoleFitPluginR | |
|