GHC.Tc.Utils.Instantiate

ghc-9.2.0.20210331: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Tc.Utils.Instantiate

Synopsis

- topSkolemise :: TcSigmaType -> TcM (HsWrapper, [(Name, TyVar)], [EvVar], TcRhoType)
- topInstantiate :: CtOrigin -> TcSigmaType -> TcM (HsWrapper, TcRhoType)
- instantiateSigma :: CtOrigin -> [TyVar] -> TcThetaType -> TcSigmaType -> TcM ([TcTyVar], HsWrapper, TcSigmaType)
- instCall :: CtOrigin -> [TcType] -> TcThetaType -> TcM HsWrapper
- instDFunType :: DFunId -> [DFunInstType] -> TcM ([TcType], TcThetaType)
- instStupidTheta :: CtOrigin -> TcThetaType -> TcM ()
- instTyVarsWith :: CtOrigin -> [TyVar] -> [TcType] -> TcM TCvSubst
- newWanted :: CtOrigin -> Maybe TypeOrKind -> PredType -> TcM CtEvidence
- newWanteds :: CtOrigin -> ThetaType -> TcM [CtEvidence]
- tcInstType :: ([TyVar] -> TcM (TCvSubst, [TcTyVar])) -> Id -> TcM ([(Name, TcTyVar)], TcThetaType, TcType)
- tcInstTypeBndrs :: Id -> TcM ([(Name, InvisTVBinder)], TcThetaType, TcType)
- tcInstSkolTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar])
- tcInstSkolTyVarsX :: TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar])
- tcInstSkolTyVarsAt :: TcLevel -> Bool -> TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar])
- tcSkolDFunType :: DFunId -> TcM ([TcTyVar], TcThetaType, TcType)
- tcSuperSkolTyVars :: [TyVar] -> (TCvSubst, [TcTyVar])
- tcInstSuperSkolTyVarsX :: TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar])
- freshenTyVarBndrs :: [TyVar] -> TcM (TCvSubst, [TyVar])
- freshenCoVarBndrsX :: TCvSubst -> [CoVar] -> TcM (TCvSubst, [CoVar])
- tcInstInvisibleTyBindersN :: Int -> TcKind -> TcM ([TcType], TcKind)
- tcInstInvisibleTyBinders :: TcType -> TcKind -> TcM (TcType, TcKind)
- tcInstInvisibleTyBinder :: TCvSubst -> TyBinder -> TcM (TCvSubst, TcType)
- newOverloadedLit :: HsOverLit GhcRn -> ExpRhoType -> TcM (HsOverLit GhcTc)
- mkOverLit :: OverLitVal -> TcM (HsLit GhcTc)
- newClsInst :: Maybe OverlapMode -> Name -> [TyVar] -> ThetaType -> Class -> [Type] -> TcM ClsInst
- tcGetInsts :: TcM [ClsInst]
- tcGetInstEnvs :: TcM InstEnvs
- getOverlapFlag :: Maybe OverlapMode -> TcM OverlapFlag
- tcExtendLocalInstEnv :: [ClsInst] -> TcM a -> TcM a
- instCallConstraints :: CtOrigin -> TcThetaType -> TcM HsWrapper
- newMethodFromName :: CtOrigin -> Name -> [TcRhoType] -> TcM (HsExpr GhcTc)
- tcSyntaxName :: CtOrigin -> TcType -> (Name, HsExpr GhcRn) -> TcM (Name, HsExpr GhcTc)
- tyCoVarsOfWC :: WantedConstraints -> TyCoVarSet
- tyCoVarsOfCt :: Ct -> TcTyCoVarSet
- tyCoVarsOfCts :: Cts -> TcTyCoVarSet

# Documentation

topSkolemise :: TcSigmaType -> TcM (HsWrapper, [(Name, TyVar)], [EvVar], TcRhoType) Source #

topInstantiate :: CtOrigin -> TcSigmaType -> TcM (HsWrapper, TcRhoType) Source #

instantiateSigma :: CtOrigin -> [TyVar] -> TcThetaType -> TcSigmaType -> TcM ([TcTyVar], HsWrapper, TcSigmaType) Source #

instCall :: CtOrigin -> [TcType] -> TcThetaType -> TcM HsWrapper Source #

instDFunType :: DFunId -> [DFunInstType] -> TcM ([TcType], TcThetaType) Source #

instStupidTheta :: CtOrigin -> TcThetaType -> TcM () Source #

instTyVarsWith :: CtOrigin -> [TyVar] -> [TcType] -> TcM TCvSubst Source #

newWanted :: CtOrigin -> Maybe TypeOrKind -> PredType -> TcM CtEvidence Source #

newWanteds :: CtOrigin -> ThetaType -> TcM [CtEvidence] Source #

tcInstType Source #

Arguments

:: ([TyVar] -> TcM (TCvSubst, [TcTyVar])) | How to instantiate the type variables
-> Id | Type to instantiate
-> TcM ([(Name, TcTyVar)], TcThetaType, TcType) | Result (type vars, preds (incl equalities), rho)

tcInstTypeBndrs :: Id -> TcM ([(Name, InvisTVBinder)], TcThetaType, TcType) Source #

tcInstSkolTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar]) Source #

Given a list of `[`TyVar`]`, skolemize the type variables, returning a substitution mapping the original tyvars to the skolems, and the list of newly bound skolems.

tcInstSkolTyVarsX :: TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar]) Source #

tcInstSkolTyVarsAt :: TcLevel -> Bool -> TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar]) Source #

tcSkolDFunType :: DFunId -> TcM ([TcTyVar], TcThetaType, TcType) Source #

tcSuperSkolTyVars :: [TyVar] -> (TCvSubst, [TcTyVar]) Source #

tcInstSuperSkolTyVarsX :: TCvSubst -> [TyVar] -> TcM (TCvSubst, [TcTyVar]) Source #

freshenTyVarBndrs :: [TyVar] -> TcM (TCvSubst, [TyVar]) Source #

Give fresh uniques to a bunch of TyVars, but they stay as TyVars, rather than becoming TcTyVars Used in `newFamInst`, and `newClsInst`

freshenCoVarBndrsX :: TCvSubst -> [CoVar] -> TcM (TCvSubst, [CoVar]) Source #

Give fresh uniques to a bunch of CoVars Used in "GHC.Tc.Instance.Family.newFamInst"

tcInstInvisibleTyBindersN :: Int -> TcKind -> TcM ([TcType], TcKind) Source #

tcInstInvisibleTyBinders :: TcType -> TcKind -> TcM (TcType, TcKind) Source #

Given ty::forall k1 k2. k, instantiate all the invisible forall-binders returning ty `kk1` kk2 :: k[kk1k1, kk2k1]

tcInstInvisibleTyBinder :: TCvSubst -> TyBinder -> TcM (TCvSubst, TcType) Source #

Used only in *types*

newOverloadedLit :: HsOverLit GhcRn -> ExpRhoType -> TcM (HsOverLit GhcTc) Source #

mkOverLit :: OverLitVal -> TcM (HsLit GhcTc) Source #

newClsInst :: Maybe OverlapMode -> Name -> [TyVar] -> ThetaType -> Class -> [Type] -> TcM ClsInst Source #

tcGetInsts :: TcM [ClsInst] Source #

tcGetInstEnvs :: TcM InstEnvs Source #

getOverlapFlag :: Maybe OverlapMode -> TcM OverlapFlag Source #

tcExtendLocalInstEnv :: [ClsInst] -> TcM a -> TcM a Source #

instCallConstraints :: CtOrigin -> TcThetaType -> TcM HsWrapper Source #

newMethodFromName Source #

Arguments

:: CtOrigin | why do we need this?
-> Name | name of the method
-> [TcRhoType] | types with which to instantiate the class
-> TcM (HsExpr GhcTc) |

Used when `Name` is the wired-in name for a wired-in class method, so the caller knows its type for sure, which should be of form

    forall a. C a => <blah>

`newMethodFromName` is supposed to instantiate just the outer type variable and constraint

tcSyntaxName Source #

Arguments

:: CtOrigin |
-> TcType | Type to instantiate it at
-> (Name, HsExpr GhcRn) | (Standard name, user name)
-> TcM (Name, HsExpr GhcTc) | (Standard name, suitable expression) USED ONLY FOR CmdTop (sigh) *** See Note [CmdSyntaxTable] in GHC.Hs.Expr

tyCoVarsOfWC :: WantedConstraints -> TyCoVarSet Source #

Returns free variables of WantedConstraints as a non-deterministic set. See Note [Deterministic FV] in GHC.Utils.FV.

tyCoVarsOfCt :: Ct -> TcTyCoVarSet Source #

Returns free variables of constraints as a non-deterministic set

tyCoVarsOfCts :: Cts -> TcTyCoVarSet Source #

Returns free variables of a bag of constraints as a non-deterministic set. See Note [Deterministic FV] in GHC.Utils.FV.