GHC.Plugins

ghc-9.2.0.20210821: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Plugins

Contents

- Getting `Name`s
- Orphan instances

Description

This module is not used by GHC itself. Rather, it exports all of the functions and types you are likely to need when writing a plugin for GHC. So authors of plugins can probably get away simply with saying "import GHC.Plugins".

Particularly interesting modules for plugin writers include GHC.Core and GHC.Core.Opt.Monad.

Synopsis

- module GHC.Driver.Plugins
- module GHC.Types.Name.Reader
- mkRecFldSelOcc :: String -> OccName
- mkVarOccFS :: FastString -> OccName
- occNameString :: OccName -> String
- class HasOccName name where
  - occName :: name -> OccName
- data OccName
- emptyFsEnv :: FastStringEnv a
- extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
- lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
- mkFsEnv :: [(FastString, a)] -> FastStringEnv a
- type FastStringEnv a = UniqFM FastString a
- alterOccEnv :: (Maybe elt -> Maybe elt) -> OccEnv elt -> OccName -> OccEnv elt
- avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
- clsName :: NameSpace
- dataName :: NameSpace
- delFromOccEnv :: OccEnv a -> OccName -> OccEnv a
- delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a
- delTidyOccEnvList :: TidyOccEnv -> [FastString] -> TidyOccEnv
- demoteOccName :: OccName -> Maybe OccName
- elemOccEnv :: OccName -> OccEnv a -> Bool
- elemOccSet :: OccName -> OccSet -> Bool
- emptyOccEnv :: OccEnv a
- emptyOccSet :: OccSet
- emptyTidyOccEnv :: TidyOccEnv
- extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a
- extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a
- extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b
- extendOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv a
- extendOccSet :: OccSet -> OccName -> OccSet
- extendOccSetList :: OccSet -> [OccName] -> OccSet
- filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt
- filterOccSet :: (OccName -> Bool) -> OccSet -> OccSet
- foldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b
- initTidyOccEnv :: [OccName] -> TidyOccEnv
- intersectOccSet :: OccSet -> OccSet -> OccSet
- isDataConNameSpace :: NameSpace -> Bool
- isDataOcc :: OccName -> Bool
- isDataSymOcc :: OccName -> Bool
- isDefaultMethodOcc :: OccName -> Bool
- isDerivedOccName :: OccName -> Bool
- isEmptyOccSet :: OccSet -> Bool
- isSymOcc :: OccName -> Bool
- isTcClsNameSpace :: NameSpace -> Bool
- isTcOcc :: OccName -> Bool
- isTvNameSpace :: NameSpace -> Bool
- isTvOcc :: OccName -> Bool
- isTypeableBindOcc :: OccName -> Bool
- isValNameSpace :: NameSpace -> Bool
- isValOcc :: OccName -> Bool
- isVarNameSpace :: NameSpace -> Bool
- isVarOcc :: OccName -> Bool
- lookupOccEnv :: OccEnv a -> OccName -> Maybe a
- mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
- minusOccSet :: OccSet -> OccSet -> OccSet
- mkBuilderOcc :: OccName -> OccName
- mkClassDataConOcc :: OccName -> OccName
- mkClassOpAuxOcc :: OccName -> OccName
- mkClsOcc :: String -> OccName
- mkClsOccFS :: FastString -> OccName
- mkCon2TagOcc :: OccName -> OccName
- mkDFunOcc :: String -> Bool -> OccSet -> OccName
- mkDataCOcc :: OccName -> OccName
- mkDataConWorkerOcc :: OccName -> OccName
- mkDataConWrapperOcc :: OccName -> OccName
- mkDataOcc :: String -> OccName
- mkDataOccFS :: FastString -> OccName
- mkDataTOcc :: OccName -> OccName
- mkDefaultMethodOcc :: OccName -> OccName
- mkDictOcc :: OccName -> OccName
- mkEqPredCoOcc :: OccName -> OccName
- mkForeignExportOcc :: OccName -> OccName
- mkGen1R :: OccName -> OccName
- mkGenR :: OccName -> OccName
- mkIPOcc :: OccName -> OccName
- mkInstTyCoOcc :: OccName -> OccName
- mkInstTyTcOcc :: String -> OccSet -> OccName
- mkLocalOcc :: Unique -> OccName -> OccName
- mkMatcherOcc :: OccName -> OccName
- mkMaxTagOcc :: OccName -> OccName
- mkMethodOcc :: OccName -> OccName
- mkNewTyCoOcc :: OccName -> OccName
- mkOccEnv :: [(OccName, a)] -> OccEnv a
- mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a
- mkOccName :: NameSpace -> String -> OccName
- mkOccNameFS :: NameSpace -> FastString -> OccName
- mkOccSet :: [OccName] -> OccSet
- mkRepEqOcc :: OccName -> OccName
- mkSpecOcc :: OccName -> OccName
- mkSuperDictAuxOcc :: Int -> OccName -> OccName
- mkSuperDictSelOcc :: Int -> OccName -> OccName
- mkTag2ConOcc :: OccName -> OccName
- mkTcOcc :: String -> OccName
- mkTcOccFS :: FastString -> OccName
- mkTyConRepOcc :: OccName -> OccName
- mkTyVarOcc :: String -> OccName
- mkTyVarOccFS :: FastString -> OccName
- mkVarOcc :: String -> OccName
- mkWorkerOcc :: OccName -> OccName
- nameSpacesRelated :: NameSpace -> NameSpace -> Bool
- occEnvElts :: OccEnv a -> [a]
- parenSymOcc :: OccName -> SDoc -> SDoc
- plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a
- plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a
- pprNameSpace :: NameSpace -> SDoc
- pprNameSpaceBrief :: NameSpace -> SDoc
- pprNonVarNameSpace :: NameSpace -> SDoc
- pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc
- pprOccName :: OccName -> SDoc
- promoteOccName :: OccName -> Maybe OccName
- setOccNameSpace :: NameSpace -> OccName -> OccName
- srcDataName :: NameSpace
- startsWithUnderscore :: OccName -> Bool
- tcClsName :: NameSpace
- tcName :: NameSpace
- tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)
- tvName :: NameSpace
- unionManyOccSets :: [OccSet] -> OccSet
- unionOccSets :: OccSet -> OccSet -> OccSet
- unitOccEnv :: OccName -> a -> OccEnv a
- unitOccSet :: OccName -> OccSet
- data NameSpace
- data OccEnv a
- type OccSet = UniqSet OccName
- type TidyOccEnv = UniqFM FastString Int
- mkRecFldSelOcc :: String -> OccName
- mkVarOccFS :: FastString -> OccName
- occNameString :: OccName -> String
- class HasOccName name where
  - occName :: name -> OccName
- data OccName
- emptyFsEnv :: FastStringEnv a
- extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
- lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
- mkFsEnv :: [(FastString, a)] -> FastStringEnv a
- type FastStringEnv a = UniqFM FastString a
- nameOccName :: Name -> OccName
- nameUnique :: Name -> Unique
- setNameUnique :: Name -> Unique -> Name
- tidyNameOcc :: Name -> OccName -> Name
- data Name
- class NamedThing a where
  - getOccName :: a -> OccName
  - getName :: a -> Name
- alterOccEnv :: (Maybe elt -> Maybe elt) -> OccEnv elt -> OccName -> OccEnv elt
- avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
- clsName :: NameSpace
- dataName :: NameSpace
- delFromOccEnv :: OccEnv a -> OccName -> OccEnv a
- delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a
- delTidyOccEnvList :: TidyOccEnv -> [FastString] -> TidyOccEnv
- demoteOccName :: OccName -> Maybe OccName
- elemOccEnv :: OccName -> OccEnv a -> Bool
- elemOccSet :: OccName -> OccSet -> Bool
- emptyOccEnv :: OccEnv a
- emptyOccSet :: OccSet
- emptyTidyOccEnv :: TidyOccEnv
- extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a
- extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a
- extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b
- extendOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv a
- extendOccSet :: OccSet -> OccName -> OccSet
- extendOccSetList :: OccSet -> [OccName] -> OccSet
- filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt
- filterOccSet :: (OccName -> Bool) -> OccSet -> OccSet
- foldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b
- initTidyOccEnv :: [OccName] -> TidyOccEnv
- intersectOccSet :: OccSet -> OccSet -> OccSet
- isDataConNameSpace :: NameSpace -> Bool
- isDataOcc :: OccName -> Bool
- isDataSymOcc :: OccName -> Bool
- isDefaultMethodOcc :: OccName -> Bool
- isDerivedOccName :: OccName -> Bool
- isEmptyOccSet :: OccSet -> Bool
- isSymOcc :: OccName -> Bool
- isTcClsNameSpace :: NameSpace -> Bool
- isTcOcc :: OccName -> Bool
- isTvNameSpace :: NameSpace -> Bool
- isTvOcc :: OccName -> Bool
- isTypeableBindOcc :: OccName -> Bool
- isValNameSpace :: NameSpace -> Bool
- isValOcc :: OccName -> Bool
- isVarNameSpace :: NameSpace -> Bool
- isVarOcc :: OccName -> Bool
- lookupOccEnv :: OccEnv a -> OccName -> Maybe a
- mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
- minusOccSet :: OccSet -> OccSet -> OccSet
- mkBuilderOcc :: OccName -> OccName
- mkClassDataConOcc :: OccName -> OccName
- mkClassOpAuxOcc :: OccName -> OccName
- mkClsOcc :: String -> OccName
- mkClsOccFS :: FastString -> OccName
- mkCon2TagOcc :: OccName -> OccName
- mkDFunOcc :: String -> Bool -> OccSet -> OccName
- mkDataCOcc :: OccName -> OccName
- mkDataConWorkerOcc :: OccName -> OccName
- mkDataConWrapperOcc :: OccName -> OccName
- mkDataOcc :: String -> OccName
- mkDataOccFS :: FastString -> OccName
- mkDataTOcc :: OccName -> OccName
- mkDefaultMethodOcc :: OccName -> OccName
- mkDictOcc :: OccName -> OccName
- mkEqPredCoOcc :: OccName -> OccName
- mkForeignExportOcc :: OccName -> OccName
- mkGen1R :: OccName -> OccName
- mkGenR :: OccName -> OccName
- mkIPOcc :: OccName -> OccName
- mkInstTyCoOcc :: OccName -> OccName
- mkInstTyTcOcc :: String -> OccSet -> OccName
- mkLocalOcc :: Unique -> OccName -> OccName
- mkMatcherOcc :: OccName -> OccName
- mkMaxTagOcc :: OccName -> OccName
- mkMethodOcc :: OccName -> OccName
- mkNewTyCoOcc :: OccName -> OccName
- mkOccEnv :: [(OccName, a)] -> OccEnv a
- mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a
- mkOccName :: NameSpace -> String -> OccName
- mkOccNameFS :: NameSpace -> FastString -> OccName
- mkOccSet :: [OccName] -> OccSet
- mkRepEqOcc :: OccName -> OccName
- mkSpecOcc :: OccName -> OccName
- mkSuperDictAuxOcc :: Int -> OccName -> OccName
- mkSuperDictSelOcc :: Int -> OccName -> OccName
- mkTag2ConOcc :: OccName -> OccName
- mkTcOcc :: String -> OccName
- mkTcOccFS :: FastString -> OccName
- mkTyConRepOcc :: OccName -> OccName
- mkTyVarOcc :: String -> OccName
- mkTyVarOccFS :: FastString -> OccName
- mkVarOcc :: String -> OccName
- mkWorkerOcc :: OccName -> OccName
- nameSpacesRelated :: NameSpace -> NameSpace -> Bool
- occEnvElts :: OccEnv a -> [a]
- parenSymOcc :: OccName -> SDoc -> SDoc
- plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a
- plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a
- pprNameSpace :: NameSpace -> SDoc
- pprNameSpaceBrief :: NameSpace -> SDoc
- pprNonVarNameSpace :: NameSpace -> SDoc
- pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc
- pprOccName :: OccName -> SDoc
- promoteOccName :: OccName -> Maybe OccName
- setOccNameSpace :: NameSpace -> OccName -> OccName
- srcDataName :: NameSpace
- startsWithUnderscore :: OccName -> Bool
- tcClsName :: NameSpace
- tcName :: NameSpace
- tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)
- tvName :: NameSpace
- unionManyOccSets :: [OccSet] -> OccSet
- unionOccSets :: OccSet -> OccSet -> OccSet
- unitOccEnv :: OccName -> a -> OccEnv a
- unitOccSet :: OccName -> OccSet
- data NameSpace
- data OccEnv a
- type OccSet = UniqSet OccName
- type TidyOccEnv = UniqFM FastString Int
- getOccFS :: NamedThing a => a -> FastString
- getOccString :: NamedThing a => a -> String
- getSrcLoc :: NamedThing a => a -> SrcLoc
- getSrcSpan :: NamedThing a => a -> SrcSpan
- isBuiltInSyntax :: Name -> Bool
- isDataConName :: Name -> Bool
- isDynLinkName :: Platform -> Module -> Name -> Bool
- isExternalName :: Name -> Bool
- isHoleName :: Name -> Bool
- isInternalName :: Name -> Bool
- isSystemName :: Name -> Bool
- isTyConName :: Name -> Bool
- isTyVarName :: Name -> Bool
- isValName :: Name -> Bool
- isVarName :: Name -> Bool
- isWiredIn :: NamedThing thing => thing -> Bool
- isWiredInName :: Name -> Bool
- localiseName :: Name -> Name
- mkClonedInternalName :: Unique -> Name -> Name
- mkDerivedInternalName :: (OccName -> OccName) -> Unique -> Name -> Name
- mkExternalName :: Unique -> Module -> OccName -> SrcSpan -> Name
- mkFCallName :: Unique -> String -> Name
- mkInternalName :: Unique -> OccName -> SrcSpan -> Name
- mkSysTvName :: Unique -> FastString -> Name
- mkSystemName :: Unique -> OccName -> Name
- mkSystemNameAt :: Unique -> OccName -> SrcSpan -> Name
- mkSystemVarName :: Unique -> FastString -> Name
- mkWiredInName :: Module -> OccName -> Unique -> TyThing -> BuiltInSyntax -> Name
- nameIsFromExternalPackage :: HomeUnit -> Name -> Bool
- nameIsHomePackage :: Module -> Name -> Bool
- nameIsHomePackageImport :: Module -> Name -> Bool
- nameIsLocalOrFrom :: Module -> Name -> Bool
- nameModule :: HasDebugCallStack => Name -> Module
- nameModule_maybe :: Name -> Maybe Module
- nameNameSpace :: Name -> NameSpace
- nameSrcLoc :: Name -> SrcLoc
- nameSrcSpan :: Name -> SrcSpan
- nameStableString :: Name -> String
- pprDefinedAt :: Name -> SDoc
- pprInfixName :: (Outputable a, NamedThing a) => a -> SDoc
- pprModulePrefix :: PprStyle -> Module -> OccName -> SDoc
- pprNameDefnLoc :: Name -> SDoc
- pprNameUnqualified :: Name -> SDoc
- pprPrefixName :: NamedThing a => a -> SDoc
- setNameLoc :: Name -> SrcSpan -> Name
- stableNameCmp :: Name -> Name -> Ordering
- wiredInNameTyThing_maybe :: Name -> Maybe TyThing
- data BuiltInSyntax
  - = BuiltInSyntax
  - | UserSyntax
- module GHC.Types.Var
- type Id = Var
- data Var
- idName :: Id -> Name
- globaliseId :: Id -> Id
- idDetails :: Id -> IdDetails
- idInfo :: HasDebugCallStack => Id -> IdInfo
- isExportedId :: Var -> Bool
- isGlobalId :: Var -> Bool
- isId :: Var -> Bool
- isLocalId :: Var -> Bool
- setIdMult :: Id -> Mult -> Id
- updateIdTypeAndMult :: (Type -> Type) -> Id -> Id
- updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m Id
- updateIdTypeButNotMult :: (Type -> Type) -> Id -> Id
- type InId = Id
- type InVar = Var
- type JoinId = Id
- type OutId = Id
- type OutVar = Var
- asJoinId :: Id -> JoinArity -> JoinId
- asJoinId_maybe :: Id -> Maybe JoinArity -> Id
- clearOneShotLambda :: Id -> Id
- hasNoBinding :: Id -> Bool
- idArity :: Id -> Arity
- idCafInfo :: Id -> CafInfo
- idCallArity :: Id -> Arity
- idCoreRules :: Id -> [CoreRule]
- idCprInfo :: Id -> CprSig
- idDataCon :: Id -> DataCon
- idDemandInfo :: Id -> Demand
- idFunRepArity :: Id -> RepArity
- idHasRules :: Id -> Bool
- idInlineActivation :: Id -> Activation
- idInlinePragma :: Id -> InlinePragma
- idIsFrom :: Module -> Id -> Bool
- idJoinArity :: JoinId -> JoinArity
- idLFInfo_maybe :: Id -> Maybe LambdaFormInfo
- idMult :: Id -> Mult
- idOccInfo :: Id -> OccInfo
- idOneShotInfo :: Id -> OneShotInfo
- idRuleMatchInfo :: Id -> RuleMatchInfo
- idScaledType :: Id -> Scaled Type
- idSpecialisation :: Id -> RuleInfo
- idStateHackOneShotInfo :: Id -> OneShotInfo
- idStrictness :: Id -> StrictSig
- idType :: Id -> Kind
- idUnfolding :: Id -> Unfolding
- idUnique :: Id -> Unique
- isClassOpId_maybe :: Id -> Maybe Class
- isConLikeId :: Id -> Bool
- isDFunId :: Id -> Bool
- isDataConId_maybe :: Id -> Maybe DataCon
- isDataConRecordSelector :: Id -> Bool
- isDataConWorkId :: Id -> Bool
- isDataConWorkId_maybe :: Id -> Maybe DataCon
- isDataConWrapId :: Id -> Bool
- isDataConWrapId_maybe :: Id -> Maybe DataCon
- isDeadBinder :: Id -> Bool
- isDeadEndId :: Var -> Bool
- isFCallId :: Id -> Bool
- isFCallId_maybe :: Id -> Maybe ForeignCall
- isImplicitId :: Id -> Bool
- isJoinId :: Var -> Bool
- isJoinId_maybe :: Var -> Maybe JoinArity
- isNaughtyRecordSelector :: Id -> Bool
- isNeverLevPolyId :: Id -> Bool
- isOneShotBndr :: Var -> Bool
- isPatSynRecordSelector :: Id -> Bool
- isPrimOpId :: Id -> Bool
- isPrimOpId_maybe :: Id -> Maybe PrimOp
- isProbablyOneShotLambda :: Id -> Bool
- isRecordSelector :: Id -> Bool
- isStateHackType :: Type -> Bool
- isStrictId :: Id -> Bool
- localiseId :: Id -> Id
- maybeModifyIdInfo :: Maybe IdInfo -> Id -> Id
- mkExportedLocalId :: IdDetails -> Name -> Type -> Id
- mkExportedVanillaId :: Name -> Type -> Id
- mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkLocalCoVar :: Name -> Type -> CoVar
- mkLocalId :: HasDebugCallStack => Name -> Mult -> Type -> Id
- mkLocalIdOrCoVar :: Name -> Mult -> Type -> Id
- mkLocalIdWithInfo :: HasDebugCallStack => Name -> Mult -> Type -> IdInfo -> Id
- mkScaledTemplateLocal :: Int -> Scaled Type -> Id
- mkSysLocal :: FastString -> Unique -> Mult -> Type -> Id
- mkSysLocalM :: MonadUnique m => FastString -> Mult -> Type -> m Id
- mkSysLocalOrCoVar :: FastString -> Unique -> Mult -> Type -> Id
- mkSysLocalOrCoVarM :: MonadUnique m => FastString -> Mult -> Type -> m Id
- mkTemplateLocal :: Int -> Type -> Id
- mkTemplateLocals :: [Type] -> [Id]
- mkTemplateLocalsNum :: Int -> [Type] -> [Id]
- mkUserLocal :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id
- mkUserLocalOrCoVar :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id
- mkVanillaGlobal :: Name -> Type -> Id
- mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id
- mkWorkerId :: Unique -> Id -> Type -> Id
- modifyIdInfo :: HasDebugCallStack => (IdInfo -> IdInfo) -> Id -> Id
- modifyInlinePragma :: Id -> (InlinePragma -> InlinePragma) -> Id
- realIdUnfolding :: Id -> Unfolding
- recordSelectorTyCon :: Id -> RecSelParent
- recordSelectorTyCon_maybe :: Id -> Maybe RecSelParent
- scaleIdBy :: Mult -> Id -> Id
- scaleVarBy :: Mult -> Var -> Var
- setCaseBndrEvald :: StrictnessMark -> Id -> Id
- setIdArity :: Id -> Arity -> Id
- setIdCafInfo :: Id -> CafInfo -> Id
- setIdCallArity :: Id -> Arity -> Id
- setIdCprInfo :: Id -> CprSig -> Id
- setIdDemandInfo :: Id -> Demand -> Id
- setIdInfo :: Id -> IdInfo -> Id
- setIdLFInfo :: Id -> LambdaFormInfo -> Id
- setIdName :: Id -> Name -> Id
- setIdOccInfo :: Id -> OccInfo -> Id
- setIdOneShotInfo :: Id -> OneShotInfo -> Id
- setIdSpecialisation :: Id -> RuleInfo -> Id
- setIdStrictness :: Id -> StrictSig -> Id
- setIdType :: Id -> Type -> Id
- setIdUnfolding :: Id -> Unfolding -> Id
- setIdUnique :: Id -> Unique -> Id
- setInlineActivation :: Id -> Activation -> Id
- setInlinePragma :: Id -> InlinePragma -> Id
- setOneShotLambda :: Id -> Id
- stateHackOneShot :: OneShotInfo
- transferPolyIdInfo :: Id -> [Var] -> Id -> Id
- typeOneShot :: Type -> OneShotInfo
- updOneShotInfo :: Id -> OneShotInfo -> Id
- zapFragileIdInfo :: Id -> Id
- zapIdDemandInfo :: Id -> Id
- zapIdOccInfo :: Id -> Id
- zapIdStrictness :: Id -> Id
- zapIdTailCallInfo :: Id -> Id
- zapIdUsageEnvInfo :: Id -> Id
- zapIdUsageInfo :: Id -> Id
- zapIdUsedOnceInfo :: Id -> Id
- zapJoinId :: Id -> Id
- zapLamIdInfo :: Id -> Id
- zapStableUnfolding :: Id -> Id
- module GHC.Types.Id.Info
- module GHC.Core.Opt.Monad
- module GHC.Core
- module GHC.Types.Literal
- module GHC.Core.DataCon
- module GHC.Core.Utils
- module GHC.Core.Make
- module GHC.Core.FVs
- data InScopeSet
- extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst
- type TvSubstEnv = TyVarEnv Type
- addInScopeSet :: Subst -> VarSet -> Subst
- cloneBndr :: Subst -> Unique -> Var -> (Subst, Var)
- cloneBndrs :: Subst -> UniqSupply -> [Var] -> (Subst, [Var])
- cloneIdBndr :: Subst -> UniqSupply -> Id -> (Subst, Id)
- cloneIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id])
- cloneRecIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id])
- deShadowBinds :: CoreProgram -> CoreProgram
- delBndr :: Subst -> Var -> Subst
- delBndrs :: Subst -> [Var] -> Subst
- emptySubst :: Subst
- extendIdSubst :: Subst -> Id -> CoreExpr -> Subst
- extendIdSubstList :: Subst -> [(Id, CoreExpr)] -> Subst
- extendInScope :: Subst -> Var -> Subst
- extendInScopeIds :: Subst -> [Id] -> Subst
- extendInScopeList :: Subst -> [Var] -> Subst
- extendSubst :: Subst -> Var -> CoreArg -> Subst
- extendSubstList :: Subst -> [(Var, CoreArg)] -> Subst
- extendSubstWithVar :: Subst -> Var -> Var -> Subst
- extendTvSubst :: Subst -> TyVar -> Type -> Subst
- extendTvSubstList :: Subst -> [(TyVar, Type)] -> Subst
- getTCvSubst :: Subst -> TCvSubst
- isEmptySubst :: Subst -> Bool
- isInScope :: Var -> Subst -> Bool
- lookupIdSubst :: HasDebugCallStack => Subst -> Id -> CoreExpr
- lookupTCvSubst :: Subst -> TyVar -> Type
- mkEmptySubst :: InScopeSet -> Subst
- mkOpenSubst :: InScopeSet -> [(Var, CoreArg)] -> Subst
- mkSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> IdSubstEnv -> Subst
- setInScope :: Subst -> InScopeSet -> Subst
- substBind :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind)
- substBindSC :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind)
- substBndr :: Subst -> Var -> (Subst, Var)
- substBndrs :: Subst -> [Var] -> (Subst, [Var])
- substCo :: HasCallStack => Subst -> Coercion -> Coercion
- substDVarSet :: Subst -> DVarSet -> DVarSet
- substExpr :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr
- substExprSC :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr
- substIdInfo :: Subst -> Id -> IdInfo -> Maybe IdInfo
- substIdOcc :: Subst -> Id -> Id
- substIdType :: Subst -> Id -> Id
- substInScope :: Subst -> InScopeSet
- substRecBndrs :: Subst -> [Id] -> (Subst, [Id])
- substRuleInfo :: Subst -> Id -> RuleInfo -> RuleInfo
- substRulesForImportedIds :: Subst -> [CoreRule] -> [CoreRule]
- substTickish :: Subst -> CoreTickish -> CoreTickish
- substTy :: Subst -> Type -> Type
- substUnfolding :: Subst -> Unfolding -> Unfolding
- substUnfoldingSC :: Subst -> Unfolding -> Unfolding
- zapSubstEnv :: Subst -> Subst
- type IdSubstEnv = IdEnv CoreExpr
- data Subst = Subst InScopeSet IdSubstEnv TvSubstEnv CvSubstEnv
- module GHC.Core.Rules
- module GHC.Types.Annotations
- module GHC.Driver.Session
- module GHC.Driver.Ppr
- module GHC.Unit.State
- module GHC.Unit.Module
- data AnonArgFlag
  - = VisArg
  - | InvisArg
- data ArgFlag where
  - Invisible Specificity
  - Required
  - pattern Inferred :: ArgFlag
  - pattern Specified :: ArgFlag
- data Specificity
  - = InferredSpec
  - | SpecifiedSpec
- type TyCoVar = Id
- type TyVar = Var
- data Var
- mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type
- type Kind = Type
- type Mult = Type
- type PredType = Type
- data Scaled a
- type ThetaType = [PredType]
- data TyCoBinder
- data Type
- coreView :: Type -> Maybe Type
- isCoercionTy :: Type -> Bool
- isLiftedTypeKind :: Kind -> Bool
- isMultiplicityTy :: Type -> Bool
- isPredTy :: HasDebugCallStack => Type -> Bool
- isRuntimeRepTy :: Type -> Bool
- mkAppTy :: Type -> Type -> Type
- mkCastTy :: Type -> Coercion -> Type
- mkTyConApp :: TyCon -> [Type] -> Type
- mkTyConTy :: TyCon -> Type
- partitionInvisibleTypes :: TyCon -> [Type] -> ([Type], [Type])
- piResultTy :: HasDebugCallStack => Type -> Type -> Type
- splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
- tYPE :: Type -> Type
- tcView :: Type -> Maybe Type
- tyConAppTyCon_maybe :: Type -> Maybe TyCon
- liftedTypeKind :: Kind
- unliftedTypeKind :: Kind
- unrestrictedFunTyCon :: TyCon
- binderArgFlag :: VarBndr tv argf -> argf
- binderType :: VarBndr TyCoVar argf -> Type
- binderVar :: VarBndr tv argf -> tv
- binderVars :: [VarBndr tv argf] -> [tv]
- isInvisibleArgFlag :: ArgFlag -> Bool
- isTyVar :: Var -> Bool
- isVisibleArgFlag :: ArgFlag -> Bool
- mkTyCoVarBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis
- mkTyCoVarBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis]
- mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis
- mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis]
- sameVis :: ArgFlag -> ArgFlag -> Bool
- tyVarKind :: TyVar -> Kind
- tyVarSpecToBinders :: [VarBndr a Specificity] -> [VarBndr a ArgFlag]
- type TyCoVarBinder = VarBndr TyCoVar ArgFlag
- type TyVarBinder = VarBndr TyVar ArgFlag
- isConstraintKindCon :: TyCon -> Bool
- foldTyCo :: Monoid a => TyCoFolder env a -> env -> (Type -> a, [Type] -> a, Coercion -> a, [Coercion] -> a)
- isInvisibleBinder :: TyCoBinder -> Bool
- isNamedBinder :: TyCoBinder -> Bool
- isVisibleBinder :: TyCoBinder -> Bool
- mkForAllTys :: [TyCoVarBinder] -> Type -> Type
- mkFunTy :: AnonArgFlag -> Mult -> Type -> Type -> Type
- mkInvisForAllTys :: [InvisTVBinder] -> Type -> Type
- mkInvisFunTy :: Mult -> Type -> Type -> Type
- mkInvisFunTyMany :: Type -> Type -> Type
- mkInvisFunTysMany :: [Type] -> Type -> Type
- mkPiTy :: TyCoBinder -> Type -> Type
- mkPiTys :: [TyCoBinder] -> Type -> Type
- mkTyVarTy :: TyVar -> Type
- mkTyVarTys :: [TyVar] -> [Type]
- mkVisFunTy :: Mult -> Type -> Type -> Type
- mkVisFunTyMany :: Type -> Type -> Type
- mkVisFunTys :: [Scaled Type] -> Type -> Type
- mkVisFunTysMany :: [Type] -> Type -> Type
- typeSize :: Type -> Int
- type KindOrType = Type
- type KnotTied ty = ty
- data TyCoFolder env a = TyCoFolder {
  - tcf_view :: Type -> Maybe Type
  - tcf_tyvar :: env -> TyVar -> a
  - tcf_covar :: env -> CoVar -> a
  - tcf_hole :: env -> CoercionHole -> a
  - tcf_tycobinder :: env -> TyCoVar -> ArgFlag -> env
  }
- anyFreeVarsOfType :: (TyCoVar -> Bool) -> Type -> Bool
- anyFreeVarsOfTypes :: (TyCoVar -> Bool) -> [Type] -> Bool
- closeOverKinds :: TyCoVarSet -> TyCoVarSet
- closeOverKindsDSet :: DTyVarSet -> DTyVarSet
- closeOverKindsList :: [TyVar] -> [TyVar]
- coVarsOfType :: Type -> CoVarSet
- coVarsOfTypes :: [Type] -> CoVarSet
- noFreeVarsOfType :: Type -> Bool
- scopedSort :: [TyCoVar] -> [TyCoVar]
- tyCoFVsBndr :: TyCoVarBinder -> FV -> FV
- tyCoFVsOfType :: Type -> FV
- tyCoFVsVarBndr :: Var -> FV -> FV
- tyCoFVsVarBndrs :: [Var] -> FV -> FV
- tyCoVarsOfType :: Type -> TyCoVarSet
- tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
- tyCoVarsOfTypeWellScoped :: Type -> [TyVar]
- tyCoVarsOfTypes :: [Type] -> TyCoVarSet
- tyCoVarsOfTypesWellScoped :: [Type] -> [TyVar]
- tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv
- tidyKind :: TidyEnv -> Kind -> Kind
- tidyOpenKind :: TidyEnv -> Kind -> (TidyEnv, Kind)
- tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
- tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
- tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type)
- tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type])
- tidyTopType :: Type -> Type
- tidyTyCoVarBinder :: TidyEnv -> VarBndr TyCoVar vis -> (TidyEnv, VarBndr TyCoVar vis)
- tidyTyCoVarBinders :: TidyEnv -> [VarBndr TyCoVar vis] -> (TidyEnv, [VarBndr TyCoVar vis])
- tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar
- tidyType :: TidyEnv -> Type -> Type
- tidyTypes :: TidyEnv -> [Type] -> [Type]
- tidyVarBndr :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
- tidyVarBndrs :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
- cloneTyVarBndr :: TCvSubst -> TyVar -> Unique -> (TCvSubst, TyVar)
- cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar])
- composeTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
- composeTCvSubstEnv :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv)
- emptyTCvSubst :: TCvSubst
- emptyTvSubstEnv :: TvSubstEnv
- extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst
- extendTCvInScope :: TCvSubst -> Var -> TCvSubst
- extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst
- extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst
- extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst
- extendTCvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst
- extendTCvSubstWithClone :: TCvSubst -> TyCoVar -> TyCoVar -> TCvSubst
- extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
- extendTvSubstBinderAndInScope :: TCvSubst -> TyCoBinder -> Type -> TCvSubst
- extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst
- getTCvInScope :: TCvSubst -> InScopeSet
- getTCvSubstRangeFVs :: TCvSubst -> VarSet
- getTvSubstEnv :: TCvSubst -> TvSubstEnv
- isEmptyTCvSubst :: TCvSubst -> Bool
- lookupTyVar :: TCvSubst -> TyVar -> Maybe Type
- mkEmptyTCvSubst :: InScopeSet -> TCvSubst
- mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst
- mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst
- notElemTCvSubst :: Var -> TCvSubst -> Bool
- setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst
- substCoUnchecked :: TCvSubst -> Coercion -> Coercion
- substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion
- substScaledTy :: HasCallStack => TCvSubst -> Scaled Type -> Scaled Type
- substScaledTyUnchecked :: HasCallStack => TCvSubst -> Scaled Type -> Scaled Type
- substScaledTys :: HasCallStack => TCvSubst -> [Scaled Type] -> [Scaled Type]
- substScaledTysUnchecked :: TCvSubst -> [Scaled Type] -> [Scaled Type]
- substTheta :: HasCallStack => TCvSubst -> ThetaType -> ThetaType
- substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType
- substTyAddInScope :: TCvSubst -> Type -> Type
- substTyCoBndr :: TCvSubst -> TyCoBinder -> (TCvSubst, TyCoBinder)
- substTyUnchecked :: TCvSubst -> Type -> Type
- substTyVar :: TCvSubst -> TyVar -> Type
- substTyVarBndr :: HasCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar)
- substTyVarBndrs :: HasCallStack => TCvSubst -> [TyVar] -> (TCvSubst, [TyVar])
- substTyVars :: TCvSubst -> [TyVar] -> [Type]
- substTyWith :: HasCallStack => [TyVar] -> [Type] -> Type -> Type
- substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type
- substTys :: HasCallStack => TCvSubst -> [Type] -> [Type]
- substTysUnchecked :: TCvSubst -> [Type] -> [Type]
- substTysWith :: [TyVar] -> [Type] -> [Type] -> [Type]
- substVarBndr :: HasCallStack => TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar)
- substVarBndrs :: HasCallStack => TCvSubst -> [TyCoVar] -> (TCvSubst, [TyCoVar])
- unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst
- zapTCvSubst :: TCvSubst -> TCvSubst
- zipCoEnv :: HasDebugCallStack => [CoVar] -> [Coercion] -> CvSubstEnv
- zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> TCvSubst
- zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> TCvSubst
- zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv
- data TCvSubst = TCvSubst InScopeSet TvSubstEnv CvSubstEnv
- type TvSubstEnv = TyVarEnv Type
- funTyCon :: TyCon
- pattern Many :: Mult
- pattern One :: Mult
- appTyArgFlags :: Type -> [Type] -> [ArgFlag]
- applyTysX :: [TyVar] -> Type -> [Type] -> Type
- binderRelevantType_maybe :: TyCoBinder -> Maybe Type
- buildSynTyCon :: Name -> [KnotTied TyConBinder] -> Kind -> [Role] -> KnotTied Type -> TyCon
- classifiesTypeWithValues :: Kind -> Bool
- coAxNthLHS :: CoAxiom br -> Int -> Type
- dropForAlls :: Type -> Type
- dropRuntimeRepArgs :: [Type] -> [Type]
- eqType :: Type -> Type -> Bool
- eqTypeX :: RnEnv2 -> Type -> Type -> Bool
- eqTypes :: [Type] -> [Type] -> Bool
- eqVarBndrs :: RnEnv2 -> [Var] -> [Var] -> Maybe RnEnv2
- expandTypeSynonyms :: Type -> Type
- filterOutInferredTypes :: TyCon -> [Type] -> [Type]
- filterOutInvisibleTypes :: TyCon -> [Type] -> [Type]
- funArgTy :: Type -> Type
- funResultTy :: Type -> Type
- getCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN)
- getRuntimeRep :: HasDebugCallStack => Type -> Type
- getRuntimeRep_maybe :: HasDebugCallStack => Type -> Maybe Type
- getTyVar :: String -> Type -> TyVar
- getTyVar_maybe :: Type -> Maybe TyVar
- invisibleTyBndrCount :: Type -> Int
- irrelevantMult :: Scaled a -> a
- isAlgType :: Type -> Bool
- isAnonTyCoBinder :: TyCoBinder -> Bool
- isAtomicTy :: Type -> Bool
- isBoxedRuntimeRep :: Type -> Bool
- isBoxedType :: Type -> Bool
- isBoxedTypeKind :: Kind -> Bool
- isCharLitTy :: Type -> Maybe Char
- isCoVarType :: Type -> Bool
- isCoercionTy_maybe :: Type -> Maybe Coercion
- isDataFamilyAppType :: Type -> Bool
- isFamFreeTy :: Type -> Bool
- isForAllTy :: Type -> Bool
- isForAllTy_co :: Type -> Bool
- isForAllTy_ty :: Type -> Bool
- isFunTy :: Type -> Bool
- isKindLevPoly :: Kind -> Bool
- isLevityTy :: Type -> Bool
- isLevityVar :: TyVar -> Bool
- isLiftedLevity :: Type -> Bool
- isLiftedRuntimeRep :: Type -> Bool
- isLiftedType_maybe :: HasDebugCallStack => Type -> Maybe Bool
- isLinearType :: Type -> Bool
- isLitTy :: Type -> Maybe TyLit
- isManyDataConTy :: Mult -> Bool
- isMultiplicityVar :: TyVar -> Bool
- isNumLitTy :: Type -> Maybe Integer
- isOneDataConTy :: Mult -> Bool
- isPiTy :: Type -> Bool
- isPrimitiveType :: Type -> Bool
- isRuntimeRepKindedTy :: Type -> Bool
- isRuntimeRepVar :: TyVar -> Bool
- isStrLitTy :: Type -> Maybe FastString
- isStrictType :: HasDebugCallStack => Type -> Bool
- isTauTy :: Type -> Bool
- isTyVarTy :: Type -> Bool
- isTypeLevPoly :: Type -> Bool
- isUnboxedSumType :: Type -> Bool
- isUnboxedTupleType :: Type -> Bool
- isUnliftedLevity :: Type -> Bool
- isUnliftedRuntimeRep :: Type -> Bool
- isUnliftedType :: HasDebugCallStack => Type -> Bool
- isUnliftedTypeKind :: Kind -> Bool
- isValidJoinPointType :: JoinArity -> Type -> Bool
- kindRep :: HasDebugCallStack => Kind -> Type
- kindRep_maybe :: HasDebugCallStack => Kind -> Maybe Type
- linear :: a -> Scaled a
- mapTyCo :: Monad m => TyCoMapper () m -> (Type -> m Type, [Type] -> m [Type], Coercion -> m Coercion, [Coercion] -> m [Coercion])
- mapTyCoX :: Monad m => TyCoMapper env m -> (env -> Type -> m Type, env -> [Type] -> m [Type], env -> Coercion -> m Coercion, env -> [Coercion] -> m [Coercion])
- mightBeUnliftedType :: Type -> Bool
- mkAnonBinder :: AnonArgFlag -> Scaled Type -> TyCoBinder
- mkAppTys :: Type -> [Type] -> Type
- mkCharLitTy :: Char -> Type
- mkCoercionTy :: Coercion -> Type
- mkFamilyTyConApp :: TyCon -> [Type] -> Type
- mkInfForAllTy :: TyVar -> Type -> Type
- mkInfForAllTys :: [TyVar] -> Type -> Type
- mkNumLitTy :: Integer -> Type
- mkScaled :: Mult -> a -> Scaled a
- mkSpecForAllTy :: TyVar -> Type -> Type
- mkSpecForAllTys :: [TyVar] -> Type -> Type
- mkStrLitTy :: FastString -> Type
- mkTyCoInvForAllTy :: TyCoVar -> Type -> Type
- mkTyCoInvForAllTys :: [TyCoVar] -> Type -> Type
- mkTyConBindersPreferAnon :: [TyVar] -> TyCoVarSet -> [TyConBinder]
- mkVisForAllTys :: [TyVar] -> Type -> Type
- newTyConInstRhs :: TyCon -> [Type] -> Type
- nonDetCmpTc :: TyCon -> TyCon -> Ordering
- nonDetCmpType :: Type -> Type -> Ordering
- nonDetCmpTypeX :: RnEnv2 -> Type -> Type -> Ordering
- nonDetCmpTypes :: [Type] -> [Type] -> Ordering
- nonDetCmpTypesX :: RnEnv2 -> [Type] -> [Type] -> Ordering
- occCheckExpand :: [Var] -> Type -> Maybe Type
- partitionInvisibles :: [(a, ArgFlag)] -> ([a], [a])
- piResultTys :: HasDebugCallStack => Type -> [Type] -> Type
- pickyIsLiftedTypeKind :: Kind -> Bool
- pprUserTypeErrorTy :: Type -> SDoc
- repGetTyVar_maybe :: Type -> Maybe TyVar
- repSplitAppTy_maybe :: HasDebugCallStack => Type -> Maybe (Type, Type)
- repSplitAppTys :: HasDebugCallStack => Type -> (Type, [Type])
- repSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
- resultIsLevPoly :: Type -> Bool
- scaledSet :: Scaled a -> b -> Scaled b
- seqType :: Type -> ()
- seqTypes :: [Type] -> ()
- splitAppTy :: Type -> (Type, Type)
- splitAppTy_maybe :: Type -> Maybe (Type, Type)
- splitAppTys :: Type -> (Type, [Type])
- splitCastTy_maybe :: Type -> Maybe (Type, Coercion)
- splitForAllCoVar_maybe :: Type -> Maybe (TyCoVar, Type)
- splitForAllInvisTVBinders :: Type -> ([InvisTVBinder], Type)
- splitForAllReqTVBinders :: Type -> ([ReqTVBinder], Type)
- splitForAllTyCoVar :: Type -> (TyCoVar, Type)
- splitForAllTyCoVarBinders :: Type -> ([TyCoVarBinder], Type)
- splitForAllTyCoVar_maybe :: Type -> Maybe (TyCoVar, Type)
- splitForAllTyCoVars :: Type -> ([TyCoVar], Type)
- splitForAllTyVar_maybe :: Type -> Maybe (TyCoVar, Type)
- splitFunTy :: Type -> (Mult, Type, Type)
- splitFunTy_maybe :: Type -> Maybe (Mult, Type, Type)
- splitFunTys :: Type -> ([Scaled Type], Type)
- splitInvisPiTys :: Type -> ([TyCoBinder], Type)
- splitInvisPiTysN :: Int -> Type -> ([TyCoBinder], Type)
- splitListTyConApp_maybe :: Type -> Maybe Type
- splitPiTy :: Type -> (TyCoBinder, Type)
- splitPiTy_maybe :: Type -> Maybe (TyCoBinder, Type)
- splitPiTys :: Type -> ([TyCoBinder], Type)
- splitTyConApp :: Type -> (TyCon, [Type])
- splitVisVarsOfType :: Type -> Pair TyCoVarSet
- splitVisVarsOfTypes :: [Type] -> Pair TyCoVarSet
- stripCoercionTy :: Type -> Coercion
- tcIsBoxedTypeKind :: Kind -> Bool
- tcIsConstraintKind :: Kind -> Bool
- tcIsLiftedTypeKind :: Kind -> Bool
- tcIsRuntimeTypeKind :: Kind -> Bool
- tcRepSplitAppTy_maybe :: Type -> Maybe (Type, Type)
- tcReturnsConstraintKind :: Kind -> Bool
- tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
- tcTypeKind :: HasDebugCallStack => Type -> Kind
- tyBinderType :: TyBinder -> Type
- tyCoBinderType :: TyCoBinder -> Type
- tyCoBinderVar_maybe :: TyCoBinder -> Maybe TyCoVar
- tyConAppArgN :: Int -> Type -> Type
- tyConAppArgs :: Type -> [Type]
- tyConAppArgs_maybe :: Type -> Maybe [Type]
- tyConAppNeedsKindSig :: Bool -> TyCon -> Int -> Bool
- tyConAppTyCon :: Type -> TyCon
- tyConAppTyConPicky_maybe :: Type -> Maybe TyCon
- tyConArgFlags :: TyCon -> [Type] -> [ArgFlag]
- tyConBindersTyCoBinders :: [TyConBinder] -> [TyCoBinder]
- tyConsOfType :: Type -> UniqSet TyCon
- tymult :: a -> Scaled a
- typeKind :: HasDebugCallStack => Type -> Kind
- unrestricted :: a -> Scaled a
- userTypeError_maybe :: Type -> Maybe Type
- data TyCoMapper env m = TyCoMapper {
  - tcm_tyvar :: env -> TyVar -> m Type
  - tcm_covar :: env -> CoVar -> m Coercion
  - tcm_hole :: env -> CoercionHole -> m Coercion
  - tcm_tycobinder :: env -> TyCoVar -> ArgFlag -> m (env, TyCoVar)
  - tcm_tycon :: TyCon -> m TyCon
  }
- module GHC.Core.TyCon
- type TyCoVar = Id
- data Var
- pickLR :: LeftOrRight -> (a, a) -> a
- data LeftOrRight
  - = CLeft
  - | CRight
- data Coercion
- type CoercionN = Coercion
- data MCoercion
  - = MRefl
  - | MCo Coercion
- type MCoercionN = MCoercion
- data UnivCoProvenance
- pprCo :: Coercion -> SDoc
- isCoVar :: Var -> Bool
- mkCoVar :: Name -> Type -> CoVar
- type CoVar = Id
- data Role
  - = Nominal
  - | Representational
  - | Phantom
- coVarKindsTypesRole :: HasDebugCallStack => CoVar -> (Kind, Kind, Type, Type, Role)
- coVarRole :: CoVar -> Role
- coercionKind :: Coercion -> Pair Type
- coercionLKind :: Coercion -> Type
- coercionRKind :: Coercion -> Type
- coercionType :: Coercion -> Type
- decomposePiCos :: HasDebugCallStack => CoercionN -> Pair Type -> [Type] -> ([CoercionN], CoercionN)
- isGReflCo :: Coercion -> Bool
- isReflCo :: Coercion -> Bool
- isReflexiveCo :: Coercion -> Bool
- liftCoSubst :: HasDebugCallStack => Role -> LiftingContext -> Type -> Coercion
- mkAppCo :: Coercion -> Coercion -> Coercion
- mkAxiomInstCo :: CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion
- mkAxiomRuleCo :: CoAxiomRule -> [Coercion] -> Coercion
- mkCoVarCo :: CoVar -> Coercion
- mkCoercionType :: Role -> Type -> Type -> Type
- mkForAllCo :: TyCoVar -> CoercionN -> Coercion -> Coercion
- mkFunCo :: Role -> CoercionN -> Coercion -> Coercion -> Coercion
- mkGReflCo :: Role -> Type -> MCoercionN -> Coercion
- mkInstCo :: Coercion -> Coercion -> Coercion
- mkKindCo :: Coercion -> Coercion
- mkLRCo :: LeftOrRight -> Coercion -> Coercion
- mkNomReflCo :: Type -> Coercion
- mkNthCo :: HasDebugCallStack => Role -> Int -> Coercion -> Coercion
- mkPhantomCo :: Coercion -> Type -> Type -> Coercion
- mkProofIrrelCo :: Role -> Coercion -> Coercion -> Coercion -> Coercion
- mkReflCo :: Role -> Type -> Coercion
- mkSubCo :: HasDebugCallStack => Coercion -> Coercion
- mkSymCo :: Coercion -> Coercion
- mkTransCo :: Coercion -> Coercion -> Coercion
- mkTyConAppCo :: HasDebugCallStack => Role -> TyCon -> [Coercion] -> Coercion
- mkUnivCo :: UnivCoProvenance -> Role -> Type -> Type -> Coercion
- seqCo :: Coercion -> ()
- data LiftingContext = LC TCvSubst LiftCoEnv
- coHoleCoVar :: CoercionHole -> CoVar
- coercionSize :: Coercion -> Int
- setCoHoleCoVar :: CoercionHole -> CoVar -> CoercionHole
- data CoercionHole = CoercionHole {
  - ch_co_var :: CoVar
  - ch_ref :: IORef (Maybe Coercion)
  }
- type CoercionP = Coercion
- type CoercionR = Coercion
- type MCoercionR = MCoercion
- anyFreeVarsOfCo :: (TyCoVar -> Bool) -> Coercion -> Bool
- coVarsOfCo :: Coercion -> CoVarSet
- tyCoFVsOfCo :: Coercion -> FV
- tyCoFVsOfCos :: [Coercion] -> FV
- tyCoVarsOfCo :: Coercion -> TyCoVarSet
- tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet
- tyCoVarsOfCos :: [Coercion] -> TyCoVarSet
- tidyCo :: TidyEnv -> Coercion -> Coercion
- tidyCos :: TidyEnv -> [Coercion] -> [Coercion]
- emptyCvSubstEnv :: CvSubstEnv
- extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst
- getCvSubstEnv :: TCvSubst -> CvSubstEnv
- lookupCoVar :: TCvSubst -> Var -> Maybe Coercion
- substCoVar :: TCvSubst -> CoVar -> Coercion
- substCoVarBndr :: HasCallStack => TCvSubst -> CoVar -> (TCvSubst, CoVar)
- substCoVars :: TCvSubst -> [CoVar] -> [Coercion]
- substCoWith :: HasCallStack => [TyVar] -> [Type] -> Coercion -> Coercion
- substCos :: HasCallStack => TCvSubst -> [Coercion] -> [Coercion]
- type CvSubstEnv = CoVarEnv Coercion
- pprParendCo :: Coercion -> SDoc
- buildCoercion :: Type -> Type -> CoercionN
- castCoercionKind :: Coercion -> CoercionN -> CoercionN -> Coercion
- castCoercionKind1 :: Coercion -> Role -> Type -> Type -> CoercionN -> Coercion
- castCoercionKind2 :: Coercion -> Role -> Type -> Type -> CoercionN -> CoercionN -> Coercion
- coToMCo :: Coercion -> MCoercion
- coVarKind :: CoVar -> Type
- coVarName :: CoVar -> Name
- coVarTypes :: HasDebugCallStack => CoVar -> Pair Type
- coercionHolesOfCo :: Coercion -> UniqSet CoercionHole
- coercionHolesOfType :: Type -> UniqSet CoercionHole
- coercionKindRole :: Coercion -> (Pair Type, Role)
- coercionKinds :: [Coercion] -> Pair [Type]
- coercionRole :: Coercion -> Role
- composeSteppers :: NormaliseStepper ev -> NormaliseStepper ev -> NormaliseStepper ev
- decomposeCo :: Arity -> Coercion -> [Role] -> [Coercion]
- decomposeFunCo :: HasDebugCallStack => Role -> Coercion -> (CoercionN, Coercion, Coercion)
- downgradeRole :: Role -> Role -> Coercion -> Coercion
- emptyLiftingContext :: InScopeSet -> LiftingContext
- eqCoercion :: Coercion -> Coercion -> Bool
- eqCoercionX :: RnEnv2 -> Coercion -> Coercion -> Bool
- etaExpandCoAxBranch :: CoAxBranch -> ([TyVar], [Type], Type)
- extendLiftingContext :: LiftingContext -> TyCoVar -> Coercion -> LiftingContext
- extendLiftingContextAndInScope :: LiftingContext -> TyCoVar -> Coercion -> LiftingContext
- getCoVar_maybe :: Coercion -> Maybe CoVar
- hasCoercionHoleCo :: Coercion -> Bool
- hasCoercionHoleTy :: Type -> Bool
- instNewTyCon_maybe :: TyCon -> [Type] -> Maybe (Type, Coercion)
- isCoVar_maybe :: Coercion -> Maybe CoVar
- isGReflCo_maybe :: Coercion -> Maybe (Type, Role)
- isGReflMCo :: MCoercion -> Bool
- isMappedByLC :: TyCoVar -> LiftingContext -> Bool
- isReflCoVar_maybe :: Var -> Maybe Coercion
- isReflCo_maybe :: Coercion -> Maybe (Type, Role)
- isReflMCo :: MCoercion -> Bool
- isReflexiveCo_maybe :: Coercion -> Maybe (Type, Role)
- lcInScopeSet :: LiftingContext -> InScopeSet
- lcSubstLeft :: LiftingContext -> TCvSubst
- lcSubstRight :: LiftingContext -> TCvSubst
- lcTCvSubst :: LiftingContext -> TCvSubst
- liftCoSubstTyVar :: LiftingContext -> Role -> TyVar -> Maybe Coercion
- liftCoSubstVarBndrUsing :: (LiftingContext -> Type -> (CoercionN, a)) -> LiftingContext -> TyCoVar -> (LiftingContext, TyCoVar, CoercionN, a)
- liftCoSubstWith :: Role -> [TyCoVar] -> [Coercion] -> Type -> Coercion
- liftCoSubstWithEx :: Role -> [TyVar] -> [Coercion] -> [TyCoVar] -> [Type] -> (Type -> Coercion, [Type])
- liftEnvSubstLeft :: TCvSubst -> LiftCoEnv -> TCvSubst
- liftEnvSubstRight :: TCvSubst -> LiftCoEnv -> TCvSubst
- ltRole :: Role -> Role -> Bool
- mapStepResult :: (ev1 -> ev2) -> NormaliseStepResult ev1 -> NormaliseStepResult ev2
- mkAppCos :: Coercion -> [Coercion] -> Coercion
- mkAxInstCo :: Role -> CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Coercion
- mkAxInstLHS :: CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type
- mkAxInstRHS :: CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type
- mkCastTyMCo :: Type -> MCoercion -> Type
- mkCoCast :: Coercion -> CoercionR -> Coercion
- mkCoVarCos :: [CoVar] -> [Coercion]
- mkCoherenceLeftCo :: Role -> Type -> CoercionN -> Coercion -> Coercion
- mkCoherenceRightCo :: Role -> Type -> CoercionN -> Coercion -> Coercion
- mkCoherenceRightMCo :: Role -> Type -> MCoercionN -> Coercion -> Coercion
- mkFamilyTyConAppCo :: TyCon -> [CoercionN] -> CoercionN
- mkForAllCos :: [(TyCoVar, CoercionN)] -> Coercion -> Coercion
- mkGReflLeftCo :: Role -> Type -> CoercionN -> Coercion
- mkGReflLeftMCo :: Role -> Type -> MCoercionN -> Coercion
- mkGReflRightCo :: Role -> Type -> CoercionN -> Coercion
- mkGReflRightMCo :: Role -> Type -> MCoercionN -> Coercion
- mkHeteroCoercionType :: Role -> Kind -> Kind -> Type -> Type -> Type
- mkHeteroPrimEqPred :: Kind -> Kind -> Type -> Type -> Type
- mkHeteroReprPrimEqPred :: Kind -> Kind -> Type -> Type -> Type
- mkHoleCo :: CoercionHole -> Coercion
- mkHomoForAllCos :: [TyCoVar] -> Coercion -> Coercion
- mkNthCoFunCo :: Int -> CoercionN -> Coercion -> Coercion -> Coercion
- mkPiCo :: Role -> Var -> Coercion -> Coercion
- mkPiCos :: Role -> [Var] -> Coercion -> Coercion
- mkPrimEqPred :: Type -> Type -> Type
- mkPrimEqPredRole :: Role -> Type -> Type -> PredType
- mkRepReflCo :: Type -> Coercion
- mkReprPrimEqPred :: Type -> Type -> Type
- mkSubstLiftingContext :: TCvSubst -> LiftingContext
- mkSymMCo :: MCoercion -> MCoercion
- mkTransMCo :: MCoercion -> MCoercion -> MCoercion
- mkTransMCoL :: MCoercion -> Coercion -> MCoercion
- mkUnbranchedAxInstCo :: Role -> CoAxiom Unbranched -> [Type] -> [Coercion] -> Coercion
- mkUnbranchedAxInstLHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type
- mkUnbranchedAxInstRHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type
- multToCo :: Mult -> Coercion
- nthCoRole :: Int -> Coercion -> Role
- nthRole :: Role -> TyCon -> Int -> Role
- pprCoAxBranch :: TyCon -> CoAxBranch -> SDoc
- pprCoAxBranchLHS :: TyCon -> CoAxBranch -> SDoc
- pprCoAxBranchUser :: TyCon -> CoAxBranch -> SDoc
- pprCoAxiom :: CoAxiom br -> SDoc
- promoteCoercion :: Coercion -> CoercionN
- setCoVarName :: CoVar -> Name -> CoVar
- setCoVarUnique :: CoVar -> Unique -> CoVar
- setNominalRole_maybe :: Role -> Coercion -> Maybe Coercion
- simplifyArgsWorker :: [TyCoBinder] -> Kind -> TyCoVarSet -> [Role] -> [(Type, Coercion)] -> ([Type], [Coercion], MCoercionN)
- splitAppCo_maybe :: Coercion -> Maybe (Coercion, Coercion)
- splitForAllCo_co_maybe :: Coercion -> Maybe (CoVar, Coercion, Coercion)
- splitForAllCo_maybe :: Coercion -> Maybe (TyCoVar, Coercion, Coercion)
- splitForAllCo_ty_maybe :: Coercion -> Maybe (TyVar, Coercion, Coercion)
- splitFunCo_maybe :: Coercion -> Maybe (Coercion, Coercion)
- splitTyConAppCo_maybe :: Coercion -> Maybe (TyCon, [Coercion])
- substForAllCoBndrUsingLC :: Bool -> (Coercion -> Coercion) -> LiftingContext -> TyCoVar -> Coercion -> (LiftingContext, TyCoVar, Coercion)
- substLeftCo :: LiftingContext -> Coercion -> Coercion
- substRightCo :: LiftingContext -> Coercion -> Coercion
- swapLiftCoEnv :: LiftCoEnv -> LiftCoEnv
- tidyCoAxBndrsForUser :: TidyEnv -> [Var] -> (TidyEnv, [Var])
- topNormaliseNewType_maybe :: Type -> Maybe (Coercion, Type)
- topNormaliseTypeX :: NormaliseStepper ev -> (ev -> ev -> ev) -> Type -> Maybe (ev, Type)
- tyConRolesRepresentational :: TyCon -> [Role]
- tyConRolesX :: Role -> TyCon -> [Role]
- unwrapNewTypeStepper :: NormaliseStepper Coercion
- zapLiftingContext :: LiftingContext -> LiftingContext
- type HoleSet = UniqSet CoercionHole
- type LiftCoEnv = VarEnv Coercion
- data NormaliseStepResult ev
  - = NS_Done
  - | NS_Abort
  - | NS_Step RecTcChecker Type ev
- type NormaliseStepper ev = RecTcChecker -> TyCon -> [Type] -> NormaliseStepResult ev
- module GHC.Builtin.Types
- module GHC.Driver.Env
- module GHC.Types.Basic
- module GHC.Types.Var.Set
- module GHC.Types.Var.Env
- module GHC.Types.Name.Set
- module GHC.Types.Name.Env
- class Uniquable a where
  - getUnique :: a -> Unique
- data Unique
- module GHC.Types.Unique.Set
- module GHC.Types.Unique.FM
- module GHC.Data.FiniteMap
- module GHC.Utils.Misc
- module GHC.Serialized
- module GHC.Types.SrcLoc
- module GHC.Utils.Outputable
- module GHC.Utils.Panic
- module GHC.Types.Unique.Supply
- module GHC.Data.FastString
- module GHC.Tc.Errors.Hole.FitTypes
- module GHC.Unit.Module.ModGuts
- module GHC.Unit.Module.ModSummary
- module GHC.Unit.Module.ModIface
- module GHC.Types.Meta
- module GHC.Types.SourceError
- thNameToGhcName :: Name -> CoreM (Maybe Name)

# Documentation

module GHC.Driver.Plugins

module GHC.Types.Name.Reader

mkRecFldSelOcc :: String -> OccName Source #

mkVarOccFS :: FastString -> OccName Source #

occNameString :: OccName -> String Source #

class HasOccName name where Source #

Other names in the compiler add additional information to an OccName. This class provides a consistent way to access the underlying OccName.

Methods

occName :: name -> OccName Source #

#### Instances

Instances details

HasOccName IfaceClassOp Source # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceClassOp -> OccName Source #
HasOccName IfaceConDecl Source # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceConDecl -> OccName Source #
HasOccName IfaceDecl Source # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceDecl -> OccName Source #
HasOccName HoleFitCandidate Source # |
Instance details Defined in GHC.Tc.Errors.Hole.FitTypes Methods occName :: HoleFitCandidate -> OccName Source #
HasOccName TcBinder Source # |
Instance details Defined in GHC.Tc.Types Methods occName :: TcBinder -> OccName Source #
HasOccName GreName Source # |
Instance details Defined in GHC.Types.Avail Methods occName :: GreName -> OccName Source #
HasOccName FieldLabel Source # |
Instance details Defined in GHC.Types.FieldLabel Methods occName :: FieldLabel -> OccName Source #
HasOccName Name Source # |
Instance details Defined in GHC.Types.Name Methods occName :: Name -> OccName Source #
HasOccName OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods occName :: OccName -> OccName Source #
HasOccName GlobalRdrElt Source # |
Instance details Defined in GHC.Types.Name.Reader Methods occName :: GlobalRdrElt -> OccName Source #
HasOccName RdrName Source # |
Instance details Defined in GHC.Types.Name.Reader Methods occName :: RdrName -> OccName Source #
HasOccName Var Source # |
Instance details Defined in GHC.Types.Var Methods occName :: Var -> OccName Source #
HasOccName name => HasOccName (IEWrappedName name) Source # |
Instance details Defined in GHC.Hs.ImpExp Methods occName :: IEWrappedName name -> OccName Source #

data OccName Source #

Occurrence Name

In this context that means: "classified (i.e. as a type name, value name, etc) but not qualified and not yet resolved"

#### Instances

Instances details

Data OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OccName -> c OccName Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OccName Source # toConstr :: OccName -> Constr Source # dataTypeOf :: OccName -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OccName) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OccName) Source # gmapT :: (forall b. Data b => b -> b) -> OccName -> OccName Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r Source # gmapQ :: (forall d. Data d => d -> u) -> OccName -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> OccName -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source #
NFData OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: OccName -> () Source #
HasOccName OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods occName :: OccName -> OccName Source #
Uniquable OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: OccName -> Unique Source #
Binary OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods put_ :: BinHandle -> OccName -> IO () Source # put :: BinHandle -> OccName -> IO (Bin OccName) Source # get :: BinHandle -> IO OccName Source #
Outputable OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods ppr :: OccName -> SDoc Source #
OutputableBndr OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods pprBndr :: BindingSite -> OccName -> SDoc Source # pprPrefixOcc :: OccName -> SDoc Source # pprInfixOcc :: OccName -> SDoc Source # bndrIsJoin_maybe :: OccName -> Maybe Int Source #
Eq OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods (==) :: OccName -> OccName -> Bool # (/=) :: OccName -> OccName -> Bool #
Ord OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods compare :: OccName -> OccName -> Ordering # (<) :: OccName -> OccName -> Bool # (<=) :: OccName -> OccName -> Bool # (>) :: OccName -> OccName -> Bool # (>=) :: OccName -> OccName -> Bool # max :: OccName -> OccName -> OccName # min :: OccName -> OccName -> OccName #

emptyFsEnv :: FastStringEnv a Source #

extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a Source #

lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a Source #

mkFsEnv :: [(FastString, a)] -> FastStringEnv a Source #

type FastStringEnv a = UniqFM FastString a Source #

A non-deterministic set of FastStrings. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why it's not deterministic and why it matters. Use DFastStringEnv if the set eventually gets converted into a list or folded over in a way where the order changes the generated code.

alterOccEnv :: (Maybe elt -> Maybe elt) -> OccEnv elt -> OccName -> OccEnv elt Source #

avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv Source #

clsName :: NameSpace Source #

dataName :: NameSpace Source #

delFromOccEnv :: OccEnv a -> OccName -> OccEnv a Source #

delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a Source #

delTidyOccEnvList :: TidyOccEnv -> [FastString] -> TidyOccEnv Source #

demoteOccName :: OccName -> Maybe OccName Source #

elemOccEnv :: OccName -> OccEnv a -> Bool Source #

elemOccSet :: OccName -> OccSet -> Bool Source #

emptyOccEnv :: OccEnv a Source #

emptyOccSet :: OccSet Source #

emptyTidyOccEnv :: TidyOccEnv Source #

extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a Source #

extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a Source #

extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b Source #

extendOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv a Source #

extendOccSet :: OccSet -> OccName -> OccSet Source #

extendOccSetList :: OccSet -> [OccName] -> OccSet Source #

filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt Source #

filterOccSet :: (OccName -> Bool) -> OccSet -> OccSet Source #

foldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b Source #

initTidyOccEnv :: [OccName] -> TidyOccEnv Source #

intersectOccSet :: OccSet -> OccSet -> OccSet Source #

isDataConNameSpace :: NameSpace -> Bool Source #

isDataOcc :: OccName -> Bool Source #

isDataSymOcc :: OccName -> Bool Source #

Test if the `OccName` is a data constructor that starts with a symbol (e.g. `:`, or `[]`)

isDefaultMethodOcc :: OccName -> Bool Source #

isDerivedOccName :: OccName -> Bool Source #

Test for definitions internally generated by GHC. This predicate is used to suppress printing of internal definitions in some debug prints

isEmptyOccSet :: OccSet -> Bool Source #

isSymOcc :: OccName -> Bool Source #

Test if the `OccName` is that for any operator (whether it is a data constructor or variable or whatever)

isTcClsNameSpace :: NameSpace -> Bool Source #

isTcOcc :: OccName -> Bool Source #

isTvNameSpace :: NameSpace -> Bool Source #

isTvOcc :: OccName -> Bool Source #

isTypeableBindOcc :: OccName -> Bool Source #

Is an `OccName` one of a Typeable `TyCon` or `Module` binding? This is needed as these bindings are renamed differently. See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.

isValNameSpace :: NameSpace -> Bool Source #

isValOcc :: OccName -> Bool Source #

Value `OccNames`s are those that are either in the variable or data constructor namespaces

isVarNameSpace :: NameSpace -> Bool Source #

isVarOcc :: OccName -> Bool Source #

lookupOccEnv :: OccEnv a -> OccName -> Maybe a Source #

mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b Source #

minusOccSet :: OccSet -> OccSet -> OccSet Source #

mkBuilderOcc :: OccName -> OccName Source #

mkClassDataConOcc :: OccName -> OccName Source #

mkClassOpAuxOcc :: OccName -> OccName Source #

mkClsOcc :: String -> OccName Source #

mkClsOccFS :: FastString -> OccName Source #

mkCon2TagOcc :: OccName -> OccName Source #

mkDFunOcc Source #

Arguments

:: String | Typically the class and type glommed together e.g. `OrdMaybe`. Only used in debug mode, for extra clarity
-> Bool | Is this a hs-boot instance DFun?
-> OccSet | avoid these Occs
-> OccName | E.g. `$f3OrdMaybe`

mkDataCOcc :: OccName -> OccName Source #

mkDataConWorkerOcc :: OccName -> OccName Source #

mkDataConWrapperOcc :: OccName -> OccName Source #

mkDataOcc :: String -> OccName Source #

mkDataOccFS :: FastString -> OccName Source #

mkDataTOcc :: OccName -> OccName Source #

mkDefaultMethodOcc :: OccName -> OccName Source #

mkDictOcc :: OccName -> OccName Source #

mkEqPredCoOcc :: OccName -> OccName Source #

mkForeignExportOcc :: OccName -> OccName Source #

mkGen1R :: OccName -> OccName Source #

mkGenR :: OccName -> OccName Source #

mkIPOcc :: OccName -> OccName Source #

mkInstTyCoOcc :: OccName -> OccName Source #

mkInstTyTcOcc Source #

Arguments

:: String | Family name, e.g. `Map`
-> OccSet | avoid these Occs
-> OccName |
    R:Map

Derive a name for the representation type constructor of a `data`/`newtype` instance.

mkLocalOcc Source #

Arguments

:: Unique | Unique to combine with the `OccName`
-> OccName | Local name, e.g. `sat`
-> OccName | Nice unique version, e.g. `$L23sat`

mkMatcherOcc :: OccName -> OccName Source #

mkMaxTagOcc :: OccName -> OccName Source #

mkMethodOcc :: OccName -> OccName Source #

mkNewTyCoOcc :: OccName -> OccName Source #

mkOccEnv :: [(OccName, a)] -> OccEnv a Source #

mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a Source #

mkOccName :: NameSpace -> String -> OccName Source #

mkOccNameFS :: NameSpace -> FastString -> OccName Source #

mkOccSet :: [OccName] -> OccSet Source #

mkRepEqOcc :: OccName -> OccName Source #

mkSpecOcc :: OccName -> OccName Source #

mkSuperDictAuxOcc :: Int -> OccName -> OccName Source #

mkSuperDictSelOcc Source #

Arguments

:: Int | Index of superclass, e.g. 3
-> OccName | Class, e.g. `Ord`
-> OccName | Derived `Occname`, e.g. `$p3Ord`

mkTag2ConOcc :: OccName -> OccName Source #

mkTcOcc :: String -> OccName Source #

mkTcOccFS :: FastString -> OccName Source #

mkTyConRepOcc :: OccName -> OccName Source #

mkTyVarOcc :: String -> OccName Source #

mkTyVarOccFS :: FastString -> OccName Source #

mkVarOcc :: String -> OccName Source #

mkWorkerOcc :: OccName -> OccName Source #

nameSpacesRelated :: NameSpace -> NameSpace -> Bool Source #

occEnvElts :: OccEnv a -> [a] Source #

parenSymOcc :: OccName -> SDoc -> SDoc Source #

Wrap parens around an operator

plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a Source #

plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a Source #

pprNameSpace :: NameSpace -> SDoc Source #

pprNameSpaceBrief :: NameSpace -> SDoc Source #

pprNonVarNameSpace :: NameSpace -> SDoc Source #

pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc Source #

pprOccName :: OccName -> SDoc Source #

promoteOccName :: OccName -> Maybe OccName Source #

setOccNameSpace :: NameSpace -> OccName -> OccName Source #

srcDataName :: NameSpace Source #

startsWithUnderscore :: OccName -> Bool Source #

Haskell 98 encourages compilers to suppress warnings about unused names in a pattern if they start with `_`: this implements that test

tcClsName :: NameSpace Source #

tcName :: NameSpace Source #

tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName) Source #

tvName :: NameSpace Source #

unionManyOccSets :: [OccSet] -> OccSet Source #

unionOccSets :: OccSet -> OccSet -> OccSet Source #

unitOccEnv :: OccName -> a -> OccEnv a Source #

unitOccSet :: OccName -> OccSet Source #

data NameSpace Source #

#### Instances

Instances details

Binary NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods put_ :: BinHandle -> NameSpace -> IO () Source # put :: BinHandle -> NameSpace -> IO (Bin NameSpace) Source # get :: BinHandle -> IO NameSpace Source #
Eq NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods (==) :: NameSpace -> NameSpace -> Bool # (/=) :: NameSpace -> NameSpace -> Bool #
Ord NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods compare :: NameSpace -> NameSpace -> Ordering # (<) :: NameSpace -> NameSpace -> Bool # (<=) :: NameSpace -> NameSpace -> Bool # (>) :: NameSpace -> NameSpace -> Bool # (>=) :: NameSpace -> NameSpace -> Bool # max :: NameSpace -> NameSpace -> NameSpace # min :: NameSpace -> NameSpace -> NameSpace #

data OccEnv a Source #

#### Instances

Instances details

Data a => Data (OccEnv a) Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OccEnv a -> c (OccEnv a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (OccEnv a) Source # toConstr :: OccEnv a -> Constr Source # dataTypeOf :: OccEnv a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (OccEnv a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OccEnv a)) Source # gmapT :: (forall b. Data b => b -> b) -> OccEnv a -> OccEnv a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccEnv a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccEnv a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> OccEnv a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> OccEnv a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccEnv a -> m (OccEnv a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccEnv a -> m (OccEnv a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccEnv a -> m (OccEnv a) Source #
Outputable a => Outputable (OccEnv a) Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods ppr :: OccEnv a -> SDoc Source #

type OccSet = UniqSet OccName Source #

type TidyOccEnv = UniqFM FastString Int Source #

mkRecFldSelOcc :: String -> OccName Source #

mkVarOccFS :: FastString -> OccName Source #

occNameString :: OccName -> String Source #

class HasOccName name where Source #

Other names in the compiler add additional information to an OccName. This class provides a consistent way to access the underlying OccName.

Methods

occName :: name -> OccName Source #

#### Instances

Instances details

HasOccName IfaceClassOp Source # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceClassOp -> OccName Source #
HasOccName IfaceConDecl Source # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceConDecl -> OccName Source #
HasOccName IfaceDecl Source # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceDecl -> OccName Source #
HasOccName HoleFitCandidate Source # |
Instance details Defined in GHC.Tc.Errors.Hole.FitTypes Methods occName :: HoleFitCandidate -> OccName Source #
HasOccName TcBinder Source # |
Instance details Defined in GHC.Tc.Types Methods occName :: TcBinder -> OccName Source #
HasOccName GreName Source # |
Instance details Defined in GHC.Types.Avail Methods occName :: GreName -> OccName Source #
HasOccName FieldLabel Source # |
Instance details Defined in GHC.Types.FieldLabel Methods occName :: FieldLabel -> OccName Source #
HasOccName Name Source # |
Instance details Defined in GHC.Types.Name Methods occName :: Name -> OccName Source #
HasOccName OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods occName :: OccName -> OccName Source #
HasOccName GlobalRdrElt Source # |
Instance details Defined in GHC.Types.Name.Reader Methods occName :: GlobalRdrElt -> OccName Source #
HasOccName RdrName Source # |
Instance details Defined in GHC.Types.Name.Reader Methods occName :: RdrName -> OccName Source #
HasOccName Var Source # |
Instance details Defined in GHC.Types.Var Methods occName :: Var -> OccName Source #
HasOccName name => HasOccName (IEWrappedName name) Source # |
Instance details Defined in GHC.Hs.ImpExp Methods occName :: IEWrappedName name -> OccName Source #

data OccName Source #

Occurrence Name

In this context that means: "classified (i.e. as a type name, value name, etc) but not qualified and not yet resolved"

#### Instances

Instances details

Data OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OccName -> c OccName Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OccName Source # toConstr :: OccName -> Constr Source # dataTypeOf :: OccName -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OccName) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OccName) Source # gmapT :: (forall b. Data b => b -> b) -> OccName -> OccName Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r Source # gmapQ :: (forall d. Data d => d -> u) -> OccName -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> OccName -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source #
NFData OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: OccName -> () Source #
HasOccName OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods occName :: OccName -> OccName Source #
Uniquable OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: OccName -> Unique Source #
Binary OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods put_ :: BinHandle -> OccName -> IO () Source # put :: BinHandle -> OccName -> IO (Bin OccName) Source # get :: BinHandle -> IO OccName Source #
Outputable OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods ppr :: OccName -> SDoc Source #
OutputableBndr OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods pprBndr :: BindingSite -> OccName -> SDoc Source # pprPrefixOcc :: OccName -> SDoc Source # pprInfixOcc :: OccName -> SDoc Source # bndrIsJoin_maybe :: OccName -> Maybe Int Source #
Eq OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods (==) :: OccName -> OccName -> Bool # (/=) :: OccName -> OccName -> Bool #
Ord OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods compare :: OccName -> OccName -> Ordering # (<) :: OccName -> OccName -> Bool # (<=) :: OccName -> OccName -> Bool # (>) :: OccName -> OccName -> Bool # (>=) :: OccName -> OccName -> Bool # max :: OccName -> OccName -> OccName # min :: OccName -> OccName -> OccName #

emptyFsEnv :: FastStringEnv a Source #

extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a Source #

lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a Source #

mkFsEnv :: [(FastString, a)] -> FastStringEnv a Source #

type FastStringEnv a = UniqFM FastString a Source #

A non-deterministic set of FastStrings. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why it's not deterministic and why it matters. Use DFastStringEnv if the set eventually gets converted into a list or folded over in a way where the order changes the generated code.

nameOccName :: Name -> OccName Source #

nameUnique :: Name -> Unique Source #

setNameUnique :: Name -> Unique -> Name Source #

tidyNameOcc :: Name -> OccName -> Name Source #

data Name Source #

A unique, unambiguous name for something, containing information about where that thing originated.

#### Instances

Instances details

Data Name Source # |
Instance details Defined in GHC.Types.Name Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name Source # toConstr :: Name -> Constr Source # dataTypeOf :: Name -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) Source # gmapT :: (forall b. Data b => b -> b) -> Name -> Name Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Name -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Name -> m Name Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name Source #
NFData Name Source # |
Instance details Defined in GHC.Types.Name Methods rnf :: Name -> () Source #
NamedThing Name Source # |
Instance details Defined in GHC.Types.Name Methods getOccName :: Name -> OccName Source # getName :: Name -> Name Source #
HasOccName Name Source # |
Instance details Defined in GHC.Types.Name Methods occName :: Name -> OccName Source #
Uniquable Name Source # |
Instance details Defined in GHC.Types.Name Methods getUnique :: Name -> Unique Source #
Binary Name Source # | Assumes that the `Name` is a non-binding one. See `putIfaceTopBndr` and `getIfaceTopBndr` for serializing binding `Name`s. See `UserData` for the rationale for this distinction.
Instance details Defined in GHC.Types.Name Methods put_ :: BinHandle -> Name -> IO () Source # put :: BinHandle -> Name -> IO (Bin Name) Source # get :: BinHandle -> IO Name Source #
Outputable Name Source # |
Instance details Defined in GHC.Types.Name Methods ppr :: Name -> SDoc Source #
OutputableBndr Name Source # |
Instance details Defined in GHC.Types.Name Methods pprBndr :: BindingSite -> Name -> SDoc Source # pprPrefixOcc :: Name -> SDoc Source # pprInfixOcc :: Name -> SDoc Source # bndrIsJoin_maybe :: Name -> Maybe Int Source #
Eq Name Source # | The same comments as for `Name`'s `Ord` instance apply.
Instance details Defined in GHC.Types.Name Methods (==) :: Name -> Name -> Bool # (/=) :: Name -> Name -> Bool #
Ord Name Source # | Caution: This instance is implemented via `nonDetCmpUnique`, which means that the ordering is not stable across deserialization or rebuilds. See `nonDetCmpUnique` for further information, and trac #15240 for a bug caused by improper use of this instance.
Instance details Defined in GHC.Types.Name Methods compare :: Name -> Name -> Ordering # (<) :: Name -> Name -> Bool # (<=) :: Name -> Name -> Bool # (>) :: Name -> Name -> Bool # (>=) :: Name -> Name -> Bool # max :: Name -> Name -> Name # min :: Name -> Name -> Name #
type Anno Name Source # |
Instance details Defined in GHC.Hs.Extension type Anno Name = SrcSpanAnnN
type Anno (LocatedN Name) Source # |
Instance details Defined in GHC.Hs.Binds type Anno (LocatedN Name) = SrcSpan
type Anno [LocatedN Name] Source # |
Instance details Defined in GHC.Hs.Binds type Anno [LocatedN Name] = SrcSpan

class NamedThing a where Source #

A class allowing convenient access to the `Name` of various datatypes

Minimal complete definition

getName

Methods

getOccName :: a -> OccName Source #

getName :: a -> Name Source #

#### Instances

Instances details

NamedThing Class Source # |
Instance details Defined in GHC.Core.Class Methods getOccName :: Class -> OccName Source # getName :: Class -> Name Source #
NamedThing ConLike Source # |
Instance details Defined in GHC.Core.ConLike Methods getOccName :: ConLike -> OccName Source # getName :: ConLike -> Name Source #
NamedThing DataCon Source # |
Instance details Defined in GHC.Core.DataCon Methods getOccName :: DataCon -> OccName Source # getName :: DataCon -> Name Source #
NamedThing FamInst Source # |
Instance details Defined in GHC.Core.FamInstEnv Methods getOccName :: FamInst -> OccName Source # getName :: FamInst -> Name Source #
NamedThing ClsInst Source # |
Instance details Defined in GHC.Core.InstEnv Methods getOccName :: ClsInst -> OccName Source # getName :: ClsInst -> Name Source #
NamedThing PatSyn Source # |
Instance details Defined in GHC.Core.PatSyn Methods getOccName :: PatSyn -> OccName Source # getName :: PatSyn -> Name Source #
NamedThing TyCon Source # |
Instance details Defined in GHC.Core.TyCon Methods getOccName :: TyCon -> OccName Source # getName :: TyCon -> Name Source #
NamedThing IfaceClassOp Source # |
Instance details Defined in GHC.Iface.Syntax Methods getOccName :: IfaceClassOp -> OccName Source # getName :: IfaceClassOp -> Name Source #
NamedThing IfaceConDecl Source # |
Instance details Defined in GHC.Iface.Syntax Methods getOccName :: IfaceConDecl -> OccName Source # getName :: IfaceConDecl -> Name Source #
NamedThing IfaceDecl Source # |
Instance details Defined in GHC.Iface.Syntax Methods getOccName :: IfaceDecl -> OccName Source # getName :: IfaceDecl -> Name Source #
NamedThing HoleFitCandidate Source # |
Instance details Defined in GHC.Tc.Errors.Hole.FitTypes Methods getOccName :: HoleFitCandidate -> OccName Source # getName :: HoleFitCandidate -> Name Source #
NamedThing Name Source # |
Instance details Defined in GHC.Types.Name Methods getOccName :: Name -> OccName Source # getName :: Name -> Name Source #
NamedThing TyThing Source # |
Instance details Defined in GHC.Types.TyThing Methods getOccName :: TyThing -> OccName Source # getName :: TyThing -> Name Source #
NamedThing Var Source # |
Instance details Defined in GHC.Types.Var Methods getOccName :: Var -> OccName Source # getName :: Var -> Name Source #
NamedThing (CoAxiom br) Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getOccName :: CoAxiom br -> OccName Source # getName :: CoAxiom br -> Name Source #
NamedThing e => NamedThing (Located e) Source # |
Instance details Defined in GHC.Types.Name Methods getOccName :: Located e -> OccName Source # getName :: Located e -> Name Source #
NamedThing (Located a) => NamedThing (LocatedAn an a) Source # |
Instance details Defined in GHC.Parser.Annotation Methods getOccName :: LocatedAn an a -> OccName Source # getName :: LocatedAn an a -> Name Source #
NamedThing tv => NamedThing (VarBndr tv flag) Source # |
Instance details Defined in GHC.Types.Var Methods getOccName :: VarBndr tv flag -> OccName Source # getName :: VarBndr tv flag -> Name Source #
NamedThing (HsTyVarBndr flag GhcRn) Source # |
Instance details Defined in GHC.Hs.Type Methods getOccName :: HsTyVarBndr flag GhcRn -> OccName Source # getName :: HsTyVarBndr flag GhcRn -> Name Source #

alterOccEnv :: (Maybe elt -> Maybe elt) -> OccEnv elt -> OccName -> OccEnv elt Source #

avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv Source #

clsName :: NameSpace Source #

dataName :: NameSpace Source #

delFromOccEnv :: OccEnv a -> OccName -> OccEnv a Source #

delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a Source #

delTidyOccEnvList :: TidyOccEnv -> [FastString] -> TidyOccEnv Source #

demoteOccName :: OccName -> Maybe OccName Source #

elemOccEnv :: OccName -> OccEnv a -> Bool Source #

elemOccSet :: OccName -> OccSet -> Bool Source #

emptyOccEnv :: OccEnv a Source #

emptyOccSet :: OccSet Source #

emptyTidyOccEnv :: TidyOccEnv Source #

extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a Source #

extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a Source #

extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b Source #

extendOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv a Source #

extendOccSet :: OccSet -> OccName -> OccSet Source #

extendOccSetList :: OccSet -> [OccName] -> OccSet Source #

filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt Source #

filterOccSet :: (OccName -> Bool) -> OccSet -> OccSet Source #

foldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b Source #

initTidyOccEnv :: [OccName] -> TidyOccEnv Source #

intersectOccSet :: OccSet -> OccSet -> OccSet Source #

isDataConNameSpace :: NameSpace -> Bool Source #

isDataOcc :: OccName -> Bool Source #

isDataSymOcc :: OccName -> Bool Source #

Test if the `OccName` is a data constructor that starts with a symbol (e.g. `:`, or `[]`)

isDefaultMethodOcc :: OccName -> Bool Source #

isDerivedOccName :: OccName -> Bool Source #

Test for definitions internally generated by GHC. This predicate is used to suppress printing of internal definitions in some debug prints

isEmptyOccSet :: OccSet -> Bool Source #

isSymOcc :: OccName -> Bool Source #

Test if the `OccName` is that for any operator (whether it is a data constructor or variable or whatever)

isTcClsNameSpace :: NameSpace -> Bool Source #

isTcOcc :: OccName -> Bool Source #

isTvNameSpace :: NameSpace -> Bool Source #

isTvOcc :: OccName -> Bool Source #

isTypeableBindOcc :: OccName -> Bool Source #

Is an `OccName` one of a Typeable `TyCon` or `Module` binding? This is needed as these bindings are renamed differently. See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.

isValNameSpace :: NameSpace -> Bool Source #

isValOcc :: OccName -> Bool Source #

Value `OccNames`s are those that are either in the variable or data constructor namespaces

isVarNameSpace :: NameSpace -> Bool Source #

isVarOcc :: OccName -> Bool Source #

lookupOccEnv :: OccEnv a -> OccName -> Maybe a Source #

mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b Source #

minusOccSet :: OccSet -> OccSet -> OccSet Source #

mkBuilderOcc :: OccName -> OccName Source #

mkClassDataConOcc :: OccName -> OccName Source #

mkClassOpAuxOcc :: OccName -> OccName Source #

mkClsOcc :: String -> OccName Source #

mkClsOccFS :: FastString -> OccName Source #

mkCon2TagOcc :: OccName -> OccName Source #

mkDFunOcc Source #

Arguments

:: String | Typically the class and type glommed together e.g. `OrdMaybe`. Only used in debug mode, for extra clarity
-> Bool | Is this a hs-boot instance DFun?
-> OccSet | avoid these Occs
-> OccName | E.g. `$f3OrdMaybe`

mkDataCOcc :: OccName -> OccName Source #

mkDataConWorkerOcc :: OccName -> OccName Source #

mkDataConWrapperOcc :: OccName -> OccName Source #

mkDataOcc :: String -> OccName Source #

mkDataOccFS :: FastString -> OccName Source #

mkDataTOcc :: OccName -> OccName Source #

mkDefaultMethodOcc :: OccName -> OccName Source #

mkDictOcc :: OccName -> OccName Source #

mkEqPredCoOcc :: OccName -> OccName Source #

mkForeignExportOcc :: OccName -> OccName Source #

mkGen1R :: OccName -> OccName Source #

mkGenR :: OccName -> OccName Source #

mkIPOcc :: OccName -> OccName Source #

mkInstTyCoOcc :: OccName -> OccName Source #

mkInstTyTcOcc Source #

Arguments

:: String | Family name, e.g. `Map`
-> OccSet | avoid these Occs
-> OccName |
    R:Map

Derive a name for the representation type constructor of a `data`/`newtype` instance.

mkLocalOcc Source #

Arguments

:: Unique | Unique to combine with the `OccName`
-> OccName | Local name, e.g. `sat`
-> OccName | Nice unique version, e.g. `$L23sat`

mkMatcherOcc :: OccName -> OccName Source #

mkMaxTagOcc :: OccName -> OccName Source #

mkMethodOcc :: OccName -> OccName Source #

mkNewTyCoOcc :: OccName -> OccName Source #

mkOccEnv :: [(OccName, a)] -> OccEnv a Source #

mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a Source #

mkOccName :: NameSpace -> String -> OccName Source #

mkOccNameFS :: NameSpace -> FastString -> OccName Source #

mkOccSet :: [OccName] -> OccSet Source #

mkRepEqOcc :: OccName -> OccName Source #

mkSpecOcc :: OccName -> OccName Source #

mkSuperDictAuxOcc :: Int -> OccName -> OccName Source #

mkSuperDictSelOcc Source #

Arguments

:: Int | Index of superclass, e.g. 3
-> OccName | Class, e.g. `Ord`
-> OccName | Derived `Occname`, e.g. `$p3Ord`

mkTag2ConOcc :: OccName -> OccName Source #

mkTcOcc :: String -> OccName Source #

mkTcOccFS :: FastString -> OccName Source #

mkTyConRepOcc :: OccName -> OccName Source #

mkTyVarOcc :: String -> OccName Source #

mkTyVarOccFS :: FastString -> OccName Source #

mkVarOcc :: String -> OccName Source #

mkWorkerOcc :: OccName -> OccName Source #

nameSpacesRelated :: NameSpace -> NameSpace -> Bool Source #

occEnvElts :: OccEnv a -> [a] Source #

parenSymOcc :: OccName -> SDoc -> SDoc Source #

Wrap parens around an operator

plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a Source #

plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a Source #

pprNameSpace :: NameSpace -> SDoc Source #

pprNameSpaceBrief :: NameSpace -> SDoc Source #

pprNonVarNameSpace :: NameSpace -> SDoc Source #

pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc Source #

pprOccName :: OccName -> SDoc Source #

promoteOccName :: OccName -> Maybe OccName Source #

setOccNameSpace :: NameSpace -> OccName -> OccName Source #

srcDataName :: NameSpace Source #

startsWithUnderscore :: OccName -> Bool Source #

Haskell 98 encourages compilers to suppress warnings about unused names in a pattern if they start with `_`: this implements that test

tcClsName :: NameSpace Source #

tcName :: NameSpace Source #

tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName) Source #

tvName :: NameSpace Source #

unionManyOccSets :: [OccSet] -> OccSet Source #

unionOccSets :: OccSet -> OccSet -> OccSet Source #

unitOccEnv :: OccName -> a -> OccEnv a Source #

unitOccSet :: OccName -> OccSet Source #

data NameSpace Source #

#### Instances

Instances details

Binary NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods put_ :: BinHandle -> NameSpace -> IO () Source # put :: BinHandle -> NameSpace -> IO (Bin NameSpace) Source # get :: BinHandle -> IO NameSpace Source #
Eq NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods (==) :: NameSpace -> NameSpace -> Bool # (/=) :: NameSpace -> NameSpace -> Bool #
Ord NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods compare :: NameSpace -> NameSpace -> Ordering # (<) :: NameSpace -> NameSpace -> Bool # (<=) :: NameSpace -> NameSpace -> Bool # (>) :: NameSpace -> NameSpace -> Bool # (>=) :: NameSpace -> NameSpace -> Bool # max :: NameSpace -> NameSpace -> NameSpace # min :: NameSpace -> NameSpace -> NameSpace #

data OccEnv a Source #

#### Instances

Instances details

Data a => Data (OccEnv a) Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OccEnv a -> c (OccEnv a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (OccEnv a) Source # toConstr :: OccEnv a -> Constr Source # dataTypeOf :: OccEnv a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (OccEnv a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OccEnv a)) Source # gmapT :: (forall b. Data b => b -> b) -> OccEnv a -> OccEnv a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccEnv a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccEnv a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> OccEnv a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> OccEnv a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccEnv a -> m (OccEnv a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccEnv a -> m (OccEnv a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccEnv a -> m (OccEnv a) Source #
Outputable a => Outputable (OccEnv a) Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods ppr :: OccEnv a -> SDoc Source #

type OccSet = UniqSet OccName Source #

type TidyOccEnv = UniqFM FastString Int Source #

getOccFS :: NamedThing a => a -> FastString Source #

getOccString :: NamedThing a => a -> String Source #

getSrcLoc :: NamedThing a => a -> SrcLoc Source #

getSrcSpan :: NamedThing a => a -> SrcSpan Source #

isBuiltInSyntax :: Name -> Bool Source #

isDataConName :: Name -> Bool Source #

isDynLinkName :: Platform -> Module -> Name -> Bool Source #

Will the `Name` come from a dynamically linked package?

isExternalName :: Name -> Bool Source #

isHoleName :: Name -> Bool Source #

isInternalName :: Name -> Bool Source #

isSystemName :: Name -> Bool Source #

isTyConName :: Name -> Bool Source #

isTyVarName :: Name -> Bool Source #

isValName :: Name -> Bool Source #

isVarName :: Name -> Bool Source #

isWiredIn :: NamedThing thing => thing -> Bool Source #

isWiredInName :: Name -> Bool Source #

localiseName :: Name -> Name Source #

Make the `Name` into an internal name, regardless of what it was to begin with

mkClonedInternalName :: Unique -> Name -> Name Source #

mkDerivedInternalName :: (OccName -> OccName) -> Unique -> Name -> Name Source #

mkExternalName :: Unique -> Module -> OccName -> SrcSpan -> Name Source #

Create a name which definitely originates in the given module

mkFCallName :: Unique -> String -> Name Source #

Make a name for a foreign call

mkInternalName :: Unique -> OccName -> SrcSpan -> Name Source #

Create a name which is (for now at least) local to the current module and hence does not need a `Module` to disambiguate it from other `Name`s

mkSysTvName :: Unique -> FastString -> Name Source #

mkSystemName :: Unique -> OccName -> Name Source #

Create a name brought into being by the compiler

mkSystemNameAt :: Unique -> OccName -> SrcSpan -> Name Source #

mkSystemVarName :: Unique -> FastString -> Name Source #

mkWiredInName :: Module -> OccName -> Unique -> TyThing -> BuiltInSyntax -> Name Source #

Create a name which is actually defined by the compiler itself

nameIsFromExternalPackage :: HomeUnit -> Name -> Bool Source #

Returns True if the Name comes from some other package: neither this package nor the interactive package.

nameIsHomePackage :: Module -> Name -> Bool Source #

nameIsHomePackageImport :: Module -> Name -> Bool Source #

nameIsLocalOrFrom :: Module -> Name -> Bool Source #

Returns True if the name is (a) Internal (b) External but from the specified module (c) External but from the `interactive` package

The key idea is that False means: the entity is defined in some other module you can find the details (type, fixity, instances) in some interface file those details will be stored in the EPT or HPT

True means: the entity is defined in this module or earlier in the GHCi session you can find details (type, fixity, instances) in the TcGblEnv or TcLclEnv

The isInteractiveModule part is because successive interactions of a GHCi session each give rise to a fresh module (Ghci1, Ghci2, etc), but they all come from the magic `interactive` package; and all the details are kept in the TcLclEnv, TcGblEnv, NOT in the HPT or EPT. See Note [The interactive package] in GHC.Runtime.Context

nameModule :: HasDebugCallStack => Name -> Module Source #

nameModule_maybe :: Name -> Maybe Module Source #

nameNameSpace :: Name -> NameSpace Source #

nameSrcLoc :: Name -> SrcLoc Source #

nameSrcSpan :: Name -> SrcSpan Source #

nameStableString :: Name -> String Source #

Get a string representation of a `Name` that's unique and stable across recompilations. Used for deterministic generation of binds for derived instances. eg. "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal$String"

pprDefinedAt :: Name -> SDoc Source #

pprInfixName :: (Outputable a, NamedThing a) => a -> SDoc Source #

pprModulePrefix :: PprStyle -> Module -> OccName -> SDoc Source #

pprNameDefnLoc :: Name -> SDoc Source #

pprNameUnqualified :: Name -> SDoc Source #

Print the string of Name unqualifiedly directly.

pprPrefixName :: NamedThing a => a -> SDoc Source #

setNameLoc :: Name -> SrcSpan -> Name Source #

stableNameCmp :: Name -> Name -> Ordering Source #

Compare Names lexicographically This only works for Names that originate in the source code or have been tidied.

wiredInNameTyThing_maybe :: Name -> Maybe TyThing Source #

data BuiltInSyntax Source #

BuiltInSyntax is for things like `(:)`, `[]` and tuples, which have special syntactic forms. They aren't in scope as such.

Constructors

BuiltInSyntax |
UserSyntax |

module GHC.Types.Var

type Id = Var Source #

Identifier

data Var Source #

Variable

Essentially a typed `Name`, that may also contain some additional information about the `Var` and its use sites.

#### Instances

Instances details

Data Var Source # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var Source # toConstr :: Var -> Constr Source # dataTypeOf :: Var -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) Source # gmapT :: (forall b. Data b => b -> b) -> Var -> Var Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #
NamedThing Var Source # |
Instance details Defined in GHC.Types.Var Methods getOccName :: Var -> OccName Source # getName :: Var -> Name Source #
HasOccName Var Source # |
Instance details Defined in GHC.Types.Var Methods occName :: Var -> OccName Source #
Uniquable Var Source # |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique Source #
Outputable Var Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: Var -> SDoc Source #
OutputableBndr Var Source # |
Instance details Defined in GHC.Core.Ppr Methods pprBndr :: BindingSite -> Var -> SDoc Source # pprPrefixOcc :: Var -> SDoc Source # pprInfixOcc :: Var -> SDoc Source # bndrIsJoin_maybe :: Var -> Maybe Int Source #
Eq Var Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: Var -> Var -> Bool # (/=) :: Var -> Var -> Bool #
Ord Var Source # |
Instance details Defined in GHC.Types.Var Methods compare :: Var -> Var -> Ordering # (<) :: Var -> Var -> Bool # (<=) :: Var -> Var -> Bool # (>) :: Var -> Var -> Bool # (>=) :: Var -> Var -> Bool # max :: Var -> Var -> Var # min :: Var -> Var -> Var #
Eq (DeBruijn CoreAlt) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool # (/=) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool #
Eq (DeBruijn CoreExpr) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool # (/=) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool #
type Anno Id Source # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN
type Anno (LocatedN Id) Source # |
Instance details Defined in GHC.Hs.Binds type Anno (LocatedN Id) = SrcSpan
type Anno [LocatedN Id] Source # |
Instance details Defined in GHC.Hs.Binds type Anno [LocatedN Id] = SrcSpan

idName :: Id -> Name Source #

globaliseId :: Id -> Id Source #

If it's a local, make it global

idDetails :: Id -> IdDetails Source #

idInfo :: HasDebugCallStack => Id -> IdInfo Source #

isExportedId :: Var -> Bool Source #

`isExportedIdVar` means "don't throw this away"

isGlobalId :: Var -> Bool Source #

isId :: Var -> Bool Source #

Is this a value-level (i.e., computationally relevant) `Var`entifier? Satisfies `isId = not . isTyVar`.

isLocalId :: Var -> Bool Source #

setIdMult :: Id -> Mult -> Id Source #

updateIdTypeAndMult :: (Type -> Type) -> Id -> Id Source #

updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m Id Source #

updateIdTypeButNotMult :: (Type -> Type) -> Id -> Id Source #

type InId = Id Source #

type InVar = Var Source #

type JoinId = Id Source #

type OutId = Id Source #

type OutVar = Var Source #

asJoinId :: Id -> JoinArity -> JoinId infixl 1 Source #

asJoinId_maybe :: Id -> Maybe JoinArity -> Id infixl 1 Source #

clearOneShotLambda :: Id -> Id Source #

hasNoBinding :: Id -> Bool Source #

Returns `True` of an `Id` which may not have a binding, even though it is defined in this module.

idArity :: Id -> Arity Source #

idCafInfo :: Id -> CafInfo infixl 1 Source #

idCallArity :: Id -> Arity Source #

idCoreRules :: Id -> [CoreRule] Source #

idCprInfo :: Id -> CprSig Source #

idDataCon :: Id -> DataCon Source #

Get from either the worker or the wrapper `Id` to the `DataCon`. Currently used only in the desugarer.

INVARIANT: `idDataCon (dataConWrapId d) = d`: remember, `dataConWrapId` can return either the wrapper or the worker

idDemandInfo :: Id -> Demand Source #

idFunRepArity :: Id -> RepArity Source #

idHasRules :: Id -> Bool Source #

idInlineActivation :: Id -> Activation Source #

idInlinePragma :: Id -> InlinePragma Source #

idIsFrom :: Module -> Id -> Bool Source #

idJoinArity :: JoinId -> JoinArity Source #

idLFInfo_maybe :: Id -> Maybe LambdaFormInfo Source #

idMult :: Id -> Mult Source #

idOccInfo :: Id -> OccInfo Source #

idOneShotInfo :: Id -> OneShotInfo Source #

idRuleMatchInfo :: Id -> RuleMatchInfo Source #

idScaledType :: Id -> Scaled Type Source #

idSpecialisation :: Id -> RuleInfo Source #

idStateHackOneShotInfo :: Id -> OneShotInfo Source #

Like `idOneShotInfo`, but taking the Horrible State Hack in to account See Note [The state-transformer hack] in GHC.Core.Opt.Arity

idStrictness :: Id -> StrictSig Source #

Accesses the `Id'`s `strictnessInfo`.

idType :: Id -> Kind Source #

idUnfolding :: Id -> Unfolding Source #

idUnique :: Id -> Unique Source #

isClassOpId_maybe :: Id -> Maybe Class Source #

isConLikeId :: Id -> Bool Source #

isDFunId :: Id -> Bool Source #

isDataConId_maybe :: Id -> Maybe DataCon Source #

isDataConRecordSelector :: Id -> Bool Source #

isDataConWorkId :: Id -> Bool Source #

isDataConWorkId_maybe :: Id -> Maybe DataCon Source #

isDataConWrapId :: Id -> Bool Source #

isDataConWrapId_maybe :: Id -> Maybe DataCon Source #

isDeadBinder :: Id -> Bool Source #

isDeadEndId :: Var -> Bool Source #

Returns true if an application to n args diverges or throws an exception See Note [Dead ends] in GHC.Types.Demand.

isFCallId :: Id -> Bool Source #

isFCallId_maybe :: Id -> Maybe ForeignCall Source #

isImplicitId :: Id -> Bool Source #

`isImplicitId` tells whether an `Id`s info is implied by other declarations, so we don't need to put its signature in an interface file, even if it's mentioned in some other interface unfolding.

isJoinId :: Var -> Bool Source #

isJoinId_maybe :: Var -> Maybe JoinArity Source #

isNaughtyRecordSelector :: Id -> Bool Source #

isNeverLevPolyId :: Id -> Bool Source #

isOneShotBndr :: Var -> Bool Source #

Returns whether the lambda associated with the `Id` is certainly applied at most once This one is the "business end", called externally. It works on type variables as well as Ids, returning True Its main purpose is to encapsulate the Horrible State Hack See Note [The state-transformer hack] in GHC.Core.Opt.Arity

isPatSynRecordSelector :: Id -> Bool Source #

isPrimOpId :: Id -> Bool Source #

isPrimOpId_maybe :: Id -> Maybe PrimOp Source #

isProbablyOneShotLambda :: Id -> Bool Source #

isRecordSelector :: Id -> Bool Source #

isStateHackType :: Type -> Bool Source #

isStrictId :: Id -> Bool Source #

This predicate says whether the `Id` has a strict demand placed on it or has a type such that it can always be evaluated strictly (i.e an unlifted type, as of GHC 7.6). We need to check separately whether the `Id` has a so-called "strict type" because if the demand for the given `id` hasn't been computed yet but `id` has a strict type, we still want `isStrictId id` to be `True`.

localiseId :: Id -> Id Source #

maybeModifyIdInfo :: Maybe IdInfo -> Id -> Id Source #

mkExportedLocalId :: IdDetails -> Name -> Type -> Id Source #

Create a local `Id` that is marked as exported. This prevents things attached to it from being removed as dead code. See Note [Exported LocalIds]

mkExportedVanillaId :: Name -> Type -> Id Source #

mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id Source #

For an explanation of global vs. local `Id`s, see GHC.Types.Var.Var

mkLocalCoVar :: Name -> Type -> CoVar Source #

Make a local CoVar

mkLocalId :: HasDebugCallStack => Name -> Mult -> Type -> Id Source #

For an explanation of global vs. local `Id`s, see GHC.Types.Var

mkLocalIdOrCoVar :: Name -> Mult -> Type -> Id Source #

Like `mkLocalId`, but checks the type to see if it should make a covar

mkLocalIdWithInfo :: HasDebugCallStack => Name -> Mult -> Type -> IdInfo -> Id Source #

mkScaledTemplateLocal :: Int -> Scaled Type -> Id Source #

mkSysLocal :: FastString -> Unique -> Mult -> Type -> Id Source #

Create a system local `Id`. These are local `Id`s (see Var) that are created by the compiler out of thin air

mkSysLocalM :: MonadUnique m => FastString -> Mult -> Type -> m Id Source #

mkSysLocalOrCoVar :: FastString -> Unique -> Mult -> Type -> Id Source #

Like `mkSysLocal`, but checks to see if we have a covar type

mkSysLocalOrCoVarM :: MonadUnique m => FastString -> Mult -> Type -> m Id Source #

mkTemplateLocal :: Int -> Type -> Id Source #

Create a template local: a family of system local `Id`s in bijection with `Int`s, typically used in unfoldings

mkTemplateLocals :: [Type] -> [Id] Source #

Create a template local for a series of types

mkTemplateLocalsNum :: Int -> [Type] -> [Id] Source #

Create a template local for a series of type, but start from a specified template local

mkUserLocal :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id Source #

Create a user local `Id`. These are local `Id`s (see GHC.Types.Var) with a name and location that the user might recognize

mkUserLocalOrCoVar :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id Source #

Like `mkUserLocal`, but checks if we have a coercion type

mkVanillaGlobal :: Name -> Type -> Id Source #

Make a global `Id` without any extra information at all

mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id Source #

Make a global `Id` with no global information but some generic `IdInfo`

mkWorkerId :: Unique -> Id -> Type -> Id Source #

Workers get local names. CoreTidy will externalise these if necessary

modifyIdInfo :: HasDebugCallStack => (IdInfo -> IdInfo) -> Id -> Id Source #

modifyInlinePragma :: Id -> (InlinePragma -> InlinePragma) -> Id Source #

realIdUnfolding :: Id -> Unfolding Source #

recordSelectorTyCon :: Id -> RecSelParent Source #

If the `Id` is that for a record selector, extract the `sel_tycon`. Panic otherwise.

recordSelectorTyCon_maybe :: Id -> Maybe RecSelParent Source #

scaleIdBy :: Mult -> Id -> Id Source #

scaleVarBy :: Mult -> Var -> Var Source #

Like `scaleIdBy`, but skips non-Ids. Useful for scaling a mixed list of ids and tyvars.

setCaseBndrEvald :: StrictnessMark -> Id -> Id Source #

setIdArity :: Id -> Arity -> Id infixl 1 Source #

setIdCafInfo :: Id -> CafInfo -> Id Source #

setIdCallArity :: Id -> Arity -> Id infixl 1 Source #

setIdCprInfo :: Id -> CprSig -> Id infixl 1 Source #

setIdDemandInfo :: Id -> Demand -> Id infixl 1 Source #

setIdInfo :: Id -> IdInfo -> Id Source #

setIdLFInfo :: Id -> LambdaFormInfo -> Id Source #

setIdName :: Id -> Name -> Id Source #

setIdOccInfo :: Id -> OccInfo -> Id infixl 1 Source #

setIdOneShotInfo :: Id -> OneShotInfo -> Id infixl 1 Source #

setIdSpecialisation :: Id -> RuleInfo -> Id infixl 1 Source #

setIdStrictness :: Id -> StrictSig -> Id infixl 1 Source #

setIdType :: Id -> Type -> Id Source #

Not only does this set the `Id` `Type`, it also evaluates the type to try and reduce space usage

setIdUnfolding :: Id -> Unfolding -> Id infixl 1 Source #

setIdUnique :: Id -> Unique -> Id Source #

setInlineActivation :: Id -> Activation -> Id infixl 1 Source #

setInlinePragma :: Id -> InlinePragma -> Id infixl 1 Source #

setOneShotLambda :: Id -> Id Source #

stateHackOneShot :: OneShotInfo Source #

Should we apply the state hack to values of this `Type`?

transferPolyIdInfo :: Id -> [Var] -> Id -> Id Source #

typeOneShot :: Type -> OneShotInfo Source #

updOneShotInfo :: Id -> OneShotInfo -> Id Source #

zapFragileIdInfo :: Id -> Id Source #

zapIdDemandInfo :: Id -> Id Source #

zapIdOccInfo :: Id -> Id Source #

zapIdStrictness :: Id -> Id Source #

zapIdTailCallInfo :: Id -> Id Source #

zapIdUsageEnvInfo :: Id -> Id Source #

zapIdUsageInfo :: Id -> Id Source #

zapIdUsedOnceInfo :: Id -> Id Source #

zapJoinId :: Id -> Id Source #

zapLamIdInfo :: Id -> Id Source #

zapStableUnfolding :: Id -> Id Source #

module GHC.Types.Id.Info

module GHC.Core.Opt.Monad

module GHC.Core

module GHC.Types.Literal

module GHC.Core.DataCon

module GHC.Core.Utils

module GHC.Core.Make

module GHC.Core.FVs

data InScopeSet Source #

A set of variables that are in scope at some point "Secrets of the Glasgow Haskell Compiler inliner" Section 3.2 provides the motivation for this abstraction.

#### Instances

Instances details

Outputable InScopeSet Source # |
Instance details Defined in GHC.Types.Var.Env Methods ppr :: InScopeSet -> SDoc Source #

extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst Source #

type TvSubstEnv = TyVarEnv Type Source #

A substitution of `Type`s for `TyVar`s and `Kind`s for `KindVar`s

addInScopeSet :: Subst -> VarSet -> Subst Source #

Add the `Expr` to the in-scope set, but do not remove any existing substitutions for it

cloneBndr :: Subst -> Unique -> Var -> (Subst, Var) Source #

cloneBndrs :: Subst -> UniqSupply -> [Var] -> (Subst, [Var]) Source #

cloneIdBndr :: Subst -> UniqSupply -> Id -> (Subst, Id) Source #

Very similar to `substBndr`, but it always allocates a new `Unique` for each variable in its output. It substitutes the IdInfo though.

cloneIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id]) Source #

Applies `cloneIdBndr` to a number of `Id`s, accumulating a final substitution from left to right

cloneRecIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id]) Source #

Clone a mutually recursive group of `Id`s

deShadowBinds :: CoreProgram -> CoreProgram Source #

De-shadowing the program is sometimes a useful pre-pass. It can be done simply by running over the bindings with an empty substitution, because substitution returns a result that has no-shadowing guaranteed.

(Actually, within a single type there might still be shadowing, because `substTy` is a no-op for the empty substitution, but that's probably OK.)

Aug 09
  This function is not used in GHC at the moment, but seems so short and simple that I'm going to leave it here

delBndr :: Subst -> Var -> Subst Source #

delBndrs :: Subst -> [Var] -> Subst Source #

emptySubst :: Subst Source #

extendIdSubst :: Subst -> Id -> CoreExpr -> Subst Source #

Add a substitution for an `Id` to the `Subst`: you must ensure that the in-scope set is such that TyCoSubst Note [The substitution invariant] holds after extending the substitution like this

extendIdSubstList :: Subst -> [(Id, CoreExpr)] -> Subst Source #

Adds multiple `Id` substitutions to the `Subst`: see also `extendIdSubst`

extendInScope :: Subst -> Var -> Subst Source #

Add the `Expr` to the in-scope set: as a side effect, and remove any existing substitutions for it

extendInScopeIds :: Subst -> [Id] -> Subst Source #

Optimized version of `extendInScopeList` that can be used if you are certain all the things being added are `Id`s and hence none are `TyVar`s or `CoVar`s

extendInScopeList :: Subst -> [Var] -> Subst Source #

Add the `Expr`s to the in-scope set: see also `extendInScope`

extendSubst :: Subst -> Var -> CoreArg -> Subst Source #

Add a substitution appropriate to the thing being substituted (whether an expression, type, or coercion). See also `extendIdSubst`, `extendTvSubst`, `extendCvSubst`

extendSubstList :: Subst -> [(Var, CoreArg)] -> Subst Source #

Add a substitution as appropriate to each of the terms being substituted (whether expressions, types, or coercions). See also `extendSubst`.

extendSubstWithVar :: Subst -> Var -> Var -> Subst Source #

extendTvSubst :: Subst -> TyVar -> Type -> Subst Source #

Add a substitution for a `TyVar` to the `Subst` The `TyVar` *must* be a real TyVar, and not a CoVar You must ensure that the in-scope set is such that GHC.Core.TyCo.Subst Note [The substitution invariant] holds after extending the substitution like this.

extendTvSubstList :: Subst -> [(TyVar, Type)] -> Subst Source #

Adds multiple `TyVar` substitutions to the `Subst`: see also `extendTvSubst`

getTCvSubst :: Subst -> TCvSubst Source #

isEmptySubst :: Subst -> Bool Source #

isInScope :: Var -> Subst -> Bool Source #

lookupIdSubst :: HasDebugCallStack => Subst -> Id -> CoreExpr Source #

Find the substitution for an `Id` in the `Subst`

lookupTCvSubst :: Subst -> TyVar -> Type Source #

Find the substitution for a `TyVar` in the `Subst`

mkEmptySubst :: InScopeSet -> Subst Source #

mkOpenSubst :: InScopeSet -> [(Var, CoreArg)] -> Subst Source #

Simultaneously substitute for a bunch of variables No left-right shadowing ie the substitution for (x y. e) a1 a2 so neither x nor y scope over a1 a2

mkSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> IdSubstEnv -> Subst Source #

setInScope :: Subst -> InScopeSet -> Subst Source #

substBind :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind) Source #

Apply a substitution to an entire `CoreBind`, additionally returning an updated `Subst` that should be used by subsequent substitutions.

substBindSC :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind) Source #

Apply a substitution to an entire `CoreBind`, additionally returning an updated `Subst` that should be used by subsequent substitutions.

substBndr :: Subst -> Var -> (Subst, Var) Source #

Substitutes a `Expr` for another one according to the `Subst` given, returning the result and an updated `Subst` that should be used by subsequent substitutions. `IdInfo` is preserved by this process, although it is substituted into appropriately.

substBndrs :: Subst -> [Var] -> (Subst, [Var]) Source #

Applies `substBndr` to a number of `Expr`s, accumulating a new `Subst` left-to-right

substCo :: HasCallStack => Subst -> Coercion -> Coercion Source #

See `substCo`

substDVarSet :: Subst -> DVarSet -> DVarSet Source #

substExpr :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr Source #

substExpr applies a substitution to an entire `CoreExpr`. Remember, you may only apply the substitution once: See Note [Substitutions apply only once] in GHC.Core.TyCo.Subst

Do *not* attempt to short-cut in the case of an empty substitution! See Note [Extending the Subst]

substExprSC :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr Source #

substIdInfo :: Subst -> Id -> IdInfo -> Maybe IdInfo Source #

Substitute into some `IdInfo` with regard to the supplied new `Id`.

substIdOcc :: Subst -> Id -> Id Source #

substIdType :: Subst -> Id -> Id Source #

substInScope :: Subst -> InScopeSet Source #

Find the in-scope set: see GHC.Core.TyCo.Subst Note [The substitution invariant]

substRecBndrs :: Subst -> [Id] -> (Subst, [Id]) Source #

Substitute in a mutually recursive group of `Id`s

substRuleInfo :: Subst -> Id -> RuleInfo -> RuleInfo Source #

Substitutes for the `Id`s within the `RuleInfo` given the new function `Id`

substRulesForImportedIds :: Subst -> [CoreRule] -> [CoreRule] Source #

substTickish :: Subst -> CoreTickish -> CoreTickish Source #

substTy :: Subst -> Type -> Type Source #

See `substTy`.

substUnfolding :: Subst -> Unfolding -> Unfolding Source #

Substitutes for the `Id`s within an unfolding NB: substUnfolding discards any unfolding without without a Stable source. This is usually what we want, but it may be a bit unexpected

substUnfoldingSC :: Subst -> Unfolding -> Unfolding Source #

Substitutes for the `Id`s within an unfolding NB: substUnfolding discards any unfolding without without a Stable source. This is usually what we want, but it may be a bit unexpected

zapSubstEnv :: Subst -> Subst Source #

Remove all substitutions for `Id`s and `Expr`s that might have been built up while preserving the in-scope set

type IdSubstEnv = IdEnv CoreExpr Source #

An environment for substituting for `Id`s

data Subst Source #

A substitution environment, containing `Id`, `TyVar`, and `CoVar` substitutions.

Some invariants apply to how you use the substitution:

1. Note [The substitution invariant] in GHC.Core.TyCo.Subst
2. Note [Substitutions apply only once] in GHC.Core.TyCo.Subst

Constructors

Subst InScopeSet IdSubstEnv TvSubstEnv CvSubstEnv |

#### Instances

Instances details

Outputable Subst Source # |
Instance details Defined in GHC.Core.Subst Methods ppr :: Subst -> SDoc Source #

module GHC.Core.Rules

module GHC.Types.Annotations

module GHC.Driver.Session

module GHC.Driver.Ppr

module GHC.Unit.State

module GHC.Unit.Module

data AnonArgFlag Source #

The non-dependent version of `ArgFlag`. See Note [AnonArgFlag] Appears here partly so that it's together with its friends ArgFlag and ForallVisFlag, but also because it is used in IfaceType, rather early in the compilation chain

Constructors

VisArg | Used for `(->)`: an ordinary non-dependent arrow. The argument is visible in source code.
InvisArg | Used for `(=>)`: a non-dependent predicate arrow. The argument is invisible in source code.

#### Instances

Instances details

Data AnonArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> AnonArgFlag -> c AnonArgFlag Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c AnonArgFlag Source # toConstr :: AnonArgFlag -> Constr Source # dataTypeOf :: AnonArgFlag -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c AnonArgFlag) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c AnonArgFlag) Source # gmapT :: (forall b. Data b => b -> b) -> AnonArgFlag -> AnonArgFlag Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> AnonArgFlag -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> AnonArgFlag -> r Source # gmapQ :: (forall d. Data d => d -> u) -> AnonArgFlag -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> AnonArgFlag -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> AnonArgFlag -> m AnonArgFlag Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> AnonArgFlag -> m AnonArgFlag Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> AnonArgFlag -> m AnonArgFlag Source #
Binary AnonArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> AnonArgFlag -> IO () Source # put :: BinHandle -> AnonArgFlag -> IO (Bin AnonArgFlag) Source # get :: BinHandle -> IO AnonArgFlag Source #
Outputable AnonArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: AnonArgFlag -> SDoc Source #
Eq AnonArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: AnonArgFlag -> AnonArgFlag -> Bool # (/=) :: AnonArgFlag -> AnonArgFlag -> Bool #
Ord AnonArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods compare :: AnonArgFlag -> AnonArgFlag -> Ordering # (<) :: AnonArgFlag -> AnonArgFlag -> Bool # (<=) :: AnonArgFlag -> AnonArgFlag -> Bool # (>) :: AnonArgFlag -> AnonArgFlag -> Bool # (>=) :: AnonArgFlag -> AnonArgFlag -> Bool # max :: AnonArgFlag -> AnonArgFlag -> AnonArgFlag # min :: AnonArgFlag -> AnonArgFlag -> AnonArgFlag #

data ArgFlag Source #

Argument Flag

Is something required to appear in source Haskell (`Required`), permitted by request (`Specified`) (visible type application), or prohibited entirely from appearing in source Haskell (`Inferred`)? See Note [VarBndrs, TyCoVarBinders, TyConBinders, and visibility] in GHC.Core.TyCo.Rep

Constructors

Invisible Specificity |
Required |

Bundled Patterns

pattern Inferred :: ArgFlag |
pattern Specified :: ArgFlag |

#### Instances

Instances details

Data ArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ArgFlag -> c ArgFlag Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ArgFlag Source # toConstr :: ArgFlag -> Constr Source # dataTypeOf :: ArgFlag -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ArgFlag) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArgFlag) Source # gmapT :: (forall b. Data b => b -> b) -> ArgFlag -> ArgFlag Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ArgFlag -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ArgFlag -> r Source # gmapQ :: (forall d. Data d => d -> u) -> ArgFlag -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> ArgFlag -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag Source #
Binary ArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> ArgFlag -> IO () Source # put :: BinHandle -> ArgFlag -> IO (Bin ArgFlag) Source # get :: BinHandle -> IO ArgFlag Source #
Outputable ArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: ArgFlag -> SDoc Source #
Eq ArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: ArgFlag -> ArgFlag -> Bool # (/=) :: ArgFlag -> ArgFlag -> Bool #
Ord ArgFlag Source # |
Instance details Defined in GHC.Types.Var Methods compare :: ArgFlag -> ArgFlag -> Ordering # (<) :: ArgFlag -> ArgFlag -> Bool # (<=) :: ArgFlag -> ArgFlag -> Bool # (>) :: ArgFlag -> ArgFlag -> Bool # (>=) :: ArgFlag -> ArgFlag -> Bool # max :: ArgFlag -> ArgFlag -> ArgFlag # min :: ArgFlag -> ArgFlag -> ArgFlag #
Outputable tv => Outputable (VarBndr tv ArgFlag) Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv ArgFlag -> SDoc Source #

data Specificity Source #

Whether an `Invisible` argument may appear in source Haskell.

Constructors

InferredSpec | the argument may not appear in source Haskell, it is only inferred.
SpecifiedSpec | the argument may appear in source Haskell, but isn't required.

#### Instances

Instances details

Data Specificity Source # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Specificity -> c Specificity Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Specificity Source # toConstr :: Specificity -> Constr Source # dataTypeOf :: Specificity -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Specificity) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Specificity) Source # gmapT :: (forall b. Data b => b -> b) -> Specificity -> Specificity Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Specificity -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Specificity -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source #
Binary Specificity Source # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> Specificity -> IO () Source # put :: BinHandle -> Specificity -> IO (Bin Specificity) Source # get :: BinHandle -> IO Specificity Source #
Eq Specificity Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: Specificity -> Specificity -> Bool # (/=) :: Specificity -> Specificity -> Bool #
Ord Specificity Source # |
Instance details Defined in GHC.Types.Var Methods compare :: Specificity -> Specificity -> Ordering # (<) :: Specificity -> Specificity -> Bool # (<=) :: Specificity -> Specificity -> Bool # (>) :: Specificity -> Specificity -> Bool # (>=) :: Specificity -> Specificity -> Bool # max :: Specificity -> Specificity -> Specificity # min :: Specificity -> Specificity -> Specificity #
OutputableBndrFlag Specificity p Source # |
Instance details Defined in GHC.Hs.Type Methods pprTyVarBndr :: HsTyVarBndr Specificity (GhcPass p) -> SDoc
Outputable tv => Outputable (VarBndr tv Specificity) Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv Specificity -> SDoc Source #

type TyCoVar = Id Source #

Type or Coercion Variable

type TyVar = Var Source #

Type or kind Variable

data Var Source #

Variable

Essentially a typed `Name`, that may also contain some additional information about the `Var` and its use sites.

#### Instances

Instances details

Data Var Source # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var Source # toConstr :: Var -> Constr Source # dataTypeOf :: Var -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) Source # gmapT :: (forall b. Data b => b -> b) -> Var -> Var Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #
NamedThing Var Source # |
Instance details Defined in GHC.Types.Var Methods getOccName :: Var -> OccName Source # getName :: Var -> Name Source #
HasOccName Var Source # |
Instance details Defined in GHC.Types.Var Methods occName :: Var -> OccName Source #
Uniquable Var Source # |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique Source #
Outputable Var Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: Var -> SDoc Source #
OutputableBndr Var Source # |
Instance details Defined in GHC.Core.Ppr Methods pprBndr :: BindingSite -> Var -> SDoc Source # pprPrefixOcc :: Var -> SDoc Source # pprInfixOcc :: Var -> SDoc Source # bndrIsJoin_maybe :: Var -> Maybe Int Source #
Eq Var Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: Var -> Var -> Bool # (/=) :: Var -> Var -> Bool #
Ord Var Source # |
Instance details Defined in GHC.Types.Var Methods compare :: Var -> Var -> Ordering # (<) :: Var -> Var -> Bool # (<=) :: Var -> Var -> Bool # (>) :: Var -> Var -> Bool # (>=) :: Var -> Var -> Bool # max :: Var -> Var -> Var # min :: Var -> Var -> Var #
Eq (DeBruijn CoreAlt) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool # (/=) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool #
Eq (DeBruijn CoreExpr) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool # (/=) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool #
type Anno Id Source # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN
type Anno (LocatedN Id) Source # |
Instance details Defined in GHC.Hs.Binds type Anno (LocatedN Id) = SrcSpan
type Anno [LocatedN Id] Source # |
Instance details Defined in GHC.Hs.Binds type Anno [LocatedN Id] = SrcSpan

mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type Source #

Like `mkTyCoForAllTy`, but does not check the occurrence of the binder See Note [Unused coercion variable in ForAllTy]

type Kind = Type Source #

The key type representing kinds in the compiler.

type Mult = Type Source #

Mult is a type alias for Type.

Mult must contain Type because multiplicity variables are mere type variables (of kind Multiplicity) in Haskell. So the simplest implementation is to make Mult be Type.

Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon) - Many: GHC.Types.Many (= manyDataCon) - Multiplication: GHC.Types.MultMul (= multMulTyCon)

So that Mult feels a bit more structured, we provide pattern synonyms and smart constructors for these.

type PredType = Type Source #

A type of the form `p` of constraint kind represents a value whose type is the Haskell predicate `p`, where a predicate is what occurs before the `=>` in a Haskell type.

We use `PredType` as documentation to mark those types that we guarantee to have this kind.

It can be expanded into its representation, but:

- The type checker must treat it as opaque
- The rest of the compiler treats it as transparent

Consider these examples:

    f :: (Eq a) => a -> Int
    g :: (?x :: Int -> Int) => a -> Int
    h :: (r\l) => {r} => {l::Int | r}

Here the `Eq a` and `?x :: Int -> Int` and `rl` are all called "predicates"

data Scaled a Source #

A shorthand for data with an attached `Mult` element (the multiplicity).

#### Instances

Instances details

Data a => Data (Scaled a) Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Scaled a -> c (Scaled a) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Scaled a) Source # toConstr :: Scaled a -> Constr Source # dataTypeOf :: Scaled a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Scaled a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Scaled a)) Source # gmapT :: (forall b. Data b => b -> b) -> Scaled a -> Scaled a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Scaled a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Scaled a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Scaled a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Scaled a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Scaled a -> m (Scaled a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Scaled a -> m (Scaled a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Scaled a -> m (Scaled a) Source #
Outputable a => Outputable (Scaled a) Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods ppr :: Scaled a -> SDoc Source #

type ThetaType = [PredType] Source #

A collection of `PredType`s

data TyCoBinder Source #

A `TyCoBinder` represents an argument to a function. TyCoBinders can be dependent (`Named`) or nondependent (`Anon`). They may also be visible or not. See Note [TyCoBinders]

#### Instances

Instances details

Data TyCoBinder Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TyCoBinder -> c TyCoBinder Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TyCoBinder Source # toConstr :: TyCoBinder -> Constr Source # dataTypeOf :: TyCoBinder -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TyCoBinder) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TyCoBinder) Source # gmapT :: (forall b. Data b => b -> b) -> TyCoBinder -> TyCoBinder Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TyCoBinder -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TyCoBinder -> r Source # gmapQ :: (forall d. Data d => d -> u) -> TyCoBinder -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> TyCoBinder -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TyCoBinder -> m TyCoBinder Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCoBinder -> m TyCoBinder Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TyCoBinder -> m TyCoBinder Source #
Outputable TyCoBinder Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods ppr :: TyCoBinder -> SDoc Source #

data Type Source #

#### Instances

Instances details

Data Type Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type Source # toConstr :: Type -> Constr Source # dataTypeOf :: Type -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) Source # gmapT :: (forall b. Data b => b -> b) -> Type -> Type Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type Source #
Outputable Type Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods ppr :: Type -> SDoc Source #
Eq (DeBruijn Type) Source # |
Instance details Defined in GHC.Core.Map.Type Methods (==) :: DeBruijn Type -> DeBruijn Type -> Bool # (/=) :: DeBruijn Type -> DeBruijn Type -> Bool #

coreView :: Type -> Maybe Type Source #

This function strips off the top layer only of a type synonym application (if any) its underlying representation type. Returns `Nothing` if there is nothing to look through. This function considers `Constraint` to be a synonym of `Type`.

By being non-recursive and inlined, this case analysis gets efficiently joined onto the case analysis that the caller is already doing

isCoercionTy :: Type -> Bool Source #

isLiftedTypeKind :: Kind -> Bool Source #

This version considers Constraint to be the same as *. Returns True if the argument is equivalent to Type/Constraint and False otherwise. See Note [Kind Constraint and kind Type]

isMultiplicityTy :: Type -> Bool Source #

Is this the type `Multiplicity`?

isPredTy :: HasDebugCallStack => Type -> Bool Source #

isRuntimeRepTy :: Type -> Bool Source #

Is this the type `RuntimeRep`?

mkAppTy :: Type -> Type -> Type Source #

Applies a type to another, as in e.g. `k a`

mkCastTy :: Type -> Coercion -> Type Source #

Make a `CastTy`. The Coercion must be nominal. Checks the Coercion for reflexivity, dropping it if it's reflexive. See Note [Respecting definitional equality] in GHC.Core.TyCo.Rep

mkTyConApp :: TyCon -> [Type] -> Type Source #

A key function: builds a `TyConApp` or `FunTy` as appropriate to its arguments. Applies its arguments to the constructor from left to right.

mkTyConTy :: TyCon -> Type Source #

Create the plain type constructor type which has been applied to no type arguments at all.

partitionInvisibleTypes :: TyCon -> [Type] -> ([Type], [Type]) Source #

Given a `TyCon` and a list of argument types, partition the arguments into:

1. `Inferred` or `Specified` (i.e., invisible) arguments and
2. `Required` (i.e., visible) arguments

piResultTy :: HasDebugCallStack => Type -> Type -> Type Source #

splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) Source #

Attempts to tease a type apart into a type constructor and the application of a number of arguments to that constructor

tYPE :: Type -> Type Source #

Given a `RuntimeRep`, applies `TYPE` to it. See Note [TYPE and RuntimeRep] in GHC.Builtin.Types.Prim.

tcView :: Type -> Maybe Type Source #

Gives the typechecker view of a type. This unwraps synonyms but leaves `Constraint` alone. c.f. `coreView`, which turns `Constraint` into `Type`. Returns `Nothing` if no unwrapping happens. See also Note [coreView vs tcView]

tyConAppTyCon_maybe :: Type -> Maybe TyCon Source #

The same as `fst . splitTyConApp`

liftedTypeKind :: Kind Source #

unliftedTypeKind :: Kind Source #

unrestrictedFunTyCon :: TyCon Source #

binderArgFlag :: VarBndr tv argf -> argf Source #

binderType :: VarBndr TyCoVar argf -> Type Source #

binderVar :: VarBndr tv argf -> tv Source #

binderVars :: [VarBndr tv argf] -> [tv] Source #

isInvisibleArgFlag :: ArgFlag -> Bool Source #

Does this `ArgFlag` classify an argument that is not written in Haskell?

isTyVar :: Var -> Bool Source #

Is this a type-level (i.e., computationally irrelevant, thus erasable) variable? Satisfies `isTyVar = not . isId`.

isVisibleArgFlag :: ArgFlag -> Bool Source #

Does this `ArgFlag` classify an argument that is written in Haskell?

mkTyCoVarBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis Source #

Make a named binder

mkTyCoVarBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis] Source #

Make many named binders

mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis Source #

Make a named binder `var` should be a type variable

mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis] Source #

Make many named binders Input vars should be type variables

sameVis :: ArgFlag -> ArgFlag -> Bool Source #

Do these denote the same level of visibility? `Required` arguments are visible, others are not. So this function equates `Specified` and `Inferred`. Used for printing.

tyVarKind :: TyVar -> Kind Source #

tyVarSpecToBinders :: [VarBndr a Specificity] -> [VarBndr a ArgFlag] Source #

type TyCoVarBinder = VarBndr TyCoVar ArgFlag Source #

Variable Binder

A `TyCoVarBinder` is the binder of a ForAllTy It's convenient to define this synonym here rather its natural home in GHC.Core.TyCo.Rep, because it's used in GHC.Core.DataCon.hs-boot

A `TyVarBinder` is a binder with only TyVar

type TyVarBinder = VarBndr TyVar ArgFlag Source #

isConstraintKindCon :: TyCon -> Bool Source #

Returns `True` for the `TyCon` of the `Constraint` kind.

foldTyCo :: Monoid a => TyCoFolder env a -> env -> (Type -> a, [Type] -> a, Coercion -> a, [Coercion] -> a) Source #

isInvisibleBinder :: TyCoBinder -> Bool Source #

Does this binder bind an invisible argument?

isNamedBinder :: TyCoBinder -> Bool Source #

isVisibleBinder :: TyCoBinder -> Bool Source #

Does this binder bind a visible argument?

mkForAllTys :: [TyCoVarBinder] -> Type -> Type Source #

Wraps foralls over the type using the provided `TyCoVar`s from left to right

mkFunTy :: AnonArgFlag -> Mult -> Type -> Type -> Type infixr 3 Source #

mkInvisForAllTys :: [InvisTVBinder] -> Type -> Type Source #

Wraps foralls over the type using the provided `InvisTVBinder`s from left to right

mkInvisFunTy :: Mult -> Type -> Type -> Type infixr 3 Source #

mkInvisFunTyMany :: Type -> Type -> Type infixr 3 Source #

mkInvisFunTysMany :: [Type] -> Type -> Type Source #

mkPiTy :: TyCoBinder -> Type -> Type Source #

mkPiTys :: [TyCoBinder] -> Type -> Type Source #

mkTyVarTy :: TyVar -> Type Source #

mkTyVarTys :: [TyVar] -> [Type] Source #

mkVisFunTy :: Mult -> Type -> Type -> Type infixr 3 Source #

mkVisFunTyMany :: Type -> Type -> Type infixr 3 Source #

Special, common, case: Arrow type with mult Many

mkVisFunTys :: [Scaled Type] -> Type -> Type Source #

Make nested arrow types

mkVisFunTysMany :: [Type] -> Type -> Type Source #

typeSize :: Type -> Int Source #

type KindOrType = Type Source #

The key representation of types within the compiler

type KnotTied ty = ty Source #

A type labeled `KnotTied` might have knot-tied tycons in it. See Note [Type checking recursive type and class declarations] in GHC.Tc.TyCl

data TyCoFolder env a Source #

Constructors

TyCoFolder |
Fields tcf_view :: Type -> Maybe Type tcf_tyvar :: env -> TyVar -> a tcf_covar :: env -> CoVar -> a tcf_hole :: env -> CoercionHole -> a What to do with coercion holes. See Note [Coercion holes] in GHC.Core.TyCo.Rep. tcf_tycobinder :: env -> TyCoVar -> ArgFlag -> env The returned env is used in the extended scope

anyFreeVarsOfType :: (TyCoVar -> Bool) -> Type -> Bool Source #

anyFreeVarsOfTypes :: (TyCoVar -> Bool) -> [Type] -> Bool Source #

closeOverKinds :: TyCoVarSet -> TyCoVarSet Source #

closeOverKindsDSet :: DTyVarSet -> DTyVarSet Source #

Add the kind variables free in the kinds of the tyvars in the given set. Returns a deterministic set.

closeOverKindsList :: [TyVar] -> [TyVar] Source #

Add the kind variables free in the kinds of the tyvars in the given set. Returns a deterministically ordered list.

coVarsOfType :: Type -> CoVarSet Source #

coVarsOfTypes :: [Type] -> CoVarSet Source #

noFreeVarsOfType :: Type -> Bool Source #

scopedSort :: [TyCoVar] -> [TyCoVar] Source #

Do a topological sort on a list of tyvars, so that binders occur before occurrences E.g. given [ a::k, k::*, b::k ] it'll return a well-scoped list [ k::*, a::k, b::k ]

This is a deterministic sorting operation (that is, doesn't depend on Uniques).

It is also meant to be stable: that is, variables should not be reordered unnecessarily. This is specified in Note [ScopedSort] See also Note [Ordering of implicit variables] in GHC.Rename.HsType

tyCoFVsBndr :: TyCoVarBinder -> FV -> FV Source #

tyCoFVsOfType :: Type -> FV Source #

The worker for `tyCoFVsOfType` and `tyCoFVsOfTypeList`. The previous implementation used `unionVarSet` which is O(n+m) and can make the function quadratic. It's exported, so that it can be composed with other functions that compute free variables. See Note [FV naming conventions] in GHC.Utils.FV.

Eta-expanded because that makes it run faster (apparently) See Note [FV eta expansion] in GHC.Utils.FV for explanation.

tyCoFVsVarBndr :: Var -> FV -> FV Source #

tyCoFVsVarBndrs :: [Var] -> FV -> FV Source #

tyCoVarsOfType :: Type -> TyCoVarSet Source #

tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet Source #

`tyCoFVsOfType` that returns free variables of a type in a deterministic set. For explanation of why using `VarSet` is not deterministic see Note [Deterministic FV] in GHC.Utils.FV.

tyCoVarsOfTypeWellScoped :: Type -> [TyVar] Source #

Get the free vars of a type in scoped order

tyCoVarsOfTypes :: [Type] -> TyCoVarSet Source #

tyCoVarsOfTypesWellScoped :: [Type] -> [TyVar] Source #

Get the free vars of types in scoped order

tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv Source #

Add the free `TyVar`s to the env in tidy form, so that we can tidy the type they are free in

tidyKind :: TidyEnv -> Kind -> Kind Source #

tidyOpenKind :: TidyEnv -> Kind -> (TidyEnv, Kind) Source #

tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar) Source #

Treat a new `TyCoVar` as a binder, and give it a fresh tidy name using the environment if one has not already been allocated. See also `tidyVarBndr`

tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar]) Source #

tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type) Source #

tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type]) Source #

Grabs the free type variables, tidies them and then uses `tidyType` to work over the type itself

tidyTopType :: Type -> Type Source #

Calls `tidyType` on a top-level type (i.e. with an empty tidying environment)

tidyTyCoVarBinder :: TidyEnv -> VarBndr TyCoVar vis -> (TidyEnv, VarBndr TyCoVar vis) Source #

tidyTyCoVarBinders :: TidyEnv -> [VarBndr TyCoVar vis] -> (TidyEnv, [VarBndr TyCoVar vis]) Source #

tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar Source #

tidyType :: TidyEnv -> Type -> Type Source #

Tidy a Type

See Note [Strictness in tidyType and friends]

tidyTypes :: TidyEnv -> [Type] -> [Type] Source #

Tidy a list of Types

See Note [Strictness in tidyType and friends]

tidyVarBndr :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar) Source #

tidyVarBndrs :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar]) Source #

This tidies up a type for printing in an error message, or in an interface file.

It doesn't change the uniques at all, just the print names.

cloneTyVarBndr :: TCvSubst -> TyVar -> Unique -> (TCvSubst, TyVar) Source #

cloneTyVarBndrs :: TCvSubst -> [TyVar] -> UniqSupply -> (TCvSubst, [TyVar]) Source #

composeTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst Source #

Composes two substitutions, applying the second one provided first, like in function composition.

composeTCvSubstEnv :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) -> (TvSubstEnv, CvSubstEnv) Source #

`(compose env1 env2)(x)` is `env1(env2(x))`; i.e. apply `env2` then `env1`. It assumes that both are idempotent. Typically, `env1` is the refinement to a base substitution `env2`

emptyTCvSubst :: TCvSubst Source #

emptyTvSubstEnv :: TvSubstEnv Source #

extendCvSubst :: TCvSubst -> CoVar -> Coercion -> TCvSubst Source #

extendTCvInScope :: TCvSubst -> Var -> TCvSubst Source #

extendTCvInScopeList :: TCvSubst -> [Var] -> TCvSubst Source #

extendTCvInScopeSet :: TCvSubst -> VarSet -> TCvSubst Source #

extendTCvSubst :: TCvSubst -> TyCoVar -> Type -> TCvSubst Source #

extendTCvSubstList :: TCvSubst -> [Var] -> [Type] -> TCvSubst Source #

extendTCvSubstWithClone :: TCvSubst -> TyCoVar -> TyCoVar -> TCvSubst Source #

extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst Source #

extendTvSubstBinderAndInScope :: TCvSubst -> TyCoBinder -> Type -> TCvSubst Source #

extendTvSubstWithClone :: TCvSubst -> TyVar -> TyVar -> TCvSubst Source #

getTCvInScope :: TCvSubst -> InScopeSet Source #

getTCvSubstRangeFVs :: TCvSubst -> VarSet Source #

Returns the free variables of the types in the range of a substitution as a non-deterministic set.

getTvSubstEnv :: TCvSubst -> TvSubstEnv Source #

isEmptyTCvSubst :: TCvSubst -> Bool Source #

lookupTyVar :: TCvSubst -> TyVar -> Maybe Type Source #

mkEmptyTCvSubst :: InScopeSet -> TCvSubst Source #

mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst Source #

mkTvSubstPrs :: [(TyVar, Type)] -> TCvSubst Source #

Generates the in-scope set for the `TCvSubst` from the types in the incoming environment. No CoVars, please!

notElemTCvSubst :: Var -> TCvSubst -> Bool Source #

setTvSubstEnv :: TCvSubst -> TvSubstEnv -> TCvSubst Source #

substCoUnchecked :: TCvSubst -> Coercion -> Coercion Source #

Substitute within a `Coercion` disabling sanity checks. The problems that the sanity checks in substCo catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substCoUnchecked to substCo and remove this function. Please don't use in new code.

substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion Source #

Coercion substitution, see `zipTvSubst`. Disables sanity checks. The problems that the sanity checks in substCo catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substCoUnchecked to substCo and remove this function. Please don't use in new code.

substScaledTy :: HasCallStack => TCvSubst -> Scaled Type -> Scaled Type Source #

substScaledTyUnchecked :: HasCallStack => TCvSubst -> Scaled Type -> Scaled Type Source #

substScaledTys :: HasCallStack => TCvSubst -> [Scaled Type] -> [Scaled Type] Source #

substScaledTysUnchecked :: TCvSubst -> [Scaled Type] -> [Scaled Type] Source #

substTheta :: HasCallStack => TCvSubst -> ThetaType -> ThetaType Source #

Substitute within a `ThetaType` The substitution has to satisfy the invariants described in Note [The substitution invariant].

substThetaUnchecked :: TCvSubst -> ThetaType -> ThetaType Source #

Substitute within a `ThetaType` disabling the sanity checks. The problems that the sanity checks in substTys catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substThetaUnchecked to substTheta and remove this function. Please don't use in new code.

substTyAddInScope :: TCvSubst -> Type -> Type Source #

Substitute within a `Type` after adding the free variables of the type to the in-scope set. This is useful for the case when the free variables aren't already in the in-scope set or easily available. See also Note [The substitution invariant].

substTyCoBndr :: TCvSubst -> TyCoBinder -> (TCvSubst, TyCoBinder) Source #

substTyUnchecked :: TCvSubst -> Type -> Type Source #

Substitute within a `Type` disabling the sanity checks. The problems that the sanity checks in substTy catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTyUnchecked to substTy and remove this function. Please don't use in new code.

substTyVar :: TCvSubst -> TyVar -> Type Source #

substTyVarBndr :: HasCallStack => TCvSubst -> TyVar -> (TCvSubst, TyVar) Source #

substTyVarBndrs :: HasCallStack => TCvSubst -> [TyVar] -> (TCvSubst, [TyVar]) Source #

substTyVars :: TCvSubst -> [TyVar] -> [Type] Source #

substTyWith :: HasCallStack => [TyVar] -> [Type] -> Type -> Type Source #

Type substitution, see `zipTvSubst`

substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type Source #

Type substitution, see `zipTvSubst`. Disables sanity checks. The problems that the sanity checks in substTy catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTyUnchecked to substTy and remove this function. Please don't use in new code.

substTys :: HasCallStack => TCvSubst -> [Type] -> [Type] Source #

Substitute within several `Type`s The substitution has to satisfy the invariants described in Note [The substitution invariant].

substTysUnchecked :: TCvSubst -> [Type] -> [Type] Source #

Substitute within several `Type`s disabling the sanity checks. The problems that the sanity checks in substTys catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTysUnchecked to substTys and remove this function. Please don't use in new code.

substTysWith :: [TyVar] -> [Type] -> [Type] -> [Type] Source #

Type substitution, see `zipTvSubst`

substVarBndr :: HasCallStack => TCvSubst -> TyCoVar -> (TCvSubst, TyCoVar) Source #

substVarBndrs :: HasCallStack => TCvSubst -> [TyCoVar] -> (TCvSubst, [TyCoVar]) Source #

unionTCvSubst :: TCvSubst -> TCvSubst -> TCvSubst Source #

zapTCvSubst :: TCvSubst -> TCvSubst Source #

zipCoEnv :: HasDebugCallStack => [CoVar] -> [Coercion] -> CvSubstEnv Source #

zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> TCvSubst Source #

zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> TCvSubst Source #

Generates the in-scope set for the `TCvSubst` from the types in the incoming environment. No CoVars, please!

zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv Source #

data TCvSubst Source #

Type & coercion substitution

The following invariants must hold of a `TCvSubst`:

1. The in-scope set is needed only to guide the generation of fresh uniques
2. In particular, the kind of the type variables in the in-scope set is not relevant
3. The substitution is only applied ONCE! This is because in general such application will not reach a fixed point.

Constructors

TCvSubst InScopeSet TvSubstEnv CvSubstEnv |

#### Instances

Instances details

Outputable TCvSubst Source # |
Instance details Defined in GHC.Core.TyCo.Subst Methods ppr :: TCvSubst -> SDoc Source #

type TvSubstEnv = TyVarEnv Type Source #

A substitution of `Type`s for `TyVar`s and `Kind`s for `KindVar`s

funTyCon :: TyCon Source #

The `FUN` type constructor.

    FUN :: forall (m :: Multiplicity) ->
           forall {rep1 :: RuntimeRep} {rep2 :: RuntimeRep}.
           TYPE rep1 -> TYPE rep2 -> *

The runtime representations quantification is left inferred. This means they cannot be specified with `-XTypeApplications`.

This is a deliberate choice to allow future extensions to the function arrow. To allow visible application a type synonym can be defined:

    type Arr :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep).
                TYPE rep1 -> TYPE rep2 -> Type
    type Arr = FUN 'Many

pattern Many :: Mult Source #

pattern One :: Mult Source #

appTyArgFlags :: Type -> [Type] -> [ArgFlag] Source #

Given a `Type` and a list of argument types to which the `Type` is applied, determine each argument's visibility (`Inferred`, `Specified`, or `Required`).

Most of the time, the arguments will be `Required`, but not always. Consider `f :: forall a. a -> Type`. In `f Type Bool`, the first argument (`Type`) is `Specified` and the second argument (`Bool`) is `Required`. It is precisely this sort of higher-rank situation in which `appTyArgFlags` comes in handy, since `f Type Bool` would be represented in Core using `AppTy`s. (See also #15792).

applyTysX :: [TyVar] -> Type -> [Type] -> Type Source #

binderRelevantType_maybe :: TyCoBinder -> Maybe Type Source #

Extract a relevant type, if there is one.

buildSynTyCon Source #

Arguments

:: Name |
-> [KnotTied TyConBinder] |
-> Kind | result kind
-> [Role] |
-> KnotTied Type |
-> TyCon |

classifiesTypeWithValues :: Kind -> Bool Source #

Does this classify a type allowed to have values? Responds True to things like *, #, TYPE Lifted, TYPE v, Constraint.

True of any sub-kind of OpenTypeKind

coAxNthLHS :: CoAxiom br -> Int -> Type Source #

Get the type on the LHS of a coercion induced by a type/data family instance.

dropForAlls :: Type -> Type Source #

Drops all ForAllTys

dropRuntimeRepArgs :: [Type] -> [Type] Source #

Drops prefix of RuntimeRep constructors in `TyConApp`s. Useful for e.g. dropping 'LiftedRep arguments of unboxed tuple TyCon applications:

dropRuntimeRepArgs [ 'LiftedRep, 'IntRep , String, Int# ] == [String, Int#]

eqType :: Type -> Type -> Bool Source #

Type equality on source types. Does not look through `newtypes` or `PredType`s, but it does look through type synonyms. This first checks that the kinds of the types are equal and then checks whether the types are equal, ignoring casts and coercions. (The kind check is a recursive call, but since all kinds have type `Type`, there is no need to check the types of kinds.) See also Note [Non-trivial definitional equality] in GHC.Core.TyCo.Rep.

eqTypeX :: RnEnv2 -> Type -> Type -> Bool Source #

Compare types with respect to a (presumably) non-empty `RnEnv2`.

eqTypes :: [Type] -> [Type] -> Bool Source #

Type equality on lists of types, looking through type synonyms but not newtypes.

eqVarBndrs :: RnEnv2 -> [Var] -> [Var] -> Maybe RnEnv2 Source #

expandTypeSynonyms :: Type -> Type Source #

Expand out all type synonyms. Actually, it'd suffice to expand out just the ones that discard type variables (e.g. type Funny a = Int) But we don't know which those are currently, so we just expand all.

`expandTypeSynonyms` only expands out type synonyms mentioned in the type, not in the kinds of any TyCon or TyVar mentioned in the type.

Keep this synchronized with `synonymTyConsOfType`

filterOutInferredTypes :: TyCon -> [Type] -> [Type] Source #

Given a `TyCon` and a list of argument types, filter out any `Inferred` arguments.

filterOutInvisibleTypes :: TyCon -> [Type] -> [Type] Source #

Given a `TyCon` and a list of argument types, filter out any invisible (i.e., `Inferred` or `Specified`) arguments.

funArgTy :: Type -> Type Source #

Just like `piResultTys` but for a single argument Try not to iterate `piResultTy`, because it's inefficient to substitute one variable at a time; instead use 'piResultTys"

Extract the function argument type and panic if that is not possible

funResultTy :: Type -> Type Source #

Extract the function result type and panic if that is not possible

getCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN) Source #

If the type is a tyvar, possibly under a cast, returns it, along with the coercion. Thus, the co is :: kind tv ~N kind ty

getRuntimeRep :: HasDebugCallStack => Type -> Type Source #

Extract the RuntimeRep classifier of a type. For instance, `getRuntimeRep_maybe Int = LiftedRep`. Panics if this is not possible.

getRuntimeRep_maybe :: HasDebugCallStack => Type -> Maybe Type Source #

Extract the RuntimeRep classifier of a type. For instance, `getRuntimeRep_maybe Int = LiftedRep`. Returns `Nothing` if this is not possible.

getTyVar :: String -> Type -> TyVar Source #

Attempts to obtain the type variable underlying a `Type`, and panics with the given message if this is not a type variable type. See also `getTyVar_maybe`

getTyVar_maybe :: Type -> Maybe TyVar Source #

Attempts to obtain the type variable underlying a `Type`

invisibleTyBndrCount :: Type -> Int Source #

irrelevantMult :: Scaled a -> a Source #

isAlgType :: Type -> Bool Source #

See Type for what an algebraic type is. Should only be applied to types, as opposed to e.g. partially saturated type constructors

isAnonTyCoBinder :: TyCoBinder -> Bool Source #

Does this binder bind a variable that is not erased? Returns `True` for anonymous binders.

isAtomicTy :: Type -> Bool Source #

isBoxedRuntimeRep :: Type -> Bool Source #

See `isBoxedRuntimeRep_maybe`.

isBoxedType :: Type -> Bool Source #

See Type for what a boxed type is. Panics on levity polymorphic types; See `mightBeUnliftedType` for a more approximate predicate that behaves better in the presence of levity polymorphism.

isBoxedTypeKind :: Kind -> Bool Source #

Returns True if the kind classifies types which are allocated on the GC'd heap and False otherwise. Note that this returns False for levity-polymorphic kinds, which may be specialized to a kind that classifies AddrRep or even unboxed kinds.

isCharLitTy :: Type -> Maybe Char Source #

Is this a char literal? We also look through type synonyms.

isCoVarType :: Type -> Bool Source #

Does this type classify a core (unlifted) Coercion? At either role nominal or representational (t1 ~# t2) or (t1 ~R# t2) See Note [Types for coercions, predicates, and evidence] in GHC.Core.TyCo.Rep

isCoercionTy_maybe :: Type -> Maybe Coercion Source #

isDataFamilyAppType :: Type -> Bool Source #

Check whether a type is a data family type

isFamFreeTy :: Type -> Bool Source #

isForAllTy :: Type -> Bool Source #

Checks whether this is a proper forall (with a named binder)

isForAllTy_co :: Type -> Bool Source #

Like `isForAllTy`, but returns True only if it is a covar binder

isForAllTy_ty :: Type -> Bool Source #

Like `isForAllTy`, but returns True only if it is a tyvar binder

isFunTy :: Type -> Bool Source #

Is this a function?

isKindLevPoly :: Kind -> Bool Source #

Tests whether the given kind (which should look like `TYPE x`) is something other than a constructor tree (that is, constructors at every node). E.g. True of TYPE k, TYPE (F Int) False of TYPE 'LiftedRep

isLevityTy :: Type -> Bool Source #

Is this the type `Levity`?

isLevityVar :: TyVar -> Bool Source #

Is a tyvar of type `Levity`?

isLiftedLevity :: Type -> Bool Source #

isLiftedRuntimeRep :: Type -> Bool Source #

isLiftedType_maybe :: HasDebugCallStack => Type -> Maybe Bool Source #

Returns Just True if this type is surely lifted, Just False if it is surely unlifted, Nothing if we can't be sure (i.e., it is levity polymorphic), and panics if the kind does not have the shape TYPE r.

isLinearType :: Type -> Bool Source #

`isLinear t` returns `True` of a if `t` is a type of (curried) function where at least one argument is linear (or otherwise non-unrestricted). We use this function to check whether it is safe to eta reduce an Id in CorePrep. It is always safe to return `True`, because `True` deactivates the optimisation.

isLitTy :: Type -> Maybe TyLit Source #

Is this a type literal (symbol, numeric, or char)?

isManyDataConTy :: Mult -> Bool Source #

isMultiplicityVar :: TyVar -> Bool Source #

Is a tyvar of type `Multiplicity`?

isNumLitTy :: Type -> Maybe Integer Source #

Is this a numeric literal. We also look through type synonyms.

isOneDataConTy :: Mult -> Bool Source #

isPiTy :: Type -> Bool Source #

Is this a function or forall?

isPrimitiveType :: Type -> Bool Source #

Returns true of types that are opaque to Haskell.

isRuntimeRepKindedTy :: Type -> Bool Source #

Is this a type of kind RuntimeRep? (e.g. LiftedRep)

isRuntimeRepVar :: TyVar -> Bool Source #

Is a tyvar of type `RuntimeRep`?

isStrLitTy :: Type -> Maybe FastString Source #

Is this a symbol literal. We also look through type synonyms.

isStrictType :: HasDebugCallStack => Type -> Bool Source #

Computes whether an argument (or let right hand side) should be computed strictly or lazily, based only on its type. Currently, it's just `isUnliftedType`. Panics on levity-polymorphic types.

isTauTy :: Type -> Bool Source #

isTyVarTy :: Type -> Bool Source #

isTypeLevPoly :: Type -> Bool Source #

Returns True if a type is levity polymorphic. Should be the same as (isKindLevPoly . typeKind) but much faster. Precondition: The type has kind (TYPE blah)

isUnboxedSumType :: Type -> Bool Source #

isUnboxedTupleType :: Type -> Bool Source #

isUnliftedLevity :: Type -> Bool Source #

isUnliftedRuntimeRep :: Type -> Bool Source #

isUnliftedType :: HasDebugCallStack => Type -> Bool Source #

See Type for what an unlifted type is. Panics on levity polymorphic types; See `mightBeUnliftedType` for a more approximate predicate that behaves better in the presence of levity polymorphism.

isUnliftedTypeKind :: Kind -> Bool Source #

Returns True if the kind classifies unlifted types (like 'Int#') and False otherwise. Note that this returns False for levity-polymorphic kinds, which may be specialized to a kind that classifies unlifted types.

isValidJoinPointType :: JoinArity -> Type -> Bool Source #

Determine whether a type could be the type of a join point of given total arity, according to the polymorphism rule. A join point cannot be polymorphic in its return type, since given join j `a` b x y z = e1 in e2, the types of e1 and e2 must be the same, and a and b are not in scope for e2. (See Note [The polymorphism rule of join points] in GHC.Core.) Returns False also if the type simply doesn't have enough arguments.

Note that we need to know how many arguments (type *and* value) the putative join point takes; for instance, if j :: forall a. a -> Int then j could be a binary join point returning an Int, but it could *not* be a unary join point returning a -> Int.

TODO: See Note [Excess polymorphism and join points]

kindRep :: HasDebugCallStack => Kind -> Type Source #

Extract the RuntimeRep classifier of a type from its kind. For example, `kindRep * = LiftedRep`; Panics if this is not possible. Treats * and Constraint as the same

kindRep_maybe :: HasDebugCallStack => Kind -> Maybe Type Source #

Given a kind (TYPE rr), extract its RuntimeRep classifier rr. For example, `kindRep_maybe * = Just LiftedRep` Returns `Nothing` if the kind is not of form (TYPE rr) Treats * and Constraint as the same

linear :: a -> Scaled a Source #

Scale a payload by One

mapTyCo :: Monad m => TyCoMapper () m -> (Type -> m Type, [Type] -> m [Type], Coercion -> m Coercion, [Coercion] -> m [Coercion]) Source #

mapTyCoX :: Monad m => TyCoMapper env m -> (env -> Type -> m Type, env -> [Type] -> m [Type], env -> Coercion -> m Coercion, env -> [Coercion] -> m [Coercion]) Source #

mightBeUnliftedType :: Type -> Bool Source #

Returns:

- `False` if the type is guaranteed lifted or
- `True` if it is unlifted, OR we aren't sure (e.g. in a levity-polymorphic case)

mkAnonBinder :: AnonArgFlag -> Scaled Type -> TyCoBinder Source #

Make an anonymous binder

mkAppTys :: Type -> [Type] -> Type Source #

mkCharLitTy :: Char -> Type Source #

mkCoercionTy :: Coercion -> Type Source #

mkFamilyTyConApp :: TyCon -> [Type] -> Type Source #

Given a family instance TyCon and its arg types, return the corresponding family type. E.g:

    data family T a
    data instance T (Maybe b) = MkT b

Where the instance tycon is :RTL, so:

    mkFamilyTyConApp :RTL Int  =  T (Maybe Int)

mkInfForAllTy :: TyVar -> Type -> Type Source #

Like `mkTyCoInvForAllTy`, but tv should be a tyvar

mkInfForAllTys :: [TyVar] -> Type -> Type Source #

Like `mkTyCoInvForAllTys`, but tvs should be a list of tyvar

mkNumLitTy :: Integer -> Type Source #

mkScaled :: Mult -> a -> Scaled a Source #

mkSpecForAllTy :: TyVar -> Type -> Type Source #

Like `mkForAllTy`, but assumes the variable is dependent and `Specified`, a common case

mkSpecForAllTys :: [TyVar] -> Type -> Type Source #

Like `mkForAllTys`, but assumes all variables are dependent and `Specified`, a common case

mkStrLitTy :: FastString -> Type Source #

mkTyCoInvForAllTy :: TyCoVar -> Type -> Type Source #

Make a dependent forall over an `Inferred` variable

mkTyCoInvForAllTys :: [TyCoVar] -> Type -> Type Source #

Like `mkForAllTys`, but assumes all variables are dependent and `Inferred`, a common case

mkTyConBindersPreferAnon Source #

Arguments

:: [TyVar] | binders
-> TyCoVarSet | free variables of result
-> [TyConBinder] |

Given a list of type-level vars and the free vars of a result kind, makes TyCoBinders, preferring anonymous binders if the variable is, in fact, not dependent. e.g. mkTyConBindersPreferAnon (k:*),(b:k),(c:k) We want (k:*) Named, (b:k) Anon, (c:k) Anon

All non-coercion binders are visible.

mkVisForAllTys :: [TyVar] -> Type -> Type Source #

Like mkForAllTys, but assumes all variables are dependent and visible

newTyConInstRhs :: TyCon -> [Type] -> Type Source #

Unwrap one `layer` of newtype on a type constructor and its arguments, using an eta-reduced version of the `newtype` if possible. This requires tys to have at least `newTyConInstArity tycon` elements.

nonDetCmpTc :: TyCon -> TyCon -> Ordering Source #

Compare two `TyCon`s. NB: This should never see `Constraint` (as recognized by Kind.isConstraintKindCon) which is considered a synonym for `Type` in Core. See Note [Kind Constraint and kind Type] in GHC.Core.Type. See Note [nonDetCmpType nondeterminism]

nonDetCmpType :: Type -> Type -> Ordering Source #

nonDetCmpTypeX :: RnEnv2 -> Type -> Type -> Ordering Source #

nonDetCmpTypes :: [Type] -> [Type] -> Ordering Source #

nonDetCmpTypesX :: RnEnv2 -> [Type] -> [Type] -> Ordering Source #

occCheckExpand :: [Var] -> Type -> Maybe Type Source #

partitionInvisibles :: [(a, ArgFlag)] -> ([a], [a]) Source #

Given a list of things paired with their visibilities, partition the things into (invisible things, visible things).

piResultTys :: HasDebugCallStack => Type -> [Type] -> Type Source #

(piResultTys f_ty [ty1, .., tyn]) gives the type of (f ty1 .. tyn) where f :: f_ty `piResultTys` is interesting because: 1. `f_ty` may have more for-alls than there are args 2. Less obviously, it may have fewer for-alls For case 2. think of: piResultTys (forall a.a) [forall b.b, Int] This really can happen, but only (I think) in situations involving undefined. For example: undefined :: forall a. a Term: undefined `(forall b. b->b)` Int This term should have type (Int -> Int), but notice that there are more type args than foralls in `undefined`s type.

pickyIsLiftedTypeKind :: Kind -> Bool Source #

pprUserTypeErrorTy :: Type -> SDoc Source #

Render a type corresponding to a user type error into a SDoc.

repGetTyVar_maybe :: Type -> Maybe TyVar Source #

Attempts to obtain the type variable underlying a `Type`, without any expansion

repSplitAppTy_maybe :: HasDebugCallStack => Type -> Maybe (Type, Type) Source #

Does the AppTy split as in `splitAppTy_maybe`, but assumes that any Core view stuff is already done

repSplitAppTys :: HasDebugCallStack => Type -> (Type, [Type]) Source #

Like `splitAppTys`, but doesn't look through type synonyms

repSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) Source #

Like `splitTyConApp_maybe`, but doesn't look through synonyms. This assumes the synonyms have already been dealt with.

Moreover, for a FunTy, it only succeeds if the argument types have enough info to extract the runtime-rep arguments that the funTyCon requires. This will usually be true; but may be temporarily false during canonicalization: see Note [Decomposing FunTy] in GHC.Tc.Solver.Canonical

resultIsLevPoly :: Type -> Bool Source #

Looking past all pi-types, is the end result potentially levity polymorphic? Example: True for (forall r (a :: TYPE r). String -> a) Example: False for (forall r1 r2 (a :: TYPE r1) (b :: TYPE r2). a -> b -> Type)

scaledSet :: Scaled a -> b -> Scaled b Source #

seqType :: Type -> () Source #

seqTypes :: [Type] -> () Source #

splitAppTy :: Type -> (Type, Type) Source #

Attempts to take a type application apart, as in `splitAppTy_maybe`, and panics if this is not possible

splitAppTy_maybe :: Type -> Maybe (Type, Type) Source #

Attempt to take a type application apart, whether it is a function, type constructor, or plain type application. Note that type family applications are NEVER unsaturated by this!

splitAppTys :: Type -> (Type, [Type]) Source #

Recursively splits a type as far as is possible, leaving a residual type being applied to and the type arguments applied to it. Never fails, even if that means returning an empty list of type applications.

splitCastTy_maybe :: Type -> Maybe (Type, Coercion) Source #

splitForAllCoVar_maybe :: Type -> Maybe (TyCoVar, Type) Source #

Like `splitForAllTyCoVar_maybe`, but only returns Just if it is a covar binder.

splitForAllInvisTVBinders :: Type -> ([InvisTVBinder], Type) Source #

Like `splitForAllTyCoVars`, but only splits `ForAllTy`s with `Invisible` type variable binders. Furthermore, each returned tyvar is annotated with its `Specificity`.

splitForAllReqTVBinders :: Type -> ([ReqTVBinder], Type) Source #

Like `splitForAllTyCoVars`, but only splits `ForAllTy`s with `Required` type variable binders. Furthermore, each returned tyvar is annotated with `()`.

splitForAllTyCoVar :: Type -> (TyCoVar, Type) Source #

Take a forall type apart, or panics if that is not possible.

splitForAllTyCoVarBinders :: Type -> ([TyCoVarBinder], Type) Source #

Like `splitPiTys` but split off only named binders and returns `TyCoVarBinder`s rather than `TyCoBinder`s

splitForAllTyCoVar_maybe :: Type -> Maybe (TyCoVar, Type) Source #

Attempts to take a forall type apart, but only if it's a proper forall, with a named binder

splitForAllTyCoVars :: Type -> ([TyCoVar], Type) Source #

Take a ForAllTy apart, returning the list of tycovars and the result type. This always succeeds, even if it returns only an empty list. Note that the result type returned may have free variables that were bound by a forall.

splitForAllTyVar_maybe :: Type -> Maybe (TyCoVar, Type) Source #

Like `splitForAllTyCoVar_maybe`, but only returns Just if it is a tyvar binder.

splitFunTy :: Type -> (Mult, Type, Type) Source #

Attempts to extract the multiplicity, argument and result types from a type, and panics if that is not possible. See also `splitFunTy_maybe`

splitFunTy_maybe :: Type -> Maybe (Mult, Type, Type) Source #

Attempts to extract the multiplicity, argument and result types from a type

splitFunTys :: Type -> ([Scaled Type], Type) Source #

splitInvisPiTys :: Type -> ([TyCoBinder], Type) Source #

Like `splitPiTys`, but returns only *invisible* binders, including constraints. Stops at the first visible binder.

splitInvisPiTysN :: Int -> Type -> ([TyCoBinder], Type) Source #

Same as `splitInvisPiTys`, but stop when - you have found `n` `TyCoBinder`s, - or you run out of invisible binders

splitListTyConApp_maybe :: Type -> Maybe Type Source #

Attempts to tease a list type apart and gives the type of the elements if successful (looks through type synonyms)

splitPiTy :: Type -> (TyCoBinder, Type) Source #

Takes a forall type apart, or panics

splitPiTy_maybe :: Type -> Maybe (TyCoBinder, Type) Source #

Attempts to take a forall type apart; works with proper foralls and functions

splitPiTys :: Type -> ([TyCoBinder], Type) Source #

Split off all TyCoBinders to a type, splitting both proper foralls and functions

splitTyConApp :: Type -> (TyCon, [Type]) Source #

Attempts to tease a type apart into a type constructor and the application of a number of arguments to that constructor. Panics if that is not possible. See also `splitTyConApp_maybe`

splitVisVarsOfType :: Type -> Pair TyCoVarSet Source #

Retrieve the free variables in this type, splitting them based on whether they are used visibly or invisibly. Invisible ones come first.

splitVisVarsOfTypes :: [Type] -> Pair TyCoVarSet Source #

stripCoercionTy :: Type -> Coercion Source #

tcIsBoxedTypeKind :: Kind -> Bool Source #

Is this kind equivalent to `TYPE (BoxedRep l)` for some `l :: Levity`?

This considers `Constraint` to be distinct from `Type`. For a version that treats them as the same type, see `isLiftedTypeKind`.

tcIsConstraintKind :: Kind -> Bool Source #

tcIsLiftedTypeKind :: Kind -> Bool Source #

Is this kind equivalent to `Type`?

This considers `Constraint` to be distinct from `Type`. For a version that treats them as the same type, see `isLiftedTypeKind`.

tcIsRuntimeTypeKind :: Kind -> Bool Source #

Is this kind equivalent to `TYPE r` (for some unknown r)?

This considers `Constraint` to be distinct from `*`.

tcRepSplitAppTy_maybe :: Type -> Maybe (Type, Type) Source #

Does the AppTy split as in `tcSplitAppTy_maybe`, but assumes that any coreView stuff is already done. Refuses to look through (c => t)

tcReturnsConstraintKind :: Kind -> Bool Source #

tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type]) Source #

Split a type constructor application into its type constructor and applied types. Note that this may fail in the case of a `FunTy` with an argument of unknown kind `FunTy` (e.g. `FunTy (a :: k) Int`. since the kind of `a` isn't of the form `TYPE rep`). Consequently, you may need to zonk your type before using this function.

This does *not* split types headed with (=>), as that's not a TyCon in the type-checker.

If you only need the `TyCon`, consider using `tcTyConAppTyCon_maybe`.

tcTypeKind :: HasDebugCallStack => Type -> Kind Source #

tyBinderType :: TyBinder -> Type Source #

tyCoBinderType :: TyCoBinder -> Type Source #

tyCoBinderVar_maybe :: TyCoBinder -> Maybe TyCoVar Source #

tyConAppArgN :: Int -> Type -> Type Source #

tyConAppArgs :: Type -> [Type] Source #

tyConAppArgs_maybe :: Type -> Maybe [Type] Source #

The same as `snd . splitTyConApp`

tyConAppNeedsKindSig Source #

Arguments

:: Bool | Should specified binders count towards injective positions in the kind of the TyCon? (If you're using visible kind applications, then you want True here.
-> TyCon |
-> Int | The number of args the `TyCon` is applied to.
-> Bool | Does `T t_1 ... t_n` need a kind signature? (Where `n` is the number of arguments)

Does a `TyCon` (that is applied to some number of arguments) need to be ascribed with an explicit kind signature to resolve ambiguity if rendered as a source-syntax type? (See `Note [When does a tycon application need an explicit kind signature?]` for a full explanation of what this function checks for.)

tyConAppTyCon :: Type -> TyCon Source #

tyConAppTyConPicky_maybe :: Type -> Maybe TyCon Source #

Retrieve the tycon heading this type, if there is one. Does not look through synonyms.

tyConArgFlags :: TyCon -> [Type] -> [ArgFlag] Source #

Given a `TyCon` and a list of argument types to which the `TyCon` is applied, determine each argument's visibility (`Inferred`, `Specified`, or `Required`).

Wrinkle: consider the following scenario:

    T :: forall k. k -> k
    tyConArgFlags T [forall m. m -> m -> m, S, R, Q]

After substituting, we get

    T (forall m. m -> m -> m) :: (forall m. m -> m -> m) -> forall n. n -> n -> n

Thus, the first argument is invisible, `S` is visible, `R` is invisible again, and `Q` is visible.

tyConBindersTyCoBinders :: [TyConBinder] -> [TyCoBinder] Source #

tyConsOfType :: Type -> UniqSet TyCon Source #

All type constructors occurring in the type; looking through type synonyms, but not newtypes. When it finds a Class, it returns the class TyCon.

tymult :: a -> Scaled a Source #

Scale a payload by Many; used for type arguments in core

typeKind :: HasDebugCallStack => Type -> Kind Source #

unrestricted :: a -> Scaled a Source #

Scale a payload by Many

userTypeError_maybe :: Type -> Maybe Type Source #

Is this type a custom user error? If so, give us the kind and the error message.

data TyCoMapper env m Source #

This describes how a "map" operation over a type/coercion should behave

Constructors

TyCoMapper |
Fields tcm_tyvar :: env -> TyVar -> m Type tcm_covar :: env -> CoVar -> m Coercion tcm_hole :: env -> CoercionHole -> m Coercion What to do with coercion holes. See Note [Coercion holes] in GHC.Core.TyCo.Rep. tcm_tycobinder :: env -> TyCoVar -> ArgFlag -> m (env, TyCoVar) The returned env is used in the extended scope tcm_tycon :: TyCon -> m TyCon This is used only for TcTyCons a) To zonk TcTyCons b) To turn TcTyCons into TyCons. See Note [Type checking recursive type and class declarations] in GHC.Tc.TyCl

module GHC.Core.TyCon

type TyCoVar = Id Source #

Type or Coercion Variable

data Var Source #

Variable

Essentially a typed `Name`, that may also contain some additional information about the `Var` and its use sites.

#### Instances

Instances details

Data Var Source # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var Source # toConstr :: Var -> Constr Source # dataTypeOf :: Var -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) Source # gmapT :: (forall b. Data b => b -> b) -> Var -> Var Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #
NamedThing Var Source # |
Instance details Defined in GHC.Types.Var Methods getOccName :: Var -> OccName Source # getName :: Var -> Name Source #
HasOccName Var Source # |
Instance details Defined in GHC.Types.Var Methods occName :: Var -> OccName Source #
Uniquable Var Source # |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique Source #
Outputable Var Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: Var -> SDoc Source #
OutputableBndr Var Source # |
Instance details Defined in GHC.Core.Ppr Methods pprBndr :: BindingSite -> Var -> SDoc Source # pprPrefixOcc :: Var -> SDoc Source # pprInfixOcc :: Var -> SDoc Source # bndrIsJoin_maybe :: Var -> Maybe Int Source #
Eq Var Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: Var -> Var -> Bool # (/=) :: Var -> Var -> Bool #
Ord Var Source # |
Instance details Defined in GHC.Types.Var Methods compare :: Var -> Var -> Ordering # (<) :: Var -> Var -> Bool # (<=) :: Var -> Var -> Bool # (>) :: Var -> Var -> Bool # (>=) :: Var -> Var -> Bool # max :: Var -> Var -> Var # min :: Var -> Var -> Var #
Eq (DeBruijn CoreAlt) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool # (/=) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool #
Eq (DeBruijn CoreExpr) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool # (/=) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool #
type Anno Id Source # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN
type Anno (LocatedN Id) Source # |
Instance details Defined in GHC.Hs.Binds type Anno (LocatedN Id) = SrcSpan
type Anno [LocatedN Id] Source # |
Instance details Defined in GHC.Hs.Binds type Anno [LocatedN Id] = SrcSpan

pickLR :: LeftOrRight -> (a, a) -> a Source #

data LeftOrRight Source #

Constructors

CLeft |
CRight |

#### Instances

Instances details

Data LeftOrRight Source # |
Instance details Defined in GHC.Types.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LeftOrRight -> c LeftOrRight Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LeftOrRight Source # toConstr :: LeftOrRight -> Constr Source # dataTypeOf :: LeftOrRight -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LeftOrRight) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LeftOrRight) Source # gmapT :: (forall b. Data b => b -> b) -> LeftOrRight -> LeftOrRight Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LeftOrRight -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LeftOrRight -> r Source # gmapQ :: (forall d. Data d => d -> u) -> LeftOrRight -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> LeftOrRight -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight Source #
Binary LeftOrRight Source # |
Instance details Defined in GHC.Types.Basic Methods put_ :: BinHandle -> LeftOrRight -> IO () Source # put :: BinHandle -> LeftOrRight -> IO (Bin LeftOrRight) Source # get :: BinHandle -> IO LeftOrRight Source #
Outputable LeftOrRight Source # |
Instance details Defined in GHC.Types.Basic Methods ppr :: LeftOrRight -> SDoc Source #
Eq LeftOrRight Source # |
Instance details Defined in GHC.Types.Basic Methods (==) :: LeftOrRight -> LeftOrRight -> Bool # (/=) :: LeftOrRight -> LeftOrRight -> Bool #

data Coercion Source #

A `Coercion` is concrete evidence of the equality/convertibility of two types.

#### Instances

Instances details

Data Coercion Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Coercion -> c Coercion Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Coercion Source # toConstr :: Coercion -> Constr Source # dataTypeOf :: Coercion -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Coercion) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Coercion) Source # gmapT :: (forall b. Data b => b -> b) -> Coercion -> Coercion Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Coercion -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Coercion -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Coercion -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Coercion -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source #
Outputable Coercion Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods ppr :: Coercion -> SDoc Source #
Eq (DeBruijn Coercion) Source # |
Instance details Defined in GHC.Core.Map.Type Methods (==) :: DeBruijn Coercion -> DeBruijn Coercion -> Bool # (/=) :: DeBruijn Coercion -> DeBruijn Coercion -> Bool #

type CoercionN = Coercion Source #

data MCoercion Source #

A semantically more meaningful type to represent what may or may not be a useful `Coercion`.

Constructors

MRefl |
MCo Coercion |

#### Instances

Instances details

Data MCoercion Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MCoercion -> c MCoercion Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c MCoercion Source # toConstr :: MCoercion -> Constr Source # dataTypeOf :: MCoercion -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c MCoercion) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MCoercion) Source # gmapT :: (forall b. Data b => b -> b) -> MCoercion -> MCoercion Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MCoercion -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MCoercion -> r Source # gmapQ :: (forall d. Data d => d -> u) -> MCoercion -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> MCoercion -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source #
Outputable MCoercion Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods ppr :: MCoercion -> SDoc Source #

type MCoercionN = MCoercion Source #

data UnivCoProvenance Source #

For simplicity, we have just one UnivCo that represents a coercion from some type to some other type, with (in general) no restrictions on the type. The UnivCoProvenance specifies more exactly what the coercion really is and why a program should (or shouldn't!) trust the coercion. It is reasonable to consider each constructor of `UnivCoProvenance` as a totally independent coercion form; their only commonality is that they don't tell you what types they coercion between. (That info is in the `UnivCo` constructor of `Coercion`.

#### Instances

Instances details

Data UnivCoProvenance Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnivCoProvenance -> c UnivCoProvenance Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnivCoProvenance Source # toConstr :: UnivCoProvenance -> Constr Source # dataTypeOf :: UnivCoProvenance -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UnivCoProvenance) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnivCoProvenance) Source # gmapT :: (forall b. Data b => b -> b) -> UnivCoProvenance -> UnivCoProvenance Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnivCoProvenance -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnivCoProvenance -> r Source # gmapQ :: (forall d. Data d => d -> u) -> UnivCoProvenance -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> UnivCoProvenance -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source #
Outputable UnivCoProvenance Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods ppr :: UnivCoProvenance -> SDoc Source #

pprCo :: Coercion -> SDoc Source #

isCoVar :: Var -> Bool Source #

Is this a coercion variable? Satisfies ``isId` v ==> `isCoVar` v == not (`isNonCoVarId` v)`.

mkCoVar :: Name -> Type -> CoVar Source #

type CoVar = Id Source #

Coercion Variable

data Role Source #

Constructors

Nominal |
Representational |
Phantom |

#### Instances

Instances details

Data Role Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Role -> c Role Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Role Source # toConstr :: Role -> Constr Source # dataTypeOf :: Role -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Role) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Role) Source # gmapT :: (forall b. Data b => b -> b) -> Role -> Role Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Role -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Role -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Role -> m Role Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role Source #
Binary Role Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods put_ :: BinHandle -> Role -> IO () Source # put :: BinHandle -> Role -> IO (Bin Role) Source # get :: BinHandle -> IO Role Source #
Outputable Role Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods ppr :: Role -> SDoc Source #
Eq Role Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods (==) :: Role -> Role -> Bool # (/=) :: Role -> Role -> Bool #
Ord Role Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods compare :: Role -> Role -> Ordering # (<) :: Role -> Role -> Bool # (<=) :: Role -> Role -> Bool # (>) :: Role -> Role -> Bool # (>=) :: Role -> Role -> Bool # max :: Role -> Role -> Role # min :: Role -> Role -> Role #
type Anno (Maybe Role) Source # |
Instance details Defined in GHC.Hs.Decls type Anno (Maybe Role) = SrcSpan
type Anno (Maybe Role) Source # |
Instance details Defined in GHC.Hs.Decls type Anno (Maybe Role) = SrcSpan

coVarKindsTypesRole :: HasDebugCallStack => CoVar -> (Kind, Kind, Type, Type, Role) Source #

coVarRole :: CoVar -> Role Source #

coercionKind :: Coercion -> Pair Type Source #

If it is the case that

    c :: (t1 ~ t2)

i.e. the kind of `c` relates `t1` and `t2`, then `coercionKind c = Pair t1 t2`.

coercionLKind :: Coercion -> Type Source #

coercionRKind :: Coercion -> Type Source #

coercionType :: Coercion -> Type Source #

decomposePiCos :: HasDebugCallStack => CoercionN -> Pair Type -> [Type] -> ([CoercionN], CoercionN) Source #

isGReflCo :: Coercion -> Bool Source #

Tests if this coercion is obviously a generalized reflexive coercion. Guaranteed to work very quickly.

isReflCo :: Coercion -> Bool Source #

Tests if this coercion is obviously reflexive. Guaranteed to work very quickly. Sometimes a coercion can be reflexive, but not obviously so. c.f. `isReflexiveCo`

isReflexiveCo :: Coercion -> Bool Source #

Slowly checks if the coercion is reflexive. Don't call this in a loop, as it walks over the entire coercion.

liftCoSubst :: HasDebugCallStack => Role -> LiftingContext -> Type -> Coercion Source #

`liftCoSubst role lc ty` produces a coercion (at role `role`) that coerces between `lc_left(ty)` and `lc_right(ty)`, where `lc_left` is a substitution mapping type variables to the left-hand types of the mapped coercions in `lc`, and similar for `lc_right`.

mkAppCo Source #

Arguments

:: Coercion | :: t1 ~r t2
-> Coercion | :: s1 ~N s2, where s1 :: k1, s2 :: k2
-> Coercion | :: t1 s1 ~r t2 s2

Apply a `Coercion` to another `Coercion`. The second coercion must be Nominal, unless the first is Phantom. If the first is Phantom, then the second can be either Phantom or Nominal.

mkAxiomInstCo :: CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion Source #

mkAxiomRuleCo :: CoAxiomRule -> [Coercion] -> Coercion Source #

mkCoVarCo :: CoVar -> Coercion Source #

mkCoercionType :: Role -> Type -> Type -> Type Source #

Makes a coercion type from two types: the types whose equality is proven by the relevant `Coercion`

mkForAllCo :: TyCoVar -> CoercionN -> Coercion -> Coercion Source #

Make a Coercion from a tycovar, a kind coercion, and a body coercion. The kind of the tycovar should be the left-hand kind of the kind coercion. See Note [Unused coercion variable in ForAllCo]

mkFunCo :: Role -> CoercionN -> Coercion -> Coercion -> Coercion Source #

Build a function `Coercion` from two other `Coercion`s. That is, given `co1 :: a ~ b` and `co2 :: x ~ y` produce `co :: (a -> x) ~ (b -> y)`.

mkGReflCo :: Role -> Type -> MCoercionN -> Coercion Source #

Make a generalized reflexive coercion

mkInstCo :: Coercion -> Coercion -> Coercion Source #

Instantiates a `Coercion`.

mkKindCo :: Coercion -> Coercion Source #

Given `co :: (a :: k) ~ (b :: k')` produce `co' :: k ~ k'`.

mkLRCo :: LeftOrRight -> Coercion -> Coercion Source #

mkNomReflCo :: Type -> Coercion Source #

Make a nominal reflexive coercion

mkNthCo :: HasDebugCallStack => Role -> Int -> Coercion -> Coercion Source #

mkPhantomCo :: Coercion -> Type -> Type -> Coercion Source #

Make a phantom coercion between two types. The coercion passed in must be a nominal coercion between the kinds of the types.

mkProofIrrelCo Source #

Arguments

:: Role | role of the created coercion, "r"
-> Coercion | :: phi1 ~N phi2
-> Coercion | g1 :: phi1
-> Coercion | g2 :: phi2
-> Coercion | :: g1 ~r g2

Make a "coercion between coercions".

mkReflCo :: Role -> Type -> Coercion Source #

Make a reflexive coercion

mkSubCo :: HasDebugCallStack => Coercion -> Coercion Source #

mkSymCo :: Coercion -> Coercion Source #

Create a symmetric version of the given `Coercion` that asserts equality between the same types but in the other "direction", so a kind of `t1 ~ t2` becomes the kind `t2 ~ t1`.

mkTransCo :: Coercion -> Coercion -> Coercion Source #

Create a new `Coercion` by composing the two given `Coercion`s transitively. (co1 ; co2)

mkTyConAppCo :: HasDebugCallStack => Role -> TyCon -> [Coercion] -> Coercion Source #

Apply a type constructor to a list of coercions. It is the caller's responsibility to get the roles correct on argument coercions.

mkUnivCo Source #

Arguments

:: UnivCoProvenance |
-> Role | role of the built coercion, "r"
-> Type | t1 :: k1
-> Type | t2 :: k2
-> Coercion | :: t1 ~r t2

Make a universal coercion between two arbitrary types.

seqCo :: Coercion -> () Source #

data LiftingContext Source #

Constructors

LC TCvSubst LiftCoEnv |

#### Instances

Instances details

Outputable LiftingContext Source # |
Instance details Defined in GHC.Core.Coercion Methods ppr :: LiftingContext -> SDoc Source #

coHoleCoVar :: CoercionHole -> CoVar Source #

coercionSize :: Coercion -> Int Source #

setCoHoleCoVar :: CoercionHole -> CoVar -> CoercionHole Source #

data CoercionHole Source #

A coercion to be filled in by the type-checker. See Note [Coercion holes]

Constructors

CoercionHole |
Fields ch_co_var :: CoVar ch_ref :: IORef (Maybe Coercion)

#### Instances

Instances details

Data CoercionHole Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CoercionHole -> c CoercionHole Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CoercionHole Source # toConstr :: CoercionHole -> Constr Source # dataTypeOf :: CoercionHole -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CoercionHole) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CoercionHole) Source # gmapT :: (forall b. Data b => b -> b) -> CoercionHole -> CoercionHole Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CoercionHole -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CoercionHole -> r Source # gmapQ :: (forall d. Data d => d -> u) -> CoercionHole -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> CoercionHole -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source #
Uniquable CoercionHole Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods getUnique :: CoercionHole -> Unique Source #
Outputable CoercionHole Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods ppr :: CoercionHole -> SDoc Source #

type CoercionP = Coercion Source #

type CoercionR = Coercion Source #

type MCoercionR = MCoercion Source #

anyFreeVarsOfCo :: (TyCoVar -> Bool) -> Coercion -> Bool Source #

coVarsOfCo :: Coercion -> CoVarSet Source #

tyCoFVsOfCo :: Coercion -> FV Source #

tyCoFVsOfCos :: [Coercion] -> FV Source #

tyCoVarsOfCo :: Coercion -> TyCoVarSet Source #

tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet Source #

Get a deterministic set of the vars free in a coercion

tyCoVarsOfCos :: [Coercion] -> TyCoVarSet Source #

tidyCo :: TidyEnv -> Coercion -> Coercion Source #

Tidy a Coercion

See Note [Strictness in tidyType and friends]

tidyCos :: TidyEnv -> [Coercion] -> [Coercion] Source #

emptyCvSubstEnv :: CvSubstEnv Source #

extendTvSubstAndInScope :: TCvSubst -> TyVar -> Type -> TCvSubst Source #

getCvSubstEnv :: TCvSubst -> CvSubstEnv Source #

lookupCoVar :: TCvSubst -> Var -> Maybe Coercion Source #

substCoVar :: TCvSubst -> CoVar -> Coercion Source #

substCoVarBndr :: HasCallStack => TCvSubst -> CoVar -> (TCvSubst, CoVar) Source #

substCoVars :: TCvSubst -> [CoVar] -> [Coercion] Source #

substCoWith :: HasCallStack => [TyVar] -> [Type] -> Coercion -> Coercion Source #

Coercion substitution, see `zipTvSubst`

substCos :: HasCallStack => TCvSubst -> [Coercion] -> [Coercion] Source #

Substitute within several `Coercion`s The substitution has to satisfy the invariants described in Note [The substitution invariant].

type CvSubstEnv = CoVarEnv Coercion Source #

A substitution of `Coercion`s for `CoVar`s

pprParendCo :: Coercion -> SDoc Source #

buildCoercion :: Type -> Type -> CoercionN Source #

Assuming that two types are the same, ignoring coercions, find a nominal coercion between the types. This is useful when optimizing transitivity over coercion applications, where splitting two AppCos might yield different kinds. See Note [EtaAppCo] in GHC.Core.Coercion.Opt.

castCoercionKind :: Coercion -> CoercionN -> CoercionN -> Coercion Source #

Creates a new coercion with both of its types casted by different casts `castCoercionKind g h1 h2`, where `g :: t1 ~r t2`, has type `(t1 |> h1) ~r (t2 |> h2)`. `h1` and `h2` must be nominal. It calls `coercionKindRole`, so it's quite inefficient (which `I` stands for) Use `castCoercionKind2` instead if `t1`, `t2`, and `r` are known beforehand.

castCoercionKind1 :: Coercion -> Role -> Type -> Type -> CoercionN -> Coercion Source #

`castCoercionKind1 g r t1 t2 h` = `coercionKind g r t1 t2 h h` That is, it's a specialised form of castCoercionKind, where the two kind coercions are identical `castCoercionKind1 g r t1 t2 h`, where `g :: t1 ~r t2`, has type `(t1 |> h) ~r (t2 |> h)`. `h` must be nominal. See Note [castCoercionKind1]

castCoercionKind2 :: Coercion -> Role -> Type -> Type -> CoercionN -> CoercionN -> Coercion Source #

Creates a new coercion with both of its types casted by different casts `castCoercionKind2 g r t1 t2 h1 h2`, where `g :: t1 ~r t2`, has type `(t1 |> h1) ~r (t2 |> h2)`. `h1` and `h2` must be nominal.

coToMCo :: Coercion -> MCoercion Source #

coVarKind :: CoVar -> Type Source #

coVarName :: CoVar -> Name Source #

coVarTypes :: HasDebugCallStack => CoVar -> Pair Type Source #

coercionHolesOfCo :: Coercion -> UniqSet CoercionHole Source #

coercionHolesOfType :: Type -> UniqSet CoercionHole Source #

Extract out all the coercion holes from a given type

coercionKindRole :: Coercion -> (Pair Type, Role) Source #

Get a coercion's kind and role.

coercionKinds :: [Coercion] -> Pair [Type] Source #

Apply `coercionKind` to multiple `Coercion`s

coercionRole :: Coercion -> Role Source #

Retrieve the role from a coercion.

composeSteppers :: NormaliseStepper ev -> NormaliseStepper ev -> NormaliseStepper ev Source #

Try one stepper and then try the next, if the first doesn't make progress. So if it returns NS_Done, it means that both steppers are satisfied

decomposeCo :: Arity -> Coercion -> [Role] -> [Coercion] Source #

This breaks a `Coercion` with type `T A B C ~ T D E F` into a list of `Coercion`s of kinds `A ~ D`, `B ~ E` and `E ~ F`. Hence:

    decomposeCo 3 c [r1, r2, r3] = [nth r1 0 c, nth r2 1 c, nth r3 2 c]

decomposeFunCo :: HasDebugCallStack => Role -> Coercion -> (CoercionN, Coercion, Coercion) Source #

downgradeRole :: Role -> Role -> Coercion -> Coercion Source #

Like `downgradeRole_maybe`, but panics if the change isn't a downgrade. See Note [Role twiddling functions]

emptyLiftingContext :: InScopeSet -> LiftingContext Source #

eqCoercion :: Coercion -> Coercion -> Bool Source #

Syntactic equality of coercions

eqCoercionX :: RnEnv2 -> Coercion -> Coercion -> Bool Source #

Compare two `Coercion`s, with respect to an RnEnv2

etaExpandCoAxBranch :: CoAxBranch -> ([TyVar], [Type], Type) Source #

extendLiftingContext Source #

Arguments

:: LiftingContext | original LC
-> TyCoVar | new variable to map...
-> Coercion | ...to this lifted version
-> LiftingContext |

Extend a lifting context with a new mapping.

extendLiftingContextAndInScope Source #

Arguments

:: LiftingContext | Original LC
-> TyCoVar | new variable to map...
-> Coercion | to this coercion
-> LiftingContext |

Extend a lifting context with a new mapping, and extend the in-scope set

getCoVar_maybe :: Coercion -> Maybe CoVar Source #

Attempts to obtain the type variable underlying a `Coercion`

hasCoercionHoleCo :: Coercion -> Bool Source #

Is there a coercion hole in this coercion?

hasCoercionHoleTy :: Type -> Bool Source #

Is there a coercion hole in this type?

instNewTyCon_maybe :: TyCon -> [Type] -> Maybe (Type, Coercion) Source #

If `co :: T ts ~ rep_ty` then:

    instNewTyCon_maybe T ts = Just (rep_ty, co)

Checks for a newtype, and for being saturated

isCoVar_maybe :: Coercion -> Maybe CoVar Source #

Extract a covar, if possible. This check is dirty. Be ashamed of yourself. (It's dirty because it cares about the structure of a coercion, which is morally reprehensible.)

isGReflCo_maybe :: Coercion -> Maybe (Type, Role) Source #

Returns the type coerced if this coercion is a generalized reflexive coercion. Guaranteed to work very quickly.

isGReflMCo :: MCoercion -> Bool Source #

Tests if this MCoercion is obviously generalized reflexive Guaranteed to work very quickly.

isMappedByLC :: TyCoVar -> LiftingContext -> Bool Source #

Is a var in the domain of a lifting context?

isReflCoVar_maybe :: Var -> Maybe Coercion Source #

isReflCo_maybe :: Coercion -> Maybe (Type, Role) Source #

Returns the type coerced if this coercion is reflexive. Guaranteed to work very quickly. Sometimes a coercion can be reflexive, but not obviously so. c.f. `isReflexiveCo_maybe`

isReflMCo :: MCoercion -> Bool Source #

isReflexiveCo_maybe :: Coercion -> Maybe (Type, Role) Source #

Extracts the coerced type from a reflexive coercion. This potentially walks over the entire coercion, so avoid doing this in a loop.

lcInScopeSet :: LiftingContext -> InScopeSet Source #

Get the `InScopeSet` from a `LiftingContext`

lcSubstLeft :: LiftingContext -> TCvSubst Source #

lcSubstRight :: LiftingContext -> TCvSubst Source #

lcTCvSubst :: LiftingContext -> TCvSubst Source #

Extract the underlying substitution from the LiftingContext

liftCoSubstTyVar :: LiftingContext -> Role -> TyVar -> Maybe Coercion Source #

liftCoSubstVarBndrUsing :: (LiftingContext -> Type -> (CoercionN, a)) -> LiftingContext -> TyCoVar -> (LiftingContext, TyCoVar, CoercionN, a) Source #

liftCoSubstWith :: Role -> [TyCoVar] -> [Coercion] -> Type -> Coercion Source #

liftCoSubstWithEx :: Role -> [TyVar] -> [Coercion] -> [TyCoVar] -> [Type] -> (Type -> Coercion, [Type]) Source #

liftEnvSubstLeft :: TCvSubst -> LiftCoEnv -> TCvSubst Source #

liftEnvSubstRight :: TCvSubst -> LiftCoEnv -> TCvSubst Source #

ltRole :: Role -> Role -> Bool Source #

mapStepResult :: (ev1 -> ev2) -> NormaliseStepResult ev1 -> NormaliseStepResult ev2 Source #

mkAppCos :: Coercion -> [Coercion] -> Coercion Source #

Applies multiple `Coercion`s to another `Coercion`, from left to right. See also `mkAppCo`.

mkAxInstCo :: Role -> CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Coercion Source #

mkAxInstLHS :: CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type Source #

Return the left-hand type of the axiom, when the axiom is instantiated at the types given.

mkAxInstRHS :: CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type Source #

mkCastTyMCo :: Type -> MCoercion -> Type Source #

Cast a type by an `MCoercion`

mkCoCast :: Coercion -> CoercionR -> Coercion Source #

mkCoVarCos :: [CoVar] -> [Coercion] Source #

mkCoherenceLeftCo :: Role -> Type -> CoercionN -> Coercion -> Coercion Source #

Given `ty :: k1`, `co :: k1 ~ k2`, `co2:: ty ~r ty'`, produces @co' :: (ty |> co) ~r ty' It is not only a utility function, but it saves allocation when co is a GRefl coercion.

mkCoherenceRightCo :: Role -> Type -> CoercionN -> Coercion -> Coercion Source #

Given `ty :: k1`, `co :: k1 ~ k2`, `co2:: ty' ~r ty`, produces @co' :: ty' ~r (ty |> co) It is not only a utility function, but it saves allocation when co is a GRefl coercion.

mkCoherenceRightMCo :: Role -> Type -> MCoercionN -> Coercion -> Coercion Source #

Like `mkCoherenceRightCo`, but with an `MCoercion`

mkFamilyTyConAppCo :: TyCon -> [CoercionN] -> CoercionN Source #

Given a family instance `TyCon` and its arg `Coercion`s, return the corresponding family `Coercion`. E.g:

    data family T a
    data instance T (Maybe b) = MkT b

Where the instance `TyCon` is :RTL, so:

    mkFamilyTyConAppCo :RTL (co :: a ~# Int) = T (Maybe a) ~# T (Maybe Int)

cf. `mkFamilyTyConApp`

mkForAllCos :: [(TyCoVar, CoercionN)] -> Coercion -> Coercion Source #

Make nested ForAllCos

mkGReflLeftCo :: Role -> Type -> CoercionN -> Coercion Source #

Given `ty :: k1`, `co :: k1 ~ k2`, produces `co' :: (ty |> co) ~r ty`

mkGReflLeftMCo :: Role -> Type -> MCoercionN -> Coercion Source #

mkGReflRightCo :: Role -> Type -> CoercionN -> Coercion Source #

Given `ty :: k1`, `co :: k1 ~ k2`, produces `co' :: ty ~r (ty |> co)`

mkGReflRightMCo :: Role -> Type -> MCoercionN -> Coercion Source #

mkHeteroCoercionType :: Role -> Kind -> Kind -> Type -> Type -> Type Source #

mkHeteroPrimEqPred :: Kind -> Kind -> Type -> Type -> Type Source #

Creates a primitive type equality predicate with explicit kinds

mkHeteroReprPrimEqPred :: Kind -> Kind -> Type -> Type -> Type Source #

Creates a primitive representational type equality predicate with explicit kinds

mkHoleCo :: CoercionHole -> Coercion Source #

Make a coercion from a coercion hole

mkHomoForAllCos :: [TyCoVar] -> Coercion -> Coercion Source #

Make a Coercion quantified over a type/coercion variable; the variable has the same type in both sides of the coercion

mkNthCoFunCo Source #

Arguments

:: Int | "n"
-> CoercionN | multiplicity coercion
-> Coercion | argument coercion
-> Coercion | result coercion
-> Coercion | nth coercion from a FunCo See Note [Function coercions] If FunCo _ mult arg_co res_co :: (s1:TYPE sk1 :mult-> s2:TYPE sk2) ~ (t1:TYPE tk1 :mult-> t2:TYPE tk2) Then we want to behave as if co was TyConAppCo mult argk_co resk_co arg_co res_co where argk_co :: sk1 ~ tk1 = mkNthCo 0 (mkKindCo arg_co) resk_co :: sk2 ~ tk2 = mkNthCo 0 (mkKindCo res_co) i.e. mkRuntimeRepCo

Extract the nth field of a FunCo

mkPiCo :: Role -> Var -> Coercion -> Coercion Source #

Make a forall `Coercion`, where both types related by the coercion are quantified over the same variable.

mkPiCos :: Role -> [Var] -> Coercion -> Coercion Source #

mkPrimEqPred :: Type -> Type -> Type Source #

Creates a primitive type equality predicate. Invariant: the types are not Coercions

mkPrimEqPredRole :: Role -> Type -> Type -> PredType Source #

Makes a lifted equality predicate at the given role

mkRepReflCo :: Type -> Coercion Source #

Make a representational reflexive coercion

mkReprPrimEqPred :: Type -> Type -> Type Source #

mkSubstLiftingContext :: TCvSubst -> LiftingContext Source #

mkSymMCo :: MCoercion -> MCoercion Source #

Get the reverse of an `MCoercion`

mkTransMCo :: MCoercion -> MCoercion -> MCoercion Source #

Compose two MCoercions via transitivity

mkTransMCoL :: MCoercion -> Coercion -> MCoercion Source #

mkUnbranchedAxInstCo :: Role -> CoAxiom Unbranched -> [Type] -> [Coercion] -> Coercion Source #

mkUnbranchedAxInstLHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type Source #

Instantiate the left-hand side of an unbranched axiom

mkUnbranchedAxInstRHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type Source #

multToCo :: Mult -> Coercion Source #

nthCoRole :: Int -> Coercion -> Role Source #

If you're about to call `mkNthCo r n co`, then `r` should be whatever `nthCoRole n co` returns.

nthRole :: Role -> TyCon -> Int -> Role Source #

pprCoAxBranch :: TyCon -> CoAxBranch -> SDoc Source #

pprCoAxBranchLHS :: TyCon -> CoAxBranch -> SDoc Source #

pprCoAxBranchUser :: TyCon -> CoAxBranch -> SDoc Source #

pprCoAxiom :: CoAxiom br -> SDoc Source #

promoteCoercion :: Coercion -> CoercionN Source #

like mkKindCo, but aggressively & recursively optimizes to avoid using a KindCo constructor. The output role is nominal.

setCoVarName :: CoVar -> Name -> CoVar Source #

setCoVarUnique :: CoVar -> Unique -> CoVar Source #

setNominalRole_maybe :: Role -> Coercion -> Maybe Coercion Source #

Converts a coercion to be nominal, if possible. See Note [Role twiddling functions]

simplifyArgsWorker :: [TyCoBinder] -> Kind -> TyCoVarSet -> [Role] -> [(Type, Coercion)] -> ([Type], [Coercion], MCoercionN) Source #

splitAppCo_maybe :: Coercion -> Maybe (Coercion, Coercion) Source #

Attempt to take a coercion application apart.

splitForAllCo_co_maybe :: Coercion -> Maybe (CoVar, Coercion, Coercion) Source #

Like `splitForAllCo_maybe`, but only returns Just for covar binder

splitForAllCo_maybe :: Coercion -> Maybe (TyCoVar, Coercion, Coercion) Source #

splitForAllCo_ty_maybe :: Coercion -> Maybe (TyVar, Coercion, Coercion) Source #

Like `splitForAllCo_maybe`, but only returns Just for tyvar binder

splitFunCo_maybe :: Coercion -> Maybe (Coercion, Coercion) Source #

splitTyConAppCo_maybe :: Coercion -> Maybe (TyCon, [Coercion]) Source #

Attempts to tease a coercion apart into a type constructor and the application of a number of coercion arguments to that constructor

substForAllCoBndrUsingLC :: Bool -> (Coercion -> Coercion) -> LiftingContext -> TyCoVar -> Coercion -> (LiftingContext, TyCoVar, Coercion) Source #

Like `substForAllCoBndr`, but works on a lifting context

substLeftCo :: LiftingContext -> Coercion -> Coercion Source #

substRightCo :: LiftingContext -> Coercion -> Coercion Source #

swapLiftCoEnv :: LiftCoEnv -> LiftCoEnv Source #

Apply "sym" to all coercions in a `LiftCoEnv`

tidyCoAxBndrsForUser :: TidyEnv -> [Var] -> (TidyEnv, [Var]) Source #

topNormaliseNewType_maybe :: Type -> Maybe (Coercion, Type) Source #

Sometimes we want to look through a `newtype` and get its associated coercion. This function strips off `newtype` layers enough to reveal something that isn't a `newtype`. Specifically, here's the invariant:

    topNormaliseNewType_maybe rec_nts ty = Just (co, ty')

then (a) `co : ty0 ~ ty'`. (b) ty' is not a newtype.

The function returns `Nothing` for non-`newtypes`, or unsaturated applications

This function does *not* look through type families, because it has no access to the type family environment. If you do have that at hand, consider to use topNormaliseType_maybe, which should be a drop-in replacement for topNormaliseNewType_maybe If topNormliseNewType_maybe ty = Just (co, ty'), then co : ty ~R ty'

topNormaliseTypeX :: NormaliseStepper ev -> (ev -> ev -> ev) -> Type -> Maybe (ev, Type) Source #

A general function for normalising the top-level of a type. It continues to use the provided `NormaliseStepper` until that function fails, and then this function returns. The roles of the coercions produced by the `NormaliseStepper` must all be the same, which is the role returned from the call to `topNormaliseTypeX`.

Typically ev is Coercion.

If topNormaliseTypeX step plus ty = Just (ev, ty') then ty ~ev1~ t1 ~ev2~ t2 ... ~evn~ ty' and ev = ev1 `plus` ev2 `plus` ... `plus` evn If it returns Nothing then no newtype unwrapping could happen

tyConRolesRepresentational :: TyCon -> [Role] Source #

tyConRolesX :: Role -> TyCon -> [Role] Source #

unwrapNewTypeStepper :: NormaliseStepper Coercion Source #

A `NormaliseStepper` that unwraps newtypes, careful not to fall into a loop. If it would fall into a loop, it produces `NS_Abort`.

zapLiftingContext :: LiftingContext -> LiftingContext Source #

Erase the environments in a lifting context

type HoleSet = UniqSet CoercionHole Source #

A set of `CoercionHole`s

type LiftCoEnv = VarEnv Coercion Source #

data NormaliseStepResult ev Source #

The result of stepping in a normalisation function. See `topNormaliseTypeX`.

Constructors

NS_Done | Nothing more to do
NS_Abort | Utter failure. The outer function should fail too.
NS_Step RecTcChecker Type ev | We stepped, yielding new bits; ^ ev is evidence; Usually a co :: old type ~ new type

#### Instances

Instances details

Outputable ev => Outputable (NormaliseStepResult ev) Source # |
Instance details Defined in GHC.Core.Coercion Methods ppr :: NormaliseStepResult ev -> SDoc Source #

type NormaliseStepper ev = RecTcChecker -> TyCon -> [Type] -> NormaliseStepResult ev Source #

A function to check if we can reduce a type by one step. Used with `topNormaliseTypeX`.

module GHC.Builtin.Types

module GHC.Driver.Env

module GHC.Types.Basic

module GHC.Types.Var.Set

module GHC.Types.Var.Env

module GHC.Types.Name.Set

module GHC.Types.Name.Env

class Uniquable a where Source #

Class of things that we can obtain a `Unique` from

Methods

getUnique :: a -> Unique Source #

#### Instances

Instances details

Uniquable Label Source # |
Instance details Defined in GHC.Cmm.Dataflow.Label Methods getUnique :: Label -> Unique Source #
Uniquable LocalReg Source # |
Instance details Defined in GHC.Cmm.Expr Methods getUnique :: LocalReg -> Unique Source #
Uniquable Reg Source # | so we can put regs in UniqSets
Instance details Defined in GHC.CmmToAsm.Reg.Graph.Base Methods getUnique :: Reg -> Unique Source #
Uniquable Class Source # |
Instance details Defined in GHC.Core.Class Methods getUnique :: Class -> Unique Source #
Uniquable CoAxiomRule Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getUnique :: CoAxiomRule -> Unique Source #
Uniquable ConLike Source # |
Instance details Defined in GHC.Core.ConLike Methods getUnique :: ConLike -> Unique Source #
Uniquable DataCon Source # |
Instance details Defined in GHC.Core.DataCon Methods getUnique :: DataCon -> Unique Source #
Uniquable PatSyn Source # |
Instance details Defined in GHC.Core.PatSyn Methods getUnique :: PatSyn -> Unique Source #
Uniquable CoercionHole Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods getUnique :: CoercionHole -> Unique Source #
Uniquable TyCon Source # |
Instance details Defined in GHC.Core.TyCon Methods getUnique :: TyCon -> Unique Source #
Uniquable FastString Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: FastString -> Unique Source #
Uniquable RealReg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: RealReg -> Unique Source #
Uniquable Reg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: Reg -> Unique Source #
Uniquable VirtualReg Source # |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: VirtualReg -> Unique Source #
Uniquable RegClass Source # |
Instance details Defined in GHC.Platform.Reg.Class Methods getUnique :: RegClass -> Unique Source #
Uniquable EvBindsVar Source # |
Instance details Defined in GHC.Tc.Types.Evidence Methods getUnique :: EvBindsVar -> Unique Source #
Uniquable Name Source # |
Instance details Defined in GHC.Types.Name Methods getUnique :: Name -> Unique Source #
Uniquable OccName Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: OccName -> Unique Source #
Uniquable Unique Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique Source #
Uniquable Var Source # |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique Source #
Uniquable PackageId Source # |
Instance details Defined in GHC.Unit.Info Methods getUnique :: PackageId -> Unique Source #
Uniquable PackageName Source # |
Instance details Defined in GHC.Unit.Info Methods getUnique :: PackageName -> Unique Source #
Uniquable ModuleName Source # |
Instance details Defined in GHC.Unit.Module.Name Methods getUnique :: ModuleName -> Unique Source #
Uniquable Module Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Module -> Unique Source #
Uniquable UnitId Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: UnitId -> Unique Source #
Uniquable Int Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Int -> Unique Source #
Uniquable (CoAxiom br) Source # |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getUnique :: CoAxiom br -> Unique Source #
Uniquable unit => Uniquable (Definite unit) Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Definite unit -> Unique Source #
IsUnitId u => Uniquable (GenUnit u) Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: GenUnit u -> Unique Source #
Uniquable unit => Uniquable (Indefinite unit) Source # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Indefinite unit -> Unique Source #

data Unique Source #

Unique identifier.

The type of unique identifiers that are used in many places in GHC for fast ordering and equality tests. You should generate these with the functions from the `UniqSupply` module

These are sometimes also referred to as "keys" in comments in GHC.

#### Instances

Instances details

Show Unique Source # |
Instance details Defined in GHC.Types.Unique Methods showsPrec :: Int -> Unique -> ShowS Source # show :: Unique -> String Source # showList :: [Unique] -> ShowS Source #
Uniquable Unique Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique Source #
Outputable Unique Source # |
Instance details Defined in GHC.Types.Unique Methods ppr :: Unique -> SDoc Source #
Eq Unique Source # |
Instance details Defined in GHC.Types.Unique Methods (==) :: Unique -> Unique -> Bool # (/=) :: Unique -> Unique -> Bool #

module GHC.Types.Unique.Set

module GHC.Types.Unique.FM

module GHC.Data.FiniteMap

module GHC.Utils.Misc

module GHC.Serialized

module GHC.Types.SrcLoc

module GHC.Utils.Outputable

module GHC.Utils.Panic

module GHC.Types.Unique.Supply

module GHC.Data.FastString

module GHC.Tc.Errors.Hole.FitTypes

module GHC.Unit.Module.ModGuts

module GHC.Unit.Module.ModSummary

module GHC.Unit.Module.ModIface

module GHC.Types.Meta

module GHC.Types.SourceError

# Getting `Name`s

thNameToGhcName :: Name -> CoreM (Maybe Name) Source #

Attempt to convert a Template Haskell name to one that GHC can understand. Original TH names such as those you get when you use the `'foo` syntax will be translated to their equivalent GHC name exactly. Qualified or unqualified TH names will be dynamically bound to names in the module being compiled, if possible. Exact TH names will be bound to the name they represent, exactly.

# Orphan instances

MonadThings CoreM Source # |
Instance details Methods lookupThing :: Name -> CoreM TyThing Source # lookupId :: Name -> CoreM Id Source # lookupDataCon :: Name -> CoreM DataCon Source # lookupTyCon :: Name -> CoreM TyCon Source #