GHC.Plugins

ghc-9.10.0.20240413: The GHC API

Safe Haskell | None
Language | GHC2021

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
- data NameSpace
- data OccName
- mkOccName :: NameSpace -> String -> OccName
- isSymOcc :: OccName -> Bool
- tcName :: NameSpace
- clsName :: NameSpace
- dataName :: NameSpace
- fieldName :: FastString -> NameSpace
- type FastStringEnv a = UniqFM FastString a
- mkFsEnv :: [(FastString, a)] -> FastStringEnv a
- emptyFsEnv :: FastStringEnv a
- extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
- lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
- tcClsName :: NameSpace
- tvName :: NameSpace
- mkVarOccFS :: FastString -> OccName
- srcDataName :: NameSpace
- pprNameSpace :: NameSpace -> SDoc
- pprNonVarNameSpace :: NameSpace -> SDoc
- pprNameSpaceBrief :: NameSpace -> SDoc
- pprOccName :: IsLine doc => OccName -> doc
- occNameMangledFS :: OccName -> FastString
- mkOccNameFS :: NameSpace -> FastString -> OccName
- mkVarOcc :: String -> OccName
- mkRecFieldOcc :: FastString -> String -> OccName
- mkRecFieldOccFS :: FastString -> FastString -> OccName
- mkDataOcc :: String -> OccName
- mkDataOccFS :: FastString -> OccName
- mkTyVarOcc :: String -> OccName
- mkTyVarOccFS :: FastString -> OccName
- mkTcOcc :: String -> OccName
- mkTcOccFS :: FastString -> OccName
- mkClsOcc :: String -> OccName
- mkClsOccFS :: FastString -> OccName
- mkDFunOcc :: String -> Bool -> OccSet -> OccName
- setOccNameSpace :: NameSpace -> OccName -> OccName
- demoteOccName :: OccName -> Maybe OccName
- demoteOccTvName :: OccName -> Maybe OccName
- promoteOccName :: OccName -> Maybe OccName
- varToRecFieldOcc :: HasDebugCallStack => FastString -> OccName -> OccName
- recFieldToVarOcc :: HasDebugCallStack => OccName -> OccName
- class HasOccName name where
  - occName :: name -> OccName
- isDerivedOccName :: OccName -> Bool
- mkDataConWrapperOcc :: OccName -> OccName
- mkWorkerOcc :: OccName -> OccName
- mkMatcherOcc :: OccName -> OccName
- mkBuilderOcc :: OccName -> OccName
- mkDefaultMethodOcc :: OccName -> OccName
- isDefaultMethodOcc :: OccName -> Bool
- isTypeableBindOcc :: OccName -> Bool
- mkNewTyCoOcc :: OccName -> OccName
- mkClassOpAuxOcc :: OccName -> OccName
- mkCon2TagOcc :: OccName -> OccName
- mkTag2ConOcc :: OccName -> OccName
- mkMaxTagOcc :: OccName -> OccName
- mkClassDataConOcc :: OccName -> OccName
- mkDictOcc :: OccName -> OccName
- mkIPOcc :: OccName -> OccName
- mkSpecOcc :: OccName -> OccName
- mkForeignExportOcc :: OccName -> OccName
- mkRepEqOcc :: OccName -> OccName
- mkGenR :: OccName -> OccName
- mkGen1R :: OccName -> OccName
- mkDataTOcc :: OccName -> OccName
- mkDataCOcc :: OccName -> OccName
- mkDataConWorkerOcc :: OccName -> OccName
- mkSuperDictSelOcc :: Int -> OccName -> OccName
- mkSuperDictAuxOcc :: Int -> OccName -> OccName
- mkLocalOcc :: Unique -> OccName -> OccName
- mkMethodOcc :: OccName -> OccName
- mkInstTyTcOcc :: String -> OccSet -> OccName
- mkInstTyCoOcc :: OccName -> OccName
- mkEqPredCoOcc :: OccName -> OccName
- mkTyConRepOcc :: OccName -> OccName
- occNameString :: OccName -> String
- isVarOcc :: OccName -> Bool
- isTvOcc :: OccName -> Bool
- isTcOcc :: OccName -> Bool
- isDataOcc :: OccName -> Bool
- isDataSymOcc :: OccName -> Bool
- isValOcc :: OccName -> Bool
- isFieldOcc :: OccName -> Bool
- fieldOcc_maybe :: OccName -> Maybe FastString
- parenSymOcc :: OccName -> SDoc -> SDoc
- startsWithUnderscore :: OccName -> Bool
- isUnderscore :: OccName -> Bool
- isTcClsNameSpace :: NameSpace -> Bool
- isTvNameSpace :: NameSpace -> Bool
- isDataConNameSpace :: NameSpace -> Bool
- isVarNameSpace :: NameSpace -> Bool
- isValNameSpace :: NameSpace -> Bool
- isFieldNameSpace :: NameSpace -> Bool
- isTermVarOrFieldNameSpace :: NameSpace -> Bool
- data OccEnv a
- emptyOccEnv :: OccEnv a
- unitOccEnv :: OccName -> a -> OccEnv a
- extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a
- mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
- strictMapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
- mapMaybeOccEnv :: (a -> Maybe b) -> OccEnv a -> OccEnv b
- lookupOccEnv :: OccEnv a -> OccName -> Maybe a
- lookupOccEnv_AllNameSpaces :: OccEnv a -> OccName -> [a]
- lookupOccEnv_WithFields :: OccEnv a -> OccName -> [a]
- lookupFieldsOccEnv :: OccEnv a -> FastString -> [a]
- mkOccEnv :: [(OccName, a)] -> OccEnv a
- mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a
- extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a
- elemOccEnv :: OccName -> OccEnv a -> Bool
- nonDetOccEnvElts :: OccEnv a -> [a]
- nonDetFoldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b
- plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a
- plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a
- extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b
- filterOccEnv :: (a -> Bool) -> OccEnv a -> OccEnv a
- delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a
- delFromOccEnv :: OccEnv a -> OccName -> OccEnv a
- alterOccEnv :: (Maybe a -> Maybe a) -> OccEnv a -> OccName -> OccEnv a
- minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a
- minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a
- minusOccEnv_C_Ns :: (UniqFM NameSpace a -> UniqFM NameSpace b -> UniqFM NameSpace a) -> OccEnv a -> OccEnv b -> OccEnv a
- pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc
- forceOccEnv :: (a -> ()) -> OccEnv a -> ()
- intersectOccEnv_C :: (a -> b -> c) -> OccEnv a -> OccEnv b -> OccEnv c
- data OccSet
- emptyOccSet :: OccSet
- unitOccSet :: OccName -> OccSet
- mkOccSet :: [OccName] -> OccSet
- extendOccSet :: OccSet -> OccName -> OccSet
- extendOccSetList :: OccSet -> [OccName] -> OccSet
- unionOccSets :: OccSet -> OccSet -> OccSet
- unionManyOccSets :: [OccSet] -> OccSet
- elemOccSet :: OccName -> OccSet -> Bool
- isEmptyOccSet :: OccSet -> Bool
- mainOcc :: OccName
- ppMainFn :: OccName -> SDoc
- type TidyOccEnv = UniqFM FastString Int
- emptyTidyOccEnv :: TidyOccEnv
- initTidyOccEnv :: [OccName] -> TidyOccEnv
- tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)
- avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
- delTidyOccEnvList :: TidyOccEnv -> [FastString] -> TidyOccEnv
- data Name
- data NameSpace
- data OccName
- mkOccName :: NameSpace -> String -> OccName
- nameModule :: HasDebugCallStack => Name -> Module
- pprName :: IsLine doc => Name -> doc
- isSymOcc :: OccName -> Bool
- isExternalName :: Name -> Bool
- nameSrcSpan :: Name -> SrcSpan
- class NamedThing a where
  - getOccName :: a -> OccName
  - getName :: a -> Name
- tcName :: NameSpace
- clsName :: NameSpace
- dataName :: NameSpace
- fieldName :: FastString -> NameSpace
- data BuiltInSyntax
  - = BuiltInSyntax
  - | UserSyntax
- nameOccName :: Name -> OccName
- mkSystemVarName :: Unique -> FastString -> Name
- getOccFS :: NamedThing a => a -> FastString
- pprInfixName :: (Outputable a, NamedThing a) => a -> SDoc
- pprPrefixName :: NamedThing a => a -> SDoc
- nameIsLocalOrFrom :: Module -> Name -> Bool
- tidyNameOcc :: Name -> OccName -> Name
- mkSysTvName :: Unique -> FastString -> Name
- nameModule_maybe :: Name -> Maybe Module
- isInternalName :: Name -> Bool
- type FastStringEnv a = UniqFM FastString a
- mkFsEnv :: [(FastString, a)] -> FastStringEnv a
- emptyFsEnv :: FastStringEnv a
- extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
- lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
- nameUnique :: Name -> Unique
- tcClsName :: NameSpace
- tvName :: NameSpace
- mkVarOccFS :: FastString -> OccName
- getSrcLoc :: NamedThing a => a -> SrcLoc
- isDynLinkName :: Platform -> Module -> Name -> Bool
- getSrcSpan :: NamedThing a => a -> SrcSpan
- mkSystemName :: Unique -> OccName -> Name
- mkSystemNameAt :: Unique -> OccName -> SrcSpan -> Name
- mkInternalName :: Unique -> OccName -> SrcSpan -> Name
- mkClonedInternalName :: Unique -> Name -> Name
- mkDerivedInternalName :: (OccName -> OccName) -> Unique -> Name -> Name
- mkFCallName :: Unique -> FastString -> Name
- mkExternalName :: Unique -> Module -> OccName -> SrcSpan -> Name
- mkWiredInName :: Module -> OccName -> Unique -> TyThing -> BuiltInSyntax -> Name
- setNameUnique :: Name -> Unique -> Name
- nameNameSpace :: Name -> NameSpace
- setNameLoc :: Name -> SrcSpan -> Name
- localiseName :: Name -> Name
- namePun_maybe :: Name -> Maybe FastString
- nameSrcLoc :: Name -> SrcLoc
- pprNameDefnLoc :: Name -> SDoc
- pprDefinedAt :: Name -> SDoc
- pprFullName :: Module -> Name -> SDoc
- pprTickyName :: Module -> Name -> SDoc
- isSystemName :: Name -> Bool
- isTyVarName :: Name -> Bool
- isTyConName :: Name -> Bool
- isDataConName :: Name -> Bool
- isValName :: Name -> Bool
- isVarName :: Name -> Bool
- isFieldName :: Name -> Bool
- isWiredInName :: Name -> Bool
- isWiredIn :: NamedThing thing => thing -> Bool
- isBuiltInSyntax :: Name -> Bool
- isTupleTyConName :: Name -> Bool
- isSumTyConName :: Name -> Bool
- isUnboxedTupleDataConLikeName :: Name -> Bool
- isHoleName :: Name -> Bool
- wiredInNameTyThing_maybe :: Name -> Maybe TyThing
- nameIsExternalOrFrom :: Module -> Name -> Bool
- nameIsHomePackage :: Module -> Name -> Bool
- nameIsHomePackageImport :: Module -> Name -> Bool
- nameIsFromExternalPackage :: HomeUnit -> Name -> Bool
- stableNameCmp :: Name -> Name -> Ordering
- getOccString :: NamedThing a => a -> String
- pprModulePrefix :: PprStyle -> Module -> OccName -> SDoc
- pprNameUnqualified :: Name -> SDoc
- nameStableString :: Name -> String
- srcDataName :: NameSpace
- pprNameSpace :: NameSpace -> SDoc
- pprNonVarNameSpace :: NameSpace -> SDoc
- pprNameSpaceBrief :: NameSpace -> SDoc
- pprOccName :: IsLine doc => OccName -> doc
- occNameMangledFS :: OccName -> FastString
- mkOccNameFS :: NameSpace -> FastString -> OccName
- mkVarOcc :: String -> OccName
- mkRecFieldOcc :: FastString -> String -> OccName
- mkRecFieldOccFS :: FastString -> FastString -> OccName
- mkDataOcc :: String -> OccName
- mkDataOccFS :: FastString -> OccName
- mkTyVarOcc :: String -> OccName
- mkTyVarOccFS :: FastString -> OccName
- mkTcOcc :: String -> OccName
- mkTcOccFS :: FastString -> OccName
- mkClsOcc :: String -> OccName
- mkClsOccFS :: FastString -> OccName
- mkDFunOcc :: String -> Bool -> OccSet -> OccName
- setOccNameSpace :: NameSpace -> OccName -> OccName
- demoteOccName :: OccName -> Maybe OccName
- demoteOccTvName :: OccName -> Maybe OccName
- promoteOccName :: OccName -> Maybe OccName
- varToRecFieldOcc :: HasDebugCallStack => FastString -> OccName -> OccName
- recFieldToVarOcc :: HasDebugCallStack => OccName -> OccName
- class HasOccName name where
  - occName :: name -> OccName
- isDerivedOccName :: OccName -> Bool
- mkDataConWrapperOcc :: OccName -> OccName
- mkWorkerOcc :: OccName -> OccName
- mkMatcherOcc :: OccName -> OccName
- mkBuilderOcc :: OccName -> OccName
- mkDefaultMethodOcc :: OccName -> OccName
- isDefaultMethodOcc :: OccName -> Bool
- isTypeableBindOcc :: OccName -> Bool
- mkNewTyCoOcc :: OccName -> OccName
- mkClassOpAuxOcc :: OccName -> OccName
- mkCon2TagOcc :: OccName -> OccName
- mkTag2ConOcc :: OccName -> OccName
- mkMaxTagOcc :: OccName -> OccName
- mkClassDataConOcc :: OccName -> OccName
- mkDictOcc :: OccName -> OccName
- mkIPOcc :: OccName -> OccName
- mkSpecOcc :: OccName -> OccName
- mkForeignExportOcc :: OccName -> OccName
- mkRepEqOcc :: OccName -> OccName
- mkGenR :: OccName -> OccName
- mkGen1R :: OccName -> OccName
- mkDataTOcc :: OccName -> OccName
- mkDataCOcc :: OccName -> OccName
- mkDataConWorkerOcc :: OccName -> OccName
- mkSuperDictSelOcc :: Int -> OccName -> OccName
- mkSuperDictAuxOcc :: Int -> OccName -> OccName
- mkLocalOcc :: Unique -> OccName -> OccName
- mkMethodOcc :: OccName -> OccName
- mkInstTyTcOcc :: String -> OccSet -> OccName
- mkInstTyCoOcc :: OccName -> OccName
- mkEqPredCoOcc :: OccName -> OccName
- mkTyConRepOcc :: OccName -> OccName
- occNameString :: OccName -> String
- isVarOcc :: OccName -> Bool
- isTvOcc :: OccName -> Bool
- isTcOcc :: OccName -> Bool
- isDataOcc :: OccName -> Bool
- isDataSymOcc :: OccName -> Bool
- isValOcc :: OccName -> Bool
- isFieldOcc :: OccName -> Bool
- fieldOcc_maybe :: OccName -> Maybe FastString
- parenSymOcc :: OccName -> SDoc -> SDoc
- startsWithUnderscore :: OccName -> Bool
- isUnderscore :: OccName -> Bool
- isTcClsNameSpace :: NameSpace -> Bool
- isTvNameSpace :: NameSpace -> Bool
- isDataConNameSpace :: NameSpace -> Bool
- isVarNameSpace :: NameSpace -> Bool
- isValNameSpace :: NameSpace -> Bool
- isFieldNameSpace :: NameSpace -> Bool
- isTermVarOrFieldNameSpace :: NameSpace -> Bool
- data OccEnv a
- emptyOccEnv :: OccEnv a
- unitOccEnv :: OccName -> a -> OccEnv a
- extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a
- mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
- strictMapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
- mapMaybeOccEnv :: (a -> Maybe b) -> OccEnv a -> OccEnv b
- lookupOccEnv :: OccEnv a -> OccName -> Maybe a
- lookupOccEnv_AllNameSpaces :: OccEnv a -> OccName -> [a]
- lookupOccEnv_WithFields :: OccEnv a -> OccName -> [a]
- lookupFieldsOccEnv :: OccEnv a -> FastString -> [a]
- mkOccEnv :: [(OccName, a)] -> OccEnv a
- mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a
- extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a
- elemOccEnv :: OccName -> OccEnv a -> Bool
- nonDetOccEnvElts :: OccEnv a -> [a]
- nonDetFoldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b
- plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a
- plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a
- extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b
- filterOccEnv :: (a -> Bool) -> OccEnv a -> OccEnv a
- delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a
- delFromOccEnv :: OccEnv a -> OccName -> OccEnv a
- alterOccEnv :: (Maybe a -> Maybe a) -> OccEnv a -> OccName -> OccEnv a
- minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a
- minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a
- minusOccEnv_C_Ns :: (UniqFM NameSpace a -> UniqFM NameSpace b -> UniqFM NameSpace a) -> OccEnv a -> OccEnv b -> OccEnv a
- pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc
- forceOccEnv :: (a -> ()) -> OccEnv a -> ()
- intersectOccEnv_C :: (a -> b -> c) -> OccEnv a -> OccEnv b -> OccEnv c
- data OccSet
- emptyOccSet :: OccSet
- unitOccSet :: OccName -> OccSet
- mkOccSet :: [OccName] -> OccSet
- extendOccSet :: OccSet -> OccName -> OccSet
- extendOccSetList :: OccSet -> [OccName] -> OccSet
- unionOccSets :: OccSet -> OccSet -> OccSet
- unionManyOccSets :: [OccSet] -> OccSet
- elemOccSet :: OccName -> OccSet -> Bool
- isEmptyOccSet :: OccSet -> Bool
- mainOcc :: OccName
- ppMainFn :: OccName -> SDoc
- type TidyOccEnv = UniqFM FastString Int
- emptyTidyOccEnv :: TidyOccEnv
- initTidyOccEnv :: [OccName] -> TidyOccEnv
- tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)
- avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
- delTidyOccEnvList :: TidyOccEnv -> [FastString] -> TidyOccEnv
- module GHC.Types.Var
- type Id = Var
- idType :: Id -> Kind
- isImplicitId :: Id -> Bool
- isDeadBinder :: Id -> Bool
- isExportedId :: Var -> Bool
- isLocalId :: Var -> Bool
- isGlobalId :: Var -> Bool
- isRecordSelector :: Id -> Bool
- isPrimOpId :: Id -> Bool
- isFCallId :: Id -> Bool
- isClassOpId_maybe :: Id -> Maybe Class
- isDataConWorkId :: Id -> Bool
- idDataCon :: Id -> DataCon
- isDeadEndId :: Var -> Bool
- recordSelectorTyCon :: Id -> RecSelParent
- data Var
- type InId = Id
- type InVar = Var
- type OutId = Id
- type OutVar = Var
- isId :: Var -> Bool
- type IdUnfoldingFun = Id -> Unfolding
- idHasRules :: Id -> Bool
- zapStableUnfolding :: Id -> Id
- idInlineActivation :: Id -> Activation
- setInlineActivation :: Id -> Activation -> Id
- zapIdOccInfo :: Id -> Id
- zapIdUsageInfo :: Id -> Id
- idInlinePragma :: Id -> InlinePragma
- isJoinId :: Var -> Bool
- idJoinPointHood :: Var -> JoinPointHood
- idUnfolding :: IdUnfoldingFun
- data JoinPointHood
- mkSysLocalOrCoVarM :: MonadUnique m => FastString -> Mult -> Type -> m Id
- idInfo :: HasDebugCallStack => Id -> IdInfo
- isDataConId_maybe :: Id -> Maybe DataCon
- mkLocalId :: HasDebugCallStack => Name -> Mult -> Type -> Id
- idName :: Id -> Name
- setInlinePragma :: Id -> InlinePragma -> Id
- realIdUnfolding :: Id -> Unfolding
- mkTemplateLocals :: [Type] -> [Id]
- idScaledType :: Id -> Scaled Type
- mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkVanillaGlobal :: Name -> Type -> Id
- mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id
- mkLocalCoVar :: Name -> Type -> CoVar
- mkLocalIdOrCoVar :: Name -> Mult -> Type -> Id
- mkLocalIdWithInfo :: HasDebugCallStack => Name -> Mult -> Type -> IdInfo -> Id
- mkExportedLocalId :: IdDetails -> Name -> Type -> Id
- mkExportedVanillaId :: Name -> Type -> Id
- mkSysLocal :: FastString -> Unique -> Mult -> Type -> Id
- mkSysLocalM :: MonadUnique m => FastString -> Mult -> Type -> m Id
- mkSysLocalOrCoVar :: FastString -> Unique -> Mult -> Type -> Id
- mkUserLocal :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id
- mkUserLocalOrCoVar :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id
- mkTemplateLocalsNum :: Int -> [Type] -> [Id]
- mkTemplateLocal :: Int -> Type -> Id
- mkScaledTemplateLocal :: Int -> Scaled Type -> Id
- mkWorkerId :: Unique -> Id -> Type -> Id
- idMult :: Id -> Mult
- idUnique :: Id -> Unique
- idDetails :: Id -> IdDetails
- recordSelectorTyCon_maybe :: Id -> Maybe RecSelParent
- setIdName :: Id -> Name -> Id
- setIdUnique :: Id -> Unique -> Id
- setIdMult :: Id -> Mult -> Id
- updateIdTypeButNotMult :: (Type -> Type) -> Id -> Id
- updateIdTypeAndMult :: (Type -> Type) -> Id -> Id
- updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m Id
- globaliseId :: Id -> Id
- localiseId :: Id -> Id
- setIdInfo :: Id -> IdInfo -> Id
- modifyIdInfo :: HasDebugCallStack => (IdInfo -> IdInfo) -> Id -> Id
- maybeModifyIdInfo :: Maybe IdInfo -> Id -> Id
- zapLamIdInfo :: Id -> Id
- zapIdDemandInfo :: Id -> Id
- zapIdUsageEnvInfo :: Id -> Id
- zapIdUsedOnceInfo :: Id -> Id
- zapIdTailCallInfo :: Id -> Id
- zapFragileIdInfo :: Id -> Id
- zapIdDmdSig :: Id -> Id
- transferPolyIdInfo :: Id -> [Var] -> Id -> Id
- scaleIdBy :: Mult -> Id -> Id
- scaleVarBy :: Mult -> Var -> Var
- isStrictId :: Id -> Bool
- isNaughtyRecordSelector :: Id -> Bool
- isPatSynRecordSelector :: Id -> Bool
- isDataConRecordSelector :: Id -> Bool
- isClassOpId :: Id -> Bool
- isDFunId :: Id -> Bool
- isPrimOpId_maybe :: Id -> Maybe PrimOp
- isFCallId_maybe :: Id -> Maybe ForeignCall
- isDataConWorkId_maybe :: Id -> Maybe DataCon
- isDataConWrapId :: Id -> Bool
- isDataConWrapId_maybe :: Id -> Maybe DataCon
- isConLikeId :: Id -> Bool
- isWorkerLikeId :: Id -> Bool
- idIsFrom :: Module -> Id -> Bool
- hasNoBinding :: Id -> Bool
- type JoinId = Id
- idJoinArity :: JoinId -> JoinArity
- asJoinId :: Id -> JoinArity -> JoinId
- asJoinId_maybe :: Id -> JoinPointHood -> Id
- zapJoinId :: Id -> Id
- modifyInlinePragma :: Id -> (InlinePragma -> InlinePragma) -> Id
- idRuleMatchInfo :: Id -> RuleMatchInfo
- setOneShotLambda :: Id -> Id
- clearOneShotLambda :: Id -> Id
- updOneShotInfo :: Id -> OneShotInfo -> Id
- setIdOneShotInfo :: Id -> OneShotInfo -> Id
- idArity :: Id -> Arity
- idCallArity :: Id -> Arity
- idFunRepArity :: Id -> RepArity
- idSpecialisation :: Id -> RuleInfo
- idCoreRules :: Id -> [CoreRule]
- idCafInfo :: Id -> CafInfo
- idLFInfo_maybe :: Id -> Maybe LambdaFormInfo
- idOneShotInfo :: Id -> OneShotInfo
- idOccInfo :: Id -> OccInfo
- alwaysActiveUnfoldingFun :: IdUnfoldingFun
- whenActiveUnfoldingFun :: (Activation -> Bool) -> IdUnfoldingFun
- noUnfoldingFun :: IdUnfoldingFun
- setIdUnfolding :: Id -> Unfolding -> Id
- zapIdUnfolding :: Id -> Id
- setCaseBndrEvald :: StrictnessMark -> Id -> Id
- setIdArity :: Id -> Arity -> Id
- setIdCallArity :: Id -> Arity -> Id
- setIdSpecialisation :: Id -> RuleInfo -> Id
- setIdCafInfo :: Id -> CafInfo -> Id
- setIdOccInfo :: Id -> OccInfo -> Id
- setIdLFInfo :: Id -> LambdaFormInfo -> Id
- setIdDemandInfo :: Id -> Demand -> Id
- setIdDmdSig :: Id -> DmdSig -> Id
- setIdCprSig :: Id -> CprSig -> Id
- setIdCbvMarks :: Id -> [CbvMark] -> Id
- idCbvMarks_maybe :: Id -> Maybe [CbvMark]
- idCbvMarkArity :: Id -> Arity
- asWorkerLikeId :: Id -> Id
- asNonWorkerLikeId :: Id -> Id
- idDemandInfo :: Id -> Demand
- idDmdSig :: Id -> DmdSig
- idCprSig :: Id -> CprSig
- idTagSig_maybe :: Id -> Maybe TagSig
- setIdTagSig :: Id -> TagSig -> Id
- setIdType :: Id -> Type -> Id
- module GHC.Types.Id.Info
- module GHC.Types.PkgQual
- module GHC.Core.Opt.Monad
- module GHC.Core.Opt.Pipeline.Types
- module GHC.Core.Opt.Stats
- 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
- substCo :: HasDebugCallStack => Subst -> Coercion -> Coercion
- data Subst = Subst InScopeSet IdSubstEnv TvSubstEnv CvSubstEnv
- extendIdSubst :: Subst -> Id -> CoreExpr -> Subst
- extendTvSubst :: Subst -> TyVar -> Type -> Subst
- zapSubst :: Subst -> Subst
- substTickish :: Subst -> CoreTickish -> CoreTickish
- extendTvSubstList :: Subst -> [(TyVar, Type)] -> Subst
- isInScope :: Var -> Subst -> Bool
- type TvSubstEnv = TyVarEnv Type
- type IdSubstEnv = IdEnv CoreExpr
- deShadowBinds :: CoreProgram -> CoreProgram
- substRuleInfo :: Subst -> Id -> RuleInfo -> RuleInfo
- substRulesForImportedIds :: Subst -> [CoreRule] -> [CoreRule]
- substTyUnchecked :: Subst -> Type -> Type
- substExpr :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr
- substExprSC :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr
- substBind :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind)
- substBindSC :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind)
- substUnfolding :: Subst -> Unfolding -> Unfolding
- substUnfoldingSC :: Subst -> Unfolding -> Unfolding
- lookupIdSubst :: HasDebugCallStack => Subst -> Id -> CoreExpr
- lookupIdSubst_maybe :: HasDebugCallStack => Subst -> Id -> Maybe CoreExpr
- substIdType :: Subst -> Id -> Id
- substIdOcc :: Subst -> Id -> Id
- substDVarSet :: HasDebugCallStack => Subst -> DVarSet -> DVarSet
- substIdInfo :: Subst -> Id -> IdInfo -> Maybe IdInfo
- emptySubst :: Subst
- mkEmptySubst :: InScopeSet -> Subst
- mkTCvSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> Subst
- mkOpenSubst :: InScopeSet -> [(Var, CoreArg)] -> Subst
- isEmptySubst :: Subst -> Bool
- extendIdSubstList :: Subst -> [(Id, CoreExpr)] -> Subst
- extendTCvSubst :: Subst -> TyCoVar -> Type -> Subst
- extendIdSubstWithClone :: Subst -> Id -> Id -> Subst
- extendSubst :: Subst -> Var -> CoreArg -> Subst
- extendSubstList :: Subst -> [(Var, CoreArg)] -> Subst
- extendSubstWithVar :: Subst -> Var -> Var -> Subst
- extendSubstInScope :: Subst -> Var -> Subst
- extendSubstInScopeList :: Subst -> [Var] -> Subst
- setInScope :: Subst -> InScopeSet -> Subst
- getSubstInScope :: Subst -> InScopeSet
- delBndr :: Subst -> Var -> Subst
- delBndrs :: Subst -> [Var] -> Subst
- substBndr :: Subst -> Var -> (Subst, Var)
- substBndrs :: Traversable f => Subst -> f Var -> (Subst, f Var)
- substRecBndrs :: Traversable f => Subst -> f Id -> (Subst, f Id)
- cloneBndr :: Subst -> Unique -> Var -> (Subst, Var)
- cloneBndrs :: MonadUnique m => Subst -> [Var] -> m (Subst, [Var])
- cloneIdBndr :: Subst -> UniqSupply -> Id -> (Subst, Id)
- cloneIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id])
- cloneRecIdBndrs :: MonadUnique m => Subst -> [Id] -> m (Subst, [Id])
- module GHC.Core.Rules
- module GHC.Types.Annotations
- module GHC.Driver.Session
- module GHC.Driver.Ppr
- module GHC.Unit.State
- module GHC.Unit.Module
- module GHC.Unit.Home
- data Type
- funResultTy :: HasDebugCallStack => Type -> Type
- mkFunTy :: HasDebugCallStack => FunTyFlag -> Mult -> Type -> Type -> Type
- splitTyConApp :: Type -> (TyCon, [Type])
- isAlgType :: Type -> Bool
- type Kind = Type
- data Specificity
  - = InferredSpec
  - | SpecifiedSpec
- typeKind :: HasDebugCallStack => Type -> Kind
- type TyVar = Var
- splitForAllTyCoVars :: Type -> ([TyCoVar], Type)
- type PredType = Type
- type ThetaType = [PredType]
- data Var
- liftedTypeKind :: Type
- unliftedTypeKind :: Type
- funTyFlagTyCon :: FunTyFlag -> TyCon
- mkTyConApp :: TyCon -> [Type] -> Type
- getLevity :: HasDebugCallStack => Type -> Type
- type TyVarBinder = VarBndr TyVar ForAllTyFlag
- binderVar :: VarBndr tv argf -> tv
- binderVars :: [VarBndr tv argf] -> [tv]
- mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis
- mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis]
- type TyCoVar = Id
- substCo :: HasDebugCallStack => Subst -> Coercion -> Coercion
- extendTvSubstAndInScope :: Subst -> TyVar -> Type -> Subst
- data Subst = Subst InScopeSet IdSubstEnv TvSubstEnv CvSubstEnv
- substTyVarBndr :: HasDebugCallStack => Subst -> TyVar -> (Subst, TyVar)
- type Mult = Type
- pattern OneTy :: Mult
- pattern ManyTy :: Mult
- data Scaled a
- unrestricted :: a -> Scaled a
- linear :: a -> Scaled a
- tymult :: a -> Scaled a
- irrelevantMult :: Scaled a -> a
- mkScaled :: Mult -> a -> Scaled a
- scaledSet :: Scaled a -> b -> Scaled b
- tyConAppArgs :: HasCallStack => Type -> [Type]
- tyCoVarsOfType :: Type -> TyCoVarSet
- mightBeUnliftedType :: Type -> Bool
- closeOverKindsDSet :: DTyVarSet -> DTyVarSet
- typeHasFixedRuntimeRep :: HasDebugCallStack => Type -> Bool
- extendCvSubst :: Subst -> CoVar -> Coercion -> Subst
- substTyVar :: Subst -> TyVar -> Type
- zapSubst :: Subst -> Subst
- data PiTyBinder
- isPredTy :: HasDebugCallStack => Type -> Bool
- getTyVar_maybe :: Type -> Maybe TyVar
- tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type])
- tyVarKind :: TyVar -> Kind
- seqType :: Type -> ()
- isTyVar :: Var -> Bool
- cloneTyVarBndr :: Subst -> TyVar -> Unique -> (Subst, TyVar)
- typeSize :: Type -> Int
- type TvSubstEnv = TyVarEnv Type
- type IdSubstEnv = IdEnv CoreExpr
- substTyUnchecked :: Subst -> Type -> Type
- emptySubst :: Subst
- mkEmptySubst :: InScopeSet -> Subst
- mkTCvSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> Subst
- isEmptySubst :: Subst -> Bool
- extendTCvSubst :: Subst -> TyCoVar -> Type -> Subst
- extendSubstInScope :: Subst -> Var -> Subst
- extendSubstInScopeList :: Subst -> [Var] -> Subst
- extendSubstInScopeSet :: Subst -> VarSet -> Subst
- setInScope :: Subst -> InScopeSet -> Subst
- getSubstInScope :: Subst -> InScopeSet
- coreView :: Type -> Maybe Type
- tcSplitAppTyNoView_maybe :: Type -> Maybe (Type, Type)
- splitAppTyNoView_maybe :: HasDebugCallStack => Type -> Maybe (Type, Type)
- tyCoVarsOfTypes :: [Type] -> TyCoVarSet
- tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
- tyCoFVsBndr :: ForAllTyBinder -> FV -> FV
- tyCoFVsVarBndr :: Var -> FV -> FV
- tyCoFVsVarBndrs :: [Var] -> FV -> FV
- tyCoFVsOfType :: Type -> FV
- coVarsOfType :: Type -> CoVarSet
- coVarsOfTypes :: [Type] -> CoVarSet
- anyFreeVarsOfType :: (TyCoVar -> Bool) -> Type -> Bool
- anyFreeVarsOfTypes :: (TyCoVar -> Bool) -> [Type] -> Bool
- noFreeVarsOfType :: Type -> Bool
- tyConsOfType :: Type -> UniqSet TyCon
- occCheckExpand :: [Var] -> Type -> Maybe Type
- scopedSort :: [TyCoVar] -> [TyCoVar]
- tyCoVarsOfTypeWellScoped :: Type -> [TyVar]
- tyCoVarsOfTypesWellScoped :: [Type] -> [TyVar]
- closeOverKindsList :: [TyVar] -> [TyVar]
- closeOverKinds :: TyCoVarSet -> TyCoVarSet
- partitionInvisibleTypes :: TyCon -> [Type] -> ([Type], [Type])
- rewriterView :: Type -> Maybe Type
- pickyIsLiftedTypeKind :: Kind -> Bool
- splitForAllReqTyBinders :: Type -> ([ReqTyBinder], Type)
- splitForAllInvisTyBinders :: Type -> ([InvisTyBinder], Type)
- type KindOrType = Type
- type RuntimeRepType = Type
- type KnotTied (ty :: k) = ty
- type FRRType = Type
- data ForAllTyFlag where
  - Invisible !Specificity
  - Required
  - pattern Specified :: ForAllTyFlag
  - pattern Inferred :: ForAllTyFlag
- data FunTyFlag
  - = FTF_T_T
  - | FTF_T_C
  - | FTF_C_T
  - | FTF_C_C
- mkTyVarTy :: TyVar -> Type
- mkTyVarTys :: [TyVar] -> [Type]
- mkVisFunTy :: HasDebugCallStack => Mult -> Type -> Type -> Type
- mkScaledFunTys :: HasDebugCallStack => [Scaled Type] -> Type -> Type
- mkInvisFunTy :: HasDebugCallStack => Type -> Type -> Type
- mkInvisFunTys :: HasDebugCallStack => [Type] -> Type -> Type
- tcMkVisFunTy :: Mult -> Type -> Type -> Type
- tcMkInvisFunTy :: TypeOrConstraint -> Type -> Type -> Type
- tcMkScaledFunTys :: [Scaled Type] -> Type -> Type
- mkForAllTy :: ForAllTyBinder -> Type -> Type
- mkForAllTys :: [ForAllTyBinder] -> Type -> Type
- mkInvisForAllTys :: [InvisTVBinder] -> Type -> Type
- mkPiTy :: HasDebugCallStack => PiTyBinder -> Type -> Type
- mkPiTys :: HasDebugCallStack => [PiTyBinder] -> Type -> Type
- mkVisFunTyMany :: HasDebugCallStack => Type -> Type -> Type
- mkVisFunTysMany :: [Type] -> Type -> Type
- 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 -> ForAllTyFlag -> env
  }
- foldTyCo :: Monoid a => TyCoFolder env a -> env -> (Type -> a, [Type] -> a, Coercion -> a, [Coercion] -> a)
- noView :: Type -> Maybe Type
- chooseFunTyFlag :: HasDebugCallStack => Type -> Type -> FunTyFlag
- typeTypeOrConstraint :: HasDebugCallStack => Type -> TypeOrConstraint
- emptyTvSubstEnv :: TvSubstEnv
- composeTCvSubst :: Subst -> Subst -> Subst
- isEmptyTCvSubst :: Subst -> Bool
- getTvSubstEnv :: Subst -> TvSubstEnv
- getSubstRangeTyCoFVs :: Subst -> VarSet
- notElemSubst :: Var -> Subst -> Bool
- extendTCvSubstWithClone :: Subst -> TyCoVar -> TyCoVar -> Subst
- extendTvSubstBinderAndInScope :: Subst -> PiTyBinder -> Type -> Subst
- extendTvSubstWithClone :: Subst -> TyVar -> TyVar -> Subst
- extendTCvSubstList :: Subst -> [Var] -> [Type] -> Subst
- unionSubst :: Subst -> Subst -> Subst
- zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv
- zipCoEnv :: HasDebugCallStack => [CoVar] -> [Coercion] -> CvSubstEnv
- zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> Subst
- zipTCvSubst :: HasDebugCallStack => [TyCoVar] -> [Type] -> Subst
- mkTvSubstPrs :: [(TyVar, Type)] -> Subst
- substTyWith :: HasDebugCallStack => [TyVar] -> [Type] -> Type -> Type
- substTysWith :: HasDebugCallStack => [TyVar] -> [Type] -> [Type] -> [Type]
- substTyAddInScope :: HasDebugCallStack => Subst -> Type -> Type
- substScaledTy :: HasDebugCallStack => Subst -> Scaled Type -> Scaled Type
- substTysUnchecked :: Subst -> [Type] -> [Type]
- substScaledTysUnchecked :: Subst -> [Scaled Type] -> [Scaled Type]
- substThetaUnchecked :: Subst -> ThetaType -> ThetaType
- substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type
- substScaledTyUnchecked :: HasDebugCallStack => Subst -> Scaled Type -> Scaled Type
- substCoUnchecked :: Subst -> Coercion -> Coercion
- substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion
- substTys :: HasDebugCallStack => Subst -> [Type] -> [Type]
- substScaledTys :: HasDebugCallStack => Subst -> [Scaled Type] -> [Scaled Type]
- substTheta :: HasDebugCallStack => Subst -> ThetaType -> ThetaType
- lookupTyVar :: Subst -> TyVar -> Maybe Type
- cloneTyVarBndrs :: Subst -> [TyVar] -> UniqSupply -> (Subst, [TyVar])
- substVarBndr :: HasDebugCallStack => Subst -> TyCoVar -> (Subst, TyCoVar)
- substVarBndrs :: HasDebugCallStack => Subst -> [TyCoVar] -> (Subst, [TyCoVar])
- substTyVarBndrs :: HasDebugCallStack => Subst -> [TyVar] -> (Subst, [TyVar])
- substTyVars :: Subst -> [TyVar] -> [Type]
- substTyVarToTyVar :: HasDebugCallStack => Subst -> TyVar -> TyVar
- substTyCoBndr :: Subst -> PiTyBinder -> (Subst, PiTyBinder)
- mkCastTy :: Type -> Coercion -> Type
- mkAppTy :: Type -> Type -> Type
- isCoercionTy :: Type -> Bool
- tidyType :: TidyEnv -> Type -> Type
- tidyTypes :: TidyEnv -> [Type] -> [Type]
- tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type)
- tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type])
- tidyVarBndr :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
- tidyVarBndrs :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
- tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv
- tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
- tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
- tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar
- tidyTopType :: Type -> Type
- tidyForAllTyBinder :: TidyEnv -> VarBndr TyCoVar vis -> (TidyEnv, VarBndr TyCoVar vis)
- tidyForAllTyBinders :: TidyEnv -> [VarBndr TyCoVar vis] -> (TidyEnv, [VarBndr TyCoVar vis])
- mkTyConTy :: TyCon -> Type
- isLiftedTypeKind :: Kind -> Bool
- type ForAllTyBinder = VarBndr TyCoVar ForAllTyFlag
- getTyVar :: HasDebugCallStack => Type -> TyVar
- repGetTyVar_maybe :: Type -> Maybe TyVar
- getCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN)
- mkAppTys :: Type -> [Type] -> Type
- splitAppTy :: Type -> (Type, Type)
- splitAppTys :: HasDebugCallStack => Type -> (Type, [Type])
- splitAppTysNoView :: HasDebugCallStack => Type -> (Type, [Type])
- splitAppTy_maybe :: Type -> Maybe (Type, Type)
- splitFunTy :: Type -> (Mult, Type, Type)
- splitFunTy_maybe :: Type -> Maybe (FunTyFlag, Mult, Type, Type)
- splitFunTys :: Type -> ([Scaled Type], Type)
- funArgTy :: HasDebugCallStack => Type -> Type
- funTyConAppTy_maybe :: FunTyFlag -> Type -> Type -> Type -> Maybe (TyCon, [Type])
- tyConAppFunTy_maybe :: HasDebugCallStack => TyCon -> [Type] -> Maybe Type
- tyConAppFunCo_maybe :: HasDebugCallStack => Role -> TyCon -> [Coercion] -> Maybe Coercion
- mkFunctionType :: HasDebugCallStack => Mult -> Type -> Type -> Type
- mkScaledFunctionTys :: [Scaled Type] -> Type -> Type
- tyConAppTyCon_maybe :: Type -> Maybe TyCon
- tyConAppTyConPicky_maybe :: Type -> Maybe TyCon
- tyConAppArgs_maybe :: Type -> Maybe [Type]
- tyConAppTyCon :: HasDebugCallStack => Type -> TyCon
- splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
- splitTyConAppNoView_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type])
- tcSplitTyConApp :: Type -> (TyCon, [Type])
- mkTyCoInvForAllTys :: [TyCoVar] -> Type -> Type
- mkSpecForAllTy :: TyVar -> Type -> Type
- mkSpecForAllTys :: [TyVar] -> Type -> Type
- mkVisForAllTys :: [TyVar] -> Type -> Type
- mkTyCoForAllTy :: TyCoVar -> ForAllTyFlag -> Type -> Type
- mkTyCoForAllTys :: [ForAllTyBinder] -> Type -> Type
- mkTyCoInvForAllTy :: TyCoVar -> Type -> Type
- mkInfForAllTy :: TyVar -> Type -> Type
- mkInfForAllTys :: [TyVar] -> Type -> Type
- splitForAllTyVars :: Type -> ([TyVar], Type)
- splitForAllForAllTyBinders :: Type -> ([ForAllTyBinder], Type)
- splitForAllForAllTyBinder_maybe :: Type -> Maybe (ForAllTyBinder, Type)
- splitForAllTyCoVar_maybe :: Type -> Maybe (TyCoVar, Type)
- splitForAllTyCoVar :: Type -> (TyCoVar, Type)
- splitForAllTyVar_maybe :: Type -> Maybe (TyVar, Type)
- splitForAllCoVar_maybe :: Type -> Maybe (CoVar, Type)
- splitPiTy_maybe :: Type -> Maybe (PiTyBinder, Type)
- splitPiTy :: Type -> (PiTyBinder, Type)
- splitPiTys :: Type -> ([PiTyBinder], Type)
- getRuntimeArgTys :: Type -> [(Scaled Type, FunTyFlag)]
- mkTyConBindersPreferAnon :: [TyVar] -> TyCoVarSet -> [TyConBinder]
- piResultTy :: HasDebugCallStack => Type -> Type -> Type
- piResultTys :: HasDebugCallStack => Type -> [Type] -> Type
- applyTysX :: HasDebugCallStack => [TyVar] -> Type -> [Type] -> Type
- dropForAlls :: Type -> Type
- mkFamilyTyConApp :: TyCon -> [Type] -> Type
- buildSynTyCon :: Name -> [KnotTied TyConBinder] -> Kind -> [Role] -> KnotTied Type -> TyCon
- mkNumLitTy :: Integer -> Type
- isNumLitTy :: Type -> Maybe Integer
- mkStrLitTy :: FastString -> Type
- isStrLitTy :: Type -> Maybe FastString
- mkCharLitTy :: Char -> Type
- isCharLitTy :: Type -> Maybe Char
- isLitTy :: Type -> Maybe TyLit
- getRuntimeRep :: HasDebugCallStack => Type -> RuntimeRepType
- splitRuntimeRep_maybe :: RuntimeRepType -> Maybe (TyCon, [Type])
- kindRep_maybe :: HasDebugCallStack => Kind -> Maybe RuntimeRepType
- kindRep :: HasDebugCallStack => Kind -> RuntimeRepType
- levityType_maybe :: LevityType -> Maybe Levity
- mkCoercionTy :: Coercion -> Type
- splitCastTy_maybe :: Type -> Maybe (Type, Coercion)
- type ErrorMsgType = Type
- userTypeError_maybe :: Type -> Maybe ErrorMsgType
- deepUserTypeError_maybe :: Type -> Maybe ErrorMsgType
- pprUserTypeErrorTy :: ErrorMsgType -> SDoc
- coAxNthLHS :: forall (br :: BranchFlag). CoAxiom br -> Int -> Type
- stripCoercionTy :: Type -> Coercion
- splitInvisPiTys :: Type -> ([PiTyBinder], Type)
- splitInvisPiTysN :: Int -> Type -> ([PiTyBinder], Type)
- invisibleTyBndrCount :: Type -> Int
- filterOutInvisibleTypes :: TyCon -> [Type] -> [Type]
- filterOutInferredTypes :: TyCon -> [Type] -> [Type]
- partitionInvisibles :: [(a, ForAllTyFlag)] -> ([a], [a])
- tyConForAllTyFlags :: TyCon -> [Type] -> [ForAllTyFlag]
- appTyForAllTyFlags :: Type -> [Type] -> [ForAllTyFlag]
- data TyCoMapper env (m :: Type -> Type) = TyCoMapper {
  - tcm_tyvar :: env -> TyVar -> m Type
  - tcm_covar :: env -> CoVar -> m Coercion
  - tcm_hole :: env -> CoercionHole -> m Coercion
  - tcm_tycobinder :: forall r. env -> TyCoVar -> ForAllTyFlag -> (env -> TyCoVar -> m r) -> m r
  - tcm_tycon :: TyCon -> m TyCon
  }
- 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])
- newTyConInstRhs :: TyCon -> [Type] -> Type
- mkForAllTyBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis
- mkForAllTyBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis]
- tyVarSpecToBinders :: [VarBndr a Specificity] -> [VarBndr a ForAllTyFlag]
- isAnonPiTyBinder :: PiTyBinder -> Bool
- binderType :: VarBndr TyCoVar argf -> Type
- binderFlag :: VarBndr tv argf -> argf
- binderFlags :: [VarBndr tv argf] -> [argf]
- piTyBinderType :: PiTyBinder -> Type
- namedPiTyBinder_maybe :: PiTyBinder -> Maybe TyCoVar
- anonPiTyBinderType_maybe :: PiTyBinder -> Maybe Type
- isVisibleForAllTyFlag :: ForAllTyFlag -> Bool
- isInvisibleForAllTyFlag :: ForAllTyFlag -> Bool
- isVisiblePiTyBinder :: PiTyBinder -> Bool
- isInvisiblePiTyBinder :: PiTyBinder -> Bool
- isNamedPiTyBinder :: PiTyBinder -> Bool
- tyConBindersPiTyBinders :: [TyConBinder] -> [PiTyBinder]
- isTyVarTy :: Type -> Bool
- isFunTy :: Type -> Bool
- isCoercionTy_maybe :: Type -> Maybe Coercion
- isForAllTy :: Type -> Bool
- isForAllTy_ty :: Type -> Bool
- isForAllTy_co :: Type -> Bool
- isForAllTy_invis_ty :: Type -> Bool
- isPiTy :: Type -> Bool
- isTauTy :: Type -> Bool
- isFamFreeTy :: Type -> Bool
- isCoVarType :: Type -> Bool
- isAtomicTy :: Type -> Bool
- isValidJoinPointType :: JoinArity -> Type -> Bool
- tyConAppNeedsKindSig :: Bool -> TyCon -> Int -> Bool
- mkTYPEapp :: RuntimeRepType -> Type
- mkTYPEapp_maybe :: RuntimeRepType -> Maybe Type
- mkCONSTRAINTapp :: RuntimeRepType -> Type
- mkCONSTRAINTapp_maybe :: RuntimeRepType -> Maybe Type
- mkBoxedRepApp_maybe :: LevityType -> Maybe Type
- mkTupleRepApp_maybe :: Type -> Maybe Type
- typeOrConstraintKind :: TypeOrConstraint -> RuntimeRepType -> Kind
- sORTKind_maybe :: Kind -> Maybe (TypeOrConstraint, Type)
- typeLevity :: HasDebugCallStack => Type -> Levity
- typeLevity_maybe :: HasDebugCallStack => Type -> Maybe Levity
- tyConIsTYPEorCONSTRAINT :: TyCon -> Bool
- isUnliftedTypeKind :: Kind -> Bool
- isLiftedRuntimeRep :: RuntimeRepType -> Bool
- isUnliftedRuntimeRep :: RuntimeRepType -> Bool
- runtimeRepLevity_maybe :: RuntimeRepType -> Maybe Levity
- isBoxedRuntimeRep :: RuntimeRepType -> Bool
- isLiftedLevity :: Type -> Bool
- isUnliftedLevity :: Type -> Bool
- isUnliftedType :: HasDebugCallStack => Type -> Bool
- isBoxedType :: Type -> Bool
- isUnboxedTupleType :: Type -> Bool
- isUnboxedSumType :: Type -> Bool
- kindBoxedRepLevity_maybe :: Type -> Maybe Levity
- mightBeLiftedType :: Type -> Bool
- definitelyLiftedType :: Type -> Bool
- definitelyUnliftedType :: Type -> Bool
- isDataFamilyAppType :: Type -> Bool
- isPrimitiveType :: Type -> Bool
- isStrictType :: HasDebugCallStack => Type -> Bool
- isTerminatingType :: HasDebugCallStack => Type -> Bool
- isLevityTy :: Type -> Bool
- isLevityVar :: TyVar -> Bool
- isRuntimeRepTy :: Type -> Bool
- isRuntimeRepVar :: TyVar -> Bool
- isRuntimeRepKindedTy :: Type -> Bool
- dropRuntimeRepArgs :: [Type] -> [Type]
- isMultiplicityTy :: Type -> Bool
- isMultiplicityVar :: TyVar -> Bool
- isOneTy :: Mult -> Bool
- isManyTy :: Mult -> Bool
- isLinearType :: Type -> Bool
- tcIsLiftedTypeKind :: Kind -> Bool
- isConstraintKind :: Kind -> Bool
- isConstraintLikeKind :: Kind -> Bool
- returnsConstraintKind :: Kind -> Bool
- tcIsBoxedTypeKind :: Kind -> Bool
- isTypeLikeKind :: Kind -> Bool
- expandTypeSynonyms :: Type -> Type
- seqTypes :: [Type] -> ()
- coreFullView :: Type -> Type
- isTYPEorCONSTRAINT :: Kind -> Bool
- isConcreteType :: Type -> Bool
- isFixedRuntimeRepKind :: HasDebugCallStack => Kind -> Bool
- module GHC.Core.TyCon
- data Coercion
- data Role
  - = Nominal
  - | Representational
  - | Phantom
- data Var
- type CoercionN = Coercion
- type CoercionR = Coercion
- type CoercionP = Coercion
- data MCoercion
  - = MRefl
  - | MCo Coercion
- type MCoercionN = MCoercion
- type MCoercionR = MCoercion
- data CoSel
  - = SelTyCon Int Role
  - | SelFun FunSel
  - | SelForAll
- data FunSel
  - = SelMult
  - | SelArg
  - | SelRes
- data UnivCoProvenance
- data CoercionHole = CoercionHole {
  - ch_co_var :: CoVar
  - ch_ref :: IORef (Maybe Coercion)
  - ch_hetero_kind :: Bool
  }
- coHoleCoVar :: CoercionHole -> CoVar
- setCoHoleCoVar :: CoercionHole -> CoVar -> CoercionHole
- data LeftOrRight
  - = CLeft
  - | CRight
- type CoVar = Id
- type TyCoVar = Id
- ltRole :: Role -> Role -> Bool
- coVarRType :: HasDebugCallStack => CoVar -> Type
- coVarLType :: HasDebugCallStack => CoVar -> Type
- coVarTypes :: HasDebugCallStack => CoVar -> Pair Type
- coVarKind :: CoVar -> Type
- coVarKindsTypesRole :: HasDebugCallStack => CoVar -> (Kind, Kind, Type, Type, Role)
- coVarRole :: CoVar -> Role
- coercionType :: Coercion -> Type
- mkCoercionType :: Role -> Type -> Type -> Type
- coercionKind :: Coercion -> Pair Type
- coercionLKind :: Coercion -> Type
- coercionRKind :: Coercion -> Type
- coercionKinds :: [Coercion] -> Pair [Type]
- coercionRole :: Coercion -> Role
- coercionKindRole :: Coercion -> (Pair Type, Role)
- mkGReflCo :: Role -> Type -> MCoercionN -> Coercion
- mkReflCo :: Role -> Type -> Coercion
- mkRepReflCo :: Type -> Coercion
- mkNomReflCo :: Type -> Coercion
- mkCoVarCo :: CoVar -> Coercion
- mkCoVarCos :: [CoVar] -> [Coercion]
- mkAxInstCo :: forall (br :: BranchFlag). Role -> CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Coercion
- mkUnbranchedAxInstCo :: Role -> CoAxiom Unbranched -> [Type] -> [Coercion] -> Coercion
- mkAxInstRHS :: forall (br :: BranchFlag). CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type
- mkUnbranchedAxInstRHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type
- mkAxInstLHS :: forall (br :: BranchFlag). CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type
- mkUnbranchedAxInstLHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type
- mkPiCo :: Role -> Var -> Coercion -> Coercion
- mkPiCos :: Role -> [Var] -> Coercion -> Coercion
- mkCoCast :: Coercion -> CoercionR -> Coercion
- mkSymCo :: Coercion -> Coercion
- mkTransCo :: Coercion -> Coercion -> Coercion
- mkSelCo :: HasDebugCallStack => CoSel -> Coercion -> Coercion
- getNthFun :: FunSel -> a -> a -> a -> a
- getNthFromType :: HasDebugCallStack => CoSel -> Type -> Type
- mkLRCo :: LeftOrRight -> Coercion -> Coercion
- mkInstCo :: Coercion -> CoercionN -> Coercion
- mkAppCo :: Coercion -> Coercion -> Coercion
- mkAppCos :: Coercion -> [Coercion] -> Coercion
- mkTyConAppCo :: HasDebugCallStack => Role -> TyCon -> [Coercion] -> Coercion
- mkFunCo :: Role -> FunTyFlag -> CoercionN -> Coercion -> Coercion -> Coercion
- mkFunCo2 :: Role -> FunTyFlag -> FunTyFlag -> CoercionN -> Coercion -> Coercion -> Coercion
- mkFunCoNoFTF :: HasDebugCallStack => Role -> CoercionN -> Coercion -> Coercion -> Coercion
- mkFunResCo :: Role -> Id -> Coercion -> Coercion
- mkNakedFunCo :: Role -> FunTyFlag -> CoercionN -> Coercion -> Coercion -> Coercion
- mkNakedForAllCo :: TyVar -> ForAllTyFlag -> ForAllTyFlag -> CoercionN -> Coercion -> Coercion
- mkForAllCo :: HasDebugCallStack => TyCoVar -> ForAllTyFlag -> ForAllTyFlag -> CoercionN -> Coercion -> Coercion
- mkHomoForAllCos :: [ForAllTyBinder] -> Coercion -> Coercion
- mkPhantomCo :: Coercion -> Type -> Type -> Coercion
- mkHoleCo :: CoercionHole -> Coercion
- mkUnivCo :: UnivCoProvenance -> Role -> Type -> Type -> Coercion
- mkSubCo :: HasDebugCallStack => Coercion -> Coercion
- mkAxiomInstCo :: CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion
- mkProofIrrelCo :: Role -> CoercionN -> Coercion -> Coercion -> Coercion
- downgradeRole :: Role -> Role -> Coercion -> Coercion
- mkAxiomRuleCo :: CoAxiomRule -> [Coercion] -> Coercion
- mkGReflRightCo :: Role -> Type -> CoercionN -> Coercion
- mkGReflLeftCo :: Role -> Type -> CoercionN -> Coercion
- mkCoherenceLeftCo :: Role -> Type -> CoercionN -> Coercion -> Coercion
- mkCoherenceRightCo :: Role -> Type -> CoercionN -> Coercion -> Coercion
- mkKindCo :: Coercion -> Coercion
- castCoercionKind :: Coercion -> CoercionN -> CoercionN -> Coercion
- castCoercionKind1 :: Coercion -> Role -> Type -> Type -> CoercionN -> Coercion
- castCoercionKind2 :: Coercion -> Role -> Type -> Type -> CoercionN -> CoercionN -> Coercion
- mkPrimEqPred :: Type -> Type -> Type
- mkReprPrimEqPred :: Type -> Type -> Type
- mkPrimEqPredRole :: Role -> Type -> Type -> PredType
- mkNomPrimEqPred :: Kind -> Type -> Type -> Type
- instNewTyCon_maybe :: TyCon -> [Type] -> Maybe (Type, Coercion)
- type NormaliseStepper ev = RecTcChecker -> TyCon -> [Type] -> NormaliseStepResult ev
- data NormaliseStepResult ev
  - = NS_Done
  - | NS_Abort
  - | NS_Step RecTcChecker Type ev
- composeSteppers :: NormaliseStepper ev -> NormaliseStepper ev -> NormaliseStepper ev
- unwrapNewTypeStepper :: NormaliseStepper Coercion
- topNormaliseNewType_maybe :: Type -> Maybe (Coercion, Type)
- topNormaliseTypeX :: NormaliseStepper ev -> (ev -> ev -> ev) -> Type -> Maybe (ev, Type)
- decomposeCo :: Arity -> Coercion -> Infinite Role -> [Coercion]
- decomposeFunCo :: HasDebugCallStack => Coercion -> (CoercionN, Coercion, Coercion)
- decomposePiCos :: HasDebugCallStack => CoercionN -> Pair Type -> [Type] -> ([CoercionN], CoercionN)
- getCoVar_maybe :: Coercion -> Maybe CoVar
- splitAppCo_maybe :: Coercion -> Maybe (Coercion, Coercion)
- splitFunCo_maybe :: Coercion -> Maybe (Coercion, Coercion)
- splitForAllCo_maybe :: Coercion -> Maybe (TyCoVar, ForAllTyFlag, ForAllTyFlag, Coercion, Coercion)
- splitForAllCo_ty_maybe :: Coercion -> Maybe (TyVar, ForAllTyFlag, ForAllTyFlag, Coercion, Coercion)
- splitForAllCo_co_maybe :: Coercion -> Maybe (CoVar, ForAllTyFlag, ForAllTyFlag, Coercion, Coercion)
- tyConRole :: Role -> TyCon -> Int -> Role
- tyConRolesX :: Role -> TyCon -> Infinite Role
- tyConRolesRepresentational :: TyCon -> Infinite Role
- setNominalRole_maybe :: Role -> Coercion -> Maybe CoercionN
- tyConRoleListX :: Role -> TyCon -> [Role]
- tyConRoleListRepresentational :: TyCon -> [Role]
- funRole :: Role -> FunSel -> Role
- pickLR :: LeftOrRight -> (a, a) -> a
- isGReflCo :: Coercion -> Bool
- isReflCo :: Coercion -> Bool
- isReflCo_maybe :: Coercion -> Maybe (Type, Role)
- isGReflCo_maybe :: Coercion -> Maybe (Type, Role)
- isReflexiveCo :: Coercion -> Bool
- isReflexiveCo_maybe :: Coercion -> Maybe (Type, Role)
- isReflCoVar_maybe :: Var -> Maybe Coercion
- isGReflMCo :: MCoercion -> Bool
- mkGReflLeftMCo :: Role -> Type -> MCoercionN -> Coercion
- mkGReflRightMCo :: Role -> Type -> MCoercionN -> Coercion
- mkCoherenceRightMCo :: Role -> Type -> MCoercionN -> Coercion -> Coercion
- coToMCo :: Coercion -> MCoercion
- mkTransMCo :: MCoercion -> MCoercion -> MCoercion
- mkTransMCoL :: MCoercion -> Coercion -> MCoercion
- mkTransMCoR :: Coercion -> MCoercion -> MCoercion
- mkCastTyMCo :: Type -> MCoercion -> Type
- mkSymMCo :: MCoercion -> MCoercion
- mkFunResMCo :: Id -> MCoercionR -> MCoercionR
- mkPiMCos :: [Var] -> MCoercion -> MCoercion
- isReflMCo :: MCoercion -> Bool
- checkReflexiveMCo :: MCoercion -> MCoercion
- mkCoVar :: Name -> Type -> CoVar
- isCoVar :: Var -> Bool
- coVarName :: CoVar -> Name
- setCoVarName :: CoVar -> Name -> CoVar
- setCoVarUnique :: CoVar -> Unique -> CoVar
- tyCoVarsOfCo :: Coercion -> TyCoVarSet
- tyCoVarsOfCos :: [Coercion] -> TyCoVarSet
- coVarsOfCo :: Coercion -> CoVarSet
- tyCoFVsOfCo :: Coercion -> FV
- tyCoFVsOfCos :: [Coercion] -> FV
- tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet
- coercionSize :: Coercion -> Int
- anyFreeVarsOfCo :: (TyCoVar -> Bool) -> Coercion -> Bool
- type CvSubstEnv = CoVarEnv Coercion
- emptyCvSubstEnv :: CvSubstEnv
- lookupCoVar :: Subst -> Var -> Maybe Coercion
- substCos :: HasDebugCallStack => Subst -> [Coercion] -> [Coercion]
- substCoVar :: Subst -> CoVar -> Coercion
- substCoVars :: Subst -> [CoVar] -> [Coercion]
- substCoWith :: HasDebugCallStack => [TyVar] -> [Type] -> Coercion -> Coercion
- substCoVarBndr :: HasDebugCallStack => Subst -> CoVar -> (Subst, CoVar)
- extendTvSubstAndInScope :: Subst -> TyVar -> Type -> Subst
- getCvSubstEnv :: Subst -> CvSubstEnv
- liftCoSubst :: HasDebugCallStack => Role -> LiftingContext -> Type -> Coercion
- liftCoSubstTyVar :: LiftingContext -> Role -> TyVar -> Maybe Coercion
- liftCoSubstWith :: Role -> [TyCoVar] -> [Coercion] -> Type -> Coercion
- liftCoSubstWithEx :: Role -> [TyVar] -> [Coercion] -> [TyCoVar] -> [Type] -> (Type -> Coercion, [Type])
- emptyLiftingContext :: InScopeSet -> LiftingContext
- extendLiftingContext :: LiftingContext -> TyCoVar -> Coercion -> LiftingContext
- extendLiftingContextAndInScope :: LiftingContext -> TyCoVar -> Coercion -> LiftingContext
- liftCoSubstVarBndrUsing :: (r -> CoercionN) -> (LiftingContext -> Type -> r) -> LiftingContext -> TyCoVar -> (LiftingContext, TyCoVar, r)
- isMappedByLC :: TyCoVar -> LiftingContext -> Bool
- extendLiftingContextCvSubst :: LiftingContext -> CoVar -> Coercion -> LiftingContext
- mkSubstLiftingContext :: Subst -> LiftingContext
- zapLiftingContext :: LiftingContext -> LiftingContext
- substForAllCoBndrUsingLC :: Bool -> (Coercion -> Coercion) -> LiftingContext -> TyCoVar -> Coercion -> (LiftingContext, TyCoVar, Coercion)
- lcLookupCoVar :: LiftingContext -> CoVar -> Maybe Coercion
- lcInScopeSet :: LiftingContext -> InScopeSet
- type LiftCoEnv = VarEnv Coercion
- data LiftingContext = LC Subst LiftCoEnv
- liftEnvSubstLeft :: Subst -> LiftCoEnv -> Subst
- liftEnvSubstRight :: Subst -> LiftCoEnv -> Subst
- substRightCo :: LiftingContext -> Coercion -> Coercion
- substLeftCo :: LiftingContext -> Coercion -> Coercion
- swapLiftCoEnv :: LiftCoEnv -> LiftCoEnv
- lcSubstLeft :: LiftingContext -> Subst
- lcSubstRight :: LiftingContext -> Subst
- eqCoercion :: Coercion -> Coercion -> Bool
- eqCoercionX :: RnEnv2 -> Coercion -> Coercion -> Bool
- seqCo :: Coercion -> ()
- pprCo :: Coercion -> SDoc
- pprParendCo :: Coercion -> SDoc
- pprCoAxiom :: forall (br :: BranchFlag). CoAxiom br -> SDoc
- pprCoAxBranch :: TyCon -> CoAxBranch -> SDoc
- pprCoAxBranchLHS :: TyCon -> CoAxBranch -> SDoc
- pprCoAxBranchUser :: TyCon -> CoAxBranch -> SDoc
- tidyCoAxBndrsForUser :: TidyEnv -> [Var] -> (TidyEnv, [Var])
- etaExpandCoAxBranch :: CoAxBranch -> ([TyVar], [Type], Type)
- tidyCo :: TidyEnv -> Coercion -> Coercion
- tidyCos :: TidyEnv -> [Coercion] -> [Coercion]
- promoteCoercion :: HasDebugCallStack => Coercion -> CoercionN
- buildCoercion :: Type -> Type -> CoercionN
- multToCo :: Mult -> Coercion
- mkRuntimeRepCo :: HasDebugCallStack => Coercion -> Coercion
- hasCoercionHoleTy :: Type -> Bool
- hasCoercionHoleCo :: Coercion -> Bool
- hasThisCoercionHoleTy :: Type -> CoercionHole -> Bool
- setCoHoleType :: CoercionHole -> Type -> CoercionHole
- 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
- data Unique
- class Uniquable a where
  - getUnique :: a -> 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.Tc.Errors.Hole.Plugin
- module GHC.Unit.Module.ModGuts
- module GHC.Unit.Module.ModSummary
- module GHC.Unit.Module.ModIface
- module GHC.Types.Meta
- module GHC.Types.SourceError
- type PsWarning = PsMessage
- type PsError = PsMessage
- data Messages e
- data HsParsedModule
- thNameToGhcName :: Name -> CoreM (Maybe Name)
- thNameToGhcNameIO :: NameCache -> Name -> IO (Maybe Name)

# Documentation

module GHC.Driver.Plugins

module GHC.Types.Name.Reader

data NameSpace Source #

#### Instances

Instances details

NFData NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: NameSpace -> () Source #
Uniquable NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: NameSpace -> Unique Source #
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 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

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 #
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 -> JoinPointHood Source #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OccName # toConstr :: OccName -> Constr # dataTypeOf :: OccName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OccName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OccName) # gmapT :: (forall b. Data b => b -> b) -> OccName -> OccName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r # gmapQ :: (forall d. Data d => d -> u) -> OccName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> OccName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccName -> m OccName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName #
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 #

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

isSymOcc :: OccName -> Bool Source #

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

tcName :: NameSpace Source #

clsName :: NameSpace Source #

dataName :: NameSpace Source #

fieldName :: FastString -> NameSpace 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.

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

emptyFsEnv :: FastStringEnv a Source #

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

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

tcClsName :: NameSpace Source #

tvName :: NameSpace Source #

mkVarOccFS :: FastString -> OccName Source #

srcDataName :: NameSpace Source #

pprNameSpace :: NameSpace -> SDoc Source #

pprNonVarNameSpace :: NameSpace -> SDoc Source #

pprNameSpaceBrief :: NameSpace -> SDoc Source #

pprOccName :: IsLine doc => OccName -> doc Source #

occNameMangledFS :: OccName -> FastString Source #

Mangle field names to avoid duplicate symbols.

See Note [Mangling OccNames].

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

mkVarOcc :: String -> OccName Source #

mkRecFieldOcc :: FastString -> String -> OccName Source #

mkRecFieldOccFS :: FastString -> FastString -> OccName Source #

mkDataOcc :: String -> OccName Source #

mkDataOccFS :: FastString -> OccName Source #

mkTyVarOcc :: String -> OccName Source #

mkTyVarOccFS :: FastString -> OccName Source #

mkTcOcc :: String -> OccName Source #

mkTcOccFS :: FastString -> OccName Source #

mkClsOcc :: String -> OccName Source #

mkClsOccFS :: FastString -> 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`

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

demoteOccName :: OccName -> Maybe OccName Source #

demoteOccTvName :: OccName -> Maybe OccName Source #

promoteOccName :: OccName -> Maybe OccName Source #

varToRecFieldOcc :: HasDebugCallStack => FastString -> OccName -> OccName Source #

recFieldToVarOcc :: HasDebugCallStack => OccName -> OccName 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.BasicTypes Methods occName :: TcBinder -> 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 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 (GlobalRdrEltX info) Source # |
Instance details Defined in GHC.Types.Name.Reader Methods occName :: GlobalRdrEltX info -> OccName Source #
(HasOccName (IdP (GhcPass p)), OutputableBndrId p) => HasOccName (IEWrappedName (GhcPass p)) Source # |
Instance details Defined in GHC.Hs.ImpExp Methods occName :: IEWrappedName (GhcPass p) -> OccName 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

mkDataConWrapperOcc :: OccName -> OccName Source #

mkWorkerOcc :: OccName -> OccName Source #

mkMatcherOcc :: OccName -> OccName Source #

mkBuilderOcc :: OccName -> OccName Source #

mkDefaultMethodOcc :: OccName -> OccName Source #

isDefaultMethodOcc :: 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.

mkNewTyCoOcc :: OccName -> OccName Source #

mkClassOpAuxOcc :: OccName -> OccName Source #

mkCon2TagOcc :: OccName -> OccName Source #

mkTag2ConOcc :: OccName -> OccName Source #

mkMaxTagOcc :: OccName -> OccName Source #

mkClassDataConOcc :: OccName -> OccName Source #

mkDictOcc :: OccName -> OccName Source #

mkIPOcc :: OccName -> OccName Source #

mkSpecOcc :: OccName -> OccName Source #

mkForeignExportOcc :: OccName -> OccName Source #

mkRepEqOcc :: OccName -> OccName Source #

mkGenR :: OccName -> OccName Source #

mkGen1R :: OccName -> OccName Source #

mkDataTOcc :: OccName -> OccName Source #

mkDataCOcc :: OccName -> OccName Source #

mkDataConWorkerOcc :: OccName -> OccName Source #

mkSuperDictSelOcc Source #

Arguments

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

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

mkLocalOcc Source #

Arguments

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

mkMethodOcc :: 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.

mkInstTyCoOcc :: OccName -> OccName Source #

mkEqPredCoOcc :: OccName -> OccName Source #

mkTyConRepOcc :: OccName -> OccName Source #

occNameString :: OccName -> String Source #

isVarOcc :: OccName -> Bool Source #

isTvOcc :: OccName -> Bool Source #

isTcOcc :: OccName -> 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 `[]`)

isValOcc :: OccName -> Bool Source #

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

isFieldOcc :: OccName -> Bool Source #

fieldOcc_maybe :: OccName -> Maybe FastString Source #

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

Wrap parens around an operator

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

isUnderscore :: OccName -> Bool Source #

isTcClsNameSpace :: NameSpace -> Bool Source #

isTvNameSpace :: NameSpace -> Bool Source #

isDataConNameSpace :: NameSpace -> Bool Source #

isVarNameSpace :: NameSpace -> Bool Source #

isValNameSpace :: NameSpace -> Bool Source #

isFieldNameSpace :: NameSpace -> Bool Source #

isTermVarOrFieldNameSpace :: NameSpace -> Bool Source #

Is this a term variable or field name namespace?

data OccEnv a Source #

A map keyed on `OccName`. See Note [OccEnv].

#### Instances

Instances details

Functor OccEnv Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods fmap :: (a -> b) -> OccEnv a -> OccEnv b # (<$) :: a -> OccEnv b -> OccEnv a #
NFData a => NFData (OccEnv a) Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: OccEnv a -> () Source #
Outputable a => Outputable (OccEnv a) Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods ppr :: OccEnv a -> SDoc Source #

emptyOccEnv :: OccEnv a Source #

The empty `OccEnv`.

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

A singleton `OccEnv`.

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

Add a single element to an `OccEnv`.

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

Map over an `OccEnv` (`Functor` instance).

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

Map over an `OccEnv` strictly.

mapMaybeOccEnv :: (a -> Maybe b) -> OccEnv a -> OccEnv b Source #

`mapMaybe` for b `OccEnv`.

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

Look an element up in an `OccEnv`.

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

Lookup an element in an `OccEnv`, ignoring `NameSpace`s entirely.

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

Lookup an element in an `OccEnv`, looking in the record field namespace for a variable.

lookupFieldsOccEnv :: OccEnv a -> FastString -> [a] Source #

Look up all the record fields that match with the given `FastString` in an `OccEnv`.

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

Create an `OccEnv` from a list.

`OccName`s later on in the list override earlier `OccName`s.

mkOccEnv_C Source #

Arguments

:: (a -> a -> a) | old -> new -> result
-> [(OccName, a)] |
-> OccEnv a |

Create an `OccEnv` from a list, combining different values with the same `OccName` using the combining function.

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

Extend an `OccEnv` by a list.

`OccName`s later on in the list override earlier `OccName`s.

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

Compute whether there is a value keyed by the given `OccName`.

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

Obtain the elements of an `OccEnv`.

The resulting order is non-deterministic.

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

Fold over an `OccEnv`. Non-deterministic, unless the folding function is commutative (i.e. `a1 `f` ( a2 `f` b ) == a2 `f` ( a1 `f` b )` for all `a1`, `a2`, `b`).

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

Union of two `OccEnv`s, right-biased.

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

Union of two `OccEnv`s with a combining function.

extendOccEnv_Acc Source #

Arguments

:: (a -> b -> b) | add to existing
-> (a -> b) | new element
-> OccEnv b | old
-> OccName |
-> a | new
-> OccEnv b |

Add a single element to an `OccEnv`, using a different function whether the `OccName` already exists or not.

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

Filter out all elements in an `OccEnv` using a predicate.

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

Delete multiple elements from an `OccEnv`.

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

Delete one element from an `OccEnv`.

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

Alter an `OccEnv`, adding or removing an element at the given key.

minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a Source #

Remove elements of the first `OccEnv` that appear in the second `OccEnv`.

minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a Source #

Alters (replaces or removes) those elements of the first `OccEnv` that are mentioned in the second `OccEnv`.

Same idea as `differenceWith`.

minusOccEnv_C_Ns :: (UniqFM NameSpace a -> UniqFM NameSpace b -> UniqFM NameSpace a) -> OccEnv a -> OccEnv b -> OccEnv a Source #

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

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

Force an `OccEnv` with the provided function.

intersectOccEnv_C :: (a -> b -> c) -> OccEnv a -> OccEnv b -> OccEnv c Source #

data OccSet Source #

emptyOccSet :: OccSet Source #

unitOccSet :: OccName -> OccSet Source #

mkOccSet :: [OccName] -> OccSet Source #

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

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

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

unionManyOccSets :: [OccSet] -> OccSet Source #

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

isEmptyOccSet :: OccSet -> Bool Source #

mainOcc :: OccName Source #

ppMainFn :: OccName -> SDoc Source #

type TidyOccEnv = UniqFM FastString Int Source #

emptyTidyOccEnv :: TidyOccEnv Source #

initTidyOccEnv :: [OccName] -> TidyOccEnv Source #

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

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

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

data Name Source #

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

#### Instances

Instances details

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 -> JoinPointHood Source #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name # toConstr :: Name -> Constr # dataTypeOf :: Name -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) # gmapT :: (forall b. Data b => b -> b) -> Name -> Name # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r # gmapQ :: (forall d. Data d => d -> u) -> Name -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Name -> m Name # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name #
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 #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

data NameSpace Source #

#### Instances

Instances details

NFData NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: NameSpace -> () Source #
Uniquable NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: NameSpace -> Unique Source #
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 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

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 #
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 -> JoinPointHood Source #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OccName # toConstr :: OccName -> Constr # dataTypeOf :: OccName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OccName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OccName) # gmapT :: (forall b. Data b => b -> b) -> OccName -> OccName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r # gmapQ :: (forall d. Data d => d -> u) -> OccName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> OccName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccName -> m OccName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName #
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 #

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

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

pprName :: IsLine doc => Name -> doc Source #

isSymOcc :: OccName -> Bool Source #

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

isExternalName :: Name -> Bool Source #

nameSrcSpan :: Name -> SrcSpan Source #

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 InvalidFamInstQTv Source # |
Instance details Defined in GHC.Tc.Errors.Types Methods getOccName :: InvalidFamInstQTv -> OccName Source # getName :: InvalidFamInstQTv -> 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 #

tcName :: NameSpace Source #

clsName :: NameSpace Source #

dataName :: NameSpace Source #

fieldName :: FastString -> NameSpace 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 |

nameOccName :: Name -> OccName Source #

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

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

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

pprPrefixName :: NamedThing a => a -> SDoc 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

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

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

nameModule_maybe :: Name -> Maybe Module Source #

isInternalName :: Name -> Bool 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.

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

emptyFsEnv :: FastStringEnv a Source #

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

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

nameUnique :: Name -> Unique Source #

tcClsName :: NameSpace Source #

tvName :: NameSpace Source #

mkVarOccFS :: FastString -> OccName Source #

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

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

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

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

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

Create a name brought into being by the compiler

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

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

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

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

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

Make a name for a foreign call

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

Create a name which definitely originates in the given module

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

Create a name which is actually defined by the compiler itself

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

nameNameSpace :: Name -> NameSpace Source #

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

localiseName :: Name -> Name Source #

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

namePun_maybe :: Name -> Maybe FastString Source #

nameSrcLoc :: Name -> SrcLoc Source #

pprNameDefnLoc :: Name -> SDoc Source #

pprDefinedAt :: Name -> SDoc Source #

pprFullName :: Module -> Name -> SDoc Source #

Print fully qualified name (with unit-id, module and unique)

pprTickyName :: Module -> Name -> SDoc Source #

Print a ticky ticky styled name

Module argument is the module to use for internal and system names. When printing the name in a ticky profile, the module name is included even for local things. However, ticky uses the format "x (M)" rather than "M.x". Hence, this function provides a separation from normal styling.

isSystemName :: Name -> Bool Source #

isTyVarName :: Name -> Bool Source #

isTyConName :: Name -> Bool Source #

isDataConName :: Name -> Bool Source #

isValName :: Name -> Bool Source #

isVarName :: Name -> Bool Source #

isFieldName :: Name -> Bool Source #

isWiredInName :: Name -> Bool Source #

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

isBuiltInSyntax :: Name -> Bool Source #

isTupleTyConName :: Name -> Bool Source #

isSumTyConName :: Name -> Bool Source #

isUnboxedTupleDataConLikeName :: Name -> Bool Source #

This matches a datacon as well as its worker and promoted tycon.

isHoleName :: Name -> Bool Source #

wiredInNameTyThing_maybe :: Name -> Maybe TyThing Source #

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

Returns True if the name is external or from the `interactive` package See documentation of `nameIsLocalOrFrom` function

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

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

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

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

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

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

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

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

pprNameUnqualified :: Name -> SDoc Source #

Print the string of Name unqualifiedly directly.

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"

srcDataName :: NameSpace Source #

pprNameSpace :: NameSpace -> SDoc Source #

pprNonVarNameSpace :: NameSpace -> SDoc Source #

pprNameSpaceBrief :: NameSpace -> SDoc Source #

pprOccName :: IsLine doc => OccName -> doc Source #

occNameMangledFS :: OccName -> FastString Source #

Mangle field names to avoid duplicate symbols.

See Note [Mangling OccNames].

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

mkVarOcc :: String -> OccName Source #

mkRecFieldOcc :: FastString -> String -> OccName Source #

mkRecFieldOccFS :: FastString -> FastString -> OccName Source #

mkDataOcc :: String -> OccName Source #

mkDataOccFS :: FastString -> OccName Source #

mkTyVarOcc :: String -> OccName Source #

mkTyVarOccFS :: FastString -> OccName Source #

mkTcOcc :: String -> OccName Source #

mkTcOccFS :: FastString -> OccName Source #

mkClsOcc :: String -> OccName Source #

mkClsOccFS :: FastString -> 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`

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

demoteOccName :: OccName -> Maybe OccName Source #

demoteOccTvName :: OccName -> Maybe OccName Source #

promoteOccName :: OccName -> Maybe OccName Source #

varToRecFieldOcc :: HasDebugCallStack => FastString -> OccName -> OccName Source #

recFieldToVarOcc :: HasDebugCallStack => OccName -> OccName 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.BasicTypes Methods occName :: TcBinder -> 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 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 (GlobalRdrEltX info) Source # |
Instance details Defined in GHC.Types.Name.Reader Methods occName :: GlobalRdrEltX info -> OccName Source #
(HasOccName (IdP (GhcPass p)), OutputableBndrId p) => HasOccName (IEWrappedName (GhcPass p)) Source # |
Instance details Defined in GHC.Hs.ImpExp Methods occName :: IEWrappedName (GhcPass p) -> OccName 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

mkDataConWrapperOcc :: OccName -> OccName Source #

mkWorkerOcc :: OccName -> OccName Source #

mkMatcherOcc :: OccName -> OccName Source #

mkBuilderOcc :: OccName -> OccName Source #

mkDefaultMethodOcc :: OccName -> OccName Source #

isDefaultMethodOcc :: 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.

mkNewTyCoOcc :: OccName -> OccName Source #

mkClassOpAuxOcc :: OccName -> OccName Source #

mkCon2TagOcc :: OccName -> OccName Source #

mkTag2ConOcc :: OccName -> OccName Source #

mkMaxTagOcc :: OccName -> OccName Source #

mkClassDataConOcc :: OccName -> OccName Source #

mkDictOcc :: OccName -> OccName Source #

mkIPOcc :: OccName -> OccName Source #

mkSpecOcc :: OccName -> OccName Source #

mkForeignExportOcc :: OccName -> OccName Source #

mkRepEqOcc :: OccName -> OccName Source #

mkGenR :: OccName -> OccName Source #

mkGen1R :: OccName -> OccName Source #

mkDataTOcc :: OccName -> OccName Source #

mkDataCOcc :: OccName -> OccName Source #

mkDataConWorkerOcc :: OccName -> OccName Source #

mkSuperDictSelOcc Source #

Arguments

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

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

mkLocalOcc Source #

Arguments

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

mkMethodOcc :: 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.

mkInstTyCoOcc :: OccName -> OccName Source #

mkEqPredCoOcc :: OccName -> OccName Source #

mkTyConRepOcc :: OccName -> OccName Source #

occNameString :: OccName -> String Source #

isVarOcc :: OccName -> Bool Source #

isTvOcc :: OccName -> Bool Source #

isTcOcc :: OccName -> 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 `[]`)

isValOcc :: OccName -> Bool Source #

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

isFieldOcc :: OccName -> Bool Source #

fieldOcc_maybe :: OccName -> Maybe FastString Source #

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

Wrap parens around an operator

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

isUnderscore :: OccName -> Bool Source #

isTcClsNameSpace :: NameSpace -> Bool Source #

isTvNameSpace :: NameSpace -> Bool Source #

isDataConNameSpace :: NameSpace -> Bool Source #

isVarNameSpace :: NameSpace -> Bool Source #

isValNameSpace :: NameSpace -> Bool Source #

isFieldNameSpace :: NameSpace -> Bool Source #

isTermVarOrFieldNameSpace :: NameSpace -> Bool Source #

Is this a term variable or field name namespace?

data OccEnv a Source #

A map keyed on `OccName`. See Note [OccEnv].

#### Instances

Instances details

Functor OccEnv Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods fmap :: (a -> b) -> OccEnv a -> OccEnv b # (<$) :: a -> OccEnv b -> OccEnv a #
NFData a => NFData (OccEnv a) Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: OccEnv a -> () Source #
Outputable a => Outputable (OccEnv a) Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods ppr :: OccEnv a -> SDoc Source #

emptyOccEnv :: OccEnv a Source #

The empty `OccEnv`.

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

A singleton `OccEnv`.

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

Add a single element to an `OccEnv`.

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

Map over an `OccEnv` (`Functor` instance).

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

Map over an `OccEnv` strictly.

mapMaybeOccEnv :: (a -> Maybe b) -> OccEnv a -> OccEnv b Source #

`mapMaybe` for b `OccEnv`.

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

Look an element up in an `OccEnv`.

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

Lookup an element in an `OccEnv`, ignoring `NameSpace`s entirely.

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

Lookup an element in an `OccEnv`, looking in the record field namespace for a variable.

lookupFieldsOccEnv :: OccEnv a -> FastString -> [a] Source #

Look up all the record fields that match with the given `FastString` in an `OccEnv`.

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

Create an `OccEnv` from a list.

`OccName`s later on in the list override earlier `OccName`s.

mkOccEnv_C Source #

Arguments

:: (a -> a -> a) | old -> new -> result
-> [(OccName, a)] |
-> OccEnv a |

Create an `OccEnv` from a list, combining different values with the same `OccName` using the combining function.

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

Extend an `OccEnv` by a list.

`OccName`s later on in the list override earlier `OccName`s.

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

Compute whether there is a value keyed by the given `OccName`.

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

Obtain the elements of an `OccEnv`.

The resulting order is non-deterministic.

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

Fold over an `OccEnv`. Non-deterministic, unless the folding function is commutative (i.e. `a1 `f` ( a2 `f` b ) == a2 `f` ( a1 `f` b )` for all `a1`, `a2`, `b`).

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

Union of two `OccEnv`s, right-biased.

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

Union of two `OccEnv`s with a combining function.

extendOccEnv_Acc Source #

Arguments

:: (a -> b -> b) | add to existing
-> (a -> b) | new element
-> OccEnv b | old
-> OccName |
-> a | new
-> OccEnv b |

Add a single element to an `OccEnv`, using a different function whether the `OccName` already exists or not.

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

Filter out all elements in an `OccEnv` using a predicate.

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

Delete multiple elements from an `OccEnv`.

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

Delete one element from an `OccEnv`.

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

Alter an `OccEnv`, adding or removing an element at the given key.

minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a Source #

Remove elements of the first `OccEnv` that appear in the second `OccEnv`.

minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a Source #

Alters (replaces or removes) those elements of the first `OccEnv` that are mentioned in the second `OccEnv`.

Same idea as `differenceWith`.

minusOccEnv_C_Ns :: (UniqFM NameSpace a -> UniqFM NameSpace b -> UniqFM NameSpace a) -> OccEnv a -> OccEnv b -> OccEnv a Source #

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

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

Force an `OccEnv` with the provided function.

intersectOccEnv_C :: (a -> b -> c) -> OccEnv a -> OccEnv b -> OccEnv c Source #

data OccSet Source #

emptyOccSet :: OccSet Source #

unitOccSet :: OccName -> OccSet Source #

mkOccSet :: [OccName] -> OccSet Source #

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

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

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

unionManyOccSets :: [OccSet] -> OccSet Source #

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

isEmptyOccSet :: OccSet -> Bool Source #

mainOcc :: OccName Source #

ppMainFn :: OccName -> SDoc Source #

type TidyOccEnv = UniqFM FastString Int Source #

emptyTidyOccEnv :: TidyOccEnv Source #

initTidyOccEnv :: [OccName] -> TidyOccEnv Source #

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

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

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

module GHC.Types.Var

type Id = Var Source #

Identifier

idType :: Id -> Kind 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.

isDeadBinder :: Id -> Bool Source #

isExportedId :: Var -> Bool Source #

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

isLocalId :: Var -> Bool Source #

isGlobalId :: Var -> Bool Source #

isRecordSelector :: Id -> Bool Source #

isPrimOpId :: Id -> Bool Source #

isFCallId :: Id -> Bool Source #

isClassOpId_maybe :: Id -> Maybe Class Source #

isDataConWorkId :: Id -> Bool 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

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.

recordSelectorTyCon :: Id -> RecSelParent Source #

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

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

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 -> JoinPointHood Source #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var # toConstr :: Var -> Constr # dataTypeOf :: Var -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) # gmapT :: (forall b. Data b => b -> b) -> Var -> Var # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var #
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 #
Eq (DeBruijn Var) Source # |
Instance details Defined in GHC.Core.Map.Type Methods (==) :: DeBruijn Var -> DeBruijn Var -> Bool # (/=) :: DeBruijn Var -> DeBruijn Var -> Bool #
OutputableBndr (Id, TagSig) Source # |
Instance details Defined in GHC.Stg.InferTags.TagSig Methods pprBndr :: BindingSite -> (Id, TagSig) -> SDoc Source # pprPrefixOcc :: (Id, TagSig) -> SDoc Source # pprInfixOcc :: (Id, TagSig) -> SDoc Source # bndrIsJoin_maybe :: (Id, TagSig) -> JoinPointHood Source #
type Anno Id Source # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN

type InId = Id Source #

type InVar = Var Source #

type OutId = Id Source #

type OutVar = Var Source #

isId :: Var -> Bool Source #

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

type IdUnfoldingFun = Id -> Unfolding Source #

idHasRules :: Id -> Bool Source #

zapStableUnfolding :: Id -> Id Source #

idInlineActivation :: Id -> Activation Source #

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

zapIdOccInfo :: Id -> Id Source #

zapIdUsageInfo :: Id -> Id Source #

idInlinePragma :: Id -> InlinePragma Source #

isJoinId :: Var -> Bool Source #

idJoinPointHood :: Var -> JoinPointHood Source #

Doesn't return strictness marks

idUnfolding :: IdUnfoldingFun Source #

Returns the `Id`s unfolding, but does not expose the unfolding of a strong loop breaker. See `unfoldingInfo`.

If you really want the unfolding of a strong loopbreaker, call `realIdUnfolding`.

data JoinPointHood Source #

#### Instances

Instances details

NFData JoinPointHood Source # |
Instance details Defined in GHC.Utils.Outputable Methods rnf :: JoinPointHood -> () Source #
Binary JoinPointHood Source # |
Instance details Defined in GHC.Utils.Binary Methods put_ :: BinHandle -> JoinPointHood -> IO () Source # put :: BinHandle -> JoinPointHood -> IO (Bin JoinPointHood) Source # get :: BinHandle -> IO JoinPointHood Source #
Outputable JoinPointHood Source # |
Instance details Defined in GHC.Utils.Outputable Methods ppr :: JoinPointHood -> SDoc Source #
Eq JoinPointHood Source # |
Instance details Defined in GHC.Utils.Outputable Methods (==) :: JoinPointHood -> JoinPointHood -> Bool # (/=) :: JoinPointHood -> JoinPointHood -> Bool #

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

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

isDataConId_maybe :: Id -> Maybe DataCon Source #

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

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

idName :: Id -> Name Source #

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

realIdUnfolding :: Id -> Unfolding Source #

Expose the unfolding if there is one, including for loop breakers

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

Create a template local for a series of types

idScaledType :: Id -> Scaled Type Source #

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

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

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`

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

Make a local CoVar

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 #

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 #

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

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

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

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

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

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

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

Workers get local names. CoreTidy will externalise these if necessary

idMult :: Id -> Mult Source #

idUnique :: Id -> Unique Source #

idDetails :: Id -> IdDetails Source #

recordSelectorTyCon_maybe :: Id -> Maybe RecSelParent Source #

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

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

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

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

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

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

globaliseId :: Id -> Id Source #

If it's a local, make it global

localiseId :: Id -> Id Source #

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

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

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

zapLamIdInfo :: Id -> Id Source #

zapIdDemandInfo :: Id -> Id Source #

zapIdUsageEnvInfo :: Id -> Id Source #

zapIdUsedOnceInfo :: Id -> Id Source #

zapIdTailCallInfo :: Id -> Id Source #

zapFragileIdInfo :: Id -> Id Source #

zapIdDmdSig :: Id -> Id Source #

transferPolyIdInfo :: Id -> [Var] -> Id -> Id 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.

isStrictId :: Id -> Bool Source #

`isStrictId` says whether either (a) the `Id` has a strict demand placed on it or (b) definitely has a "strict type", such that it can always be evaluated strictly (i.e an unlifted type) We need to check (b) as well as (a), because when 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`. Returns False if the type is levity polymorphic; False is always safe.

isNaughtyRecordSelector :: Id -> Bool Source #

isPatSynRecordSelector :: Id -> Bool Source #

isDataConRecordSelector :: Id -> Bool Source #

isClassOpId :: Id -> Bool Source #

isDFunId :: Id -> Bool Source #

isPrimOpId_maybe :: Id -> Maybe PrimOp Source #

isFCallId_maybe :: Id -> Maybe ForeignCall Source #

isDataConWorkId_maybe :: Id -> Maybe DataCon Source #

isDataConWrapId :: Id -> Bool Source #

isDataConWrapId_maybe :: Id -> Maybe DataCon Source #

isConLikeId :: Id -> Bool Source #

isWorkerLikeId :: Id -> Bool Source #

An Id for which we might require all callers to pass strict arguments properly tagged + evaluated.

See Note [CBV Function Ids]

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

hasNoBinding :: Id -> Bool Source #

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

type JoinId = Id Source #

idJoinArity :: JoinId -> JoinArity Source #

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

asJoinId_maybe :: Id -> JoinPointHood -> Id infixl 1 Source #

zapJoinId :: Id -> Id Source #

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

idRuleMatchInfo :: Id -> RuleMatchInfo Source #

setOneShotLambda :: Id -> Id Source #

clearOneShotLambda :: Id -> Id Source #

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

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

idArity :: Id -> Arity Source #

idCallArity :: Id -> Arity Source #

idFunRepArity :: Id -> RepArity Source #

This function counts all arguments post-unarisation, which includes arguments with no runtime representation -- see Note [Unarisation and arity]

idSpecialisation :: Id -> RuleInfo Source #

idCoreRules :: Id -> [CoreRule] Source #

idCafInfo :: Id -> CafInfo infixl 1 Source #

idLFInfo_maybe :: Id -> Maybe LambdaFormInfo Source #

idOneShotInfo :: Id -> OneShotInfo Source #

idOccInfo :: Id -> OccInfo Source #

alwaysActiveUnfoldingFun :: IdUnfoldingFun Source #

Returns an unfolding only if (a) not a strong loop breaker and (b) always active

whenActiveUnfoldingFun :: (Activation -> Bool) -> IdUnfoldingFun Source #

Returns an unfolding only if (a) not a strong loop breaker and (b) active in according to is_active

noUnfoldingFun :: IdUnfoldingFun Source #

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

zapIdUnfolding :: Id -> Id Source #

Similar to trimUnfolding, but also removes evaldness info.

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

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

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

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

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

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

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

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

setIdDmdSig :: Id -> DmdSig -> Id infixl 1 Source #

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

setIdCbvMarks :: Id -> [CbvMark] -> Id infixl 1 Source #

If all marks are NotMarkedStrict we just set nothing.

idCbvMarks_maybe :: Id -> Maybe [CbvMark] Source #

idCbvMarkArity :: Id -> Arity Source #

asWorkerLikeId :: Id -> Id Source #

Turn this id into a WorkerLikeId if possible.

asNonWorkerLikeId :: Id -> Id Source #

Remove any cbv marks on arguments from a given Id.

idDemandInfo :: Id -> Demand Source #

idDmdSig :: Id -> DmdSig Source #

Accesses the `Id'`s `dmdSigInfo`.

idCprSig :: Id -> CprSig Source #

idTagSig_maybe :: Id -> Maybe TagSig Source #

setIdTagSig :: Id -> TagSig -> Id 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

module GHC.Types.Id.Info

module GHC.Types.PkgQual

module GHC.Core.Opt.Monad

module GHC.Core.Opt.Pipeline.Types

module GHC.Core.Opt.Stats

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.

Note that this is a superset of the variables that are currently in scope. See Note [The InScopeSet invariant].

"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 #

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

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

data Subst Source #

Type & coercion & id substitution

The Subst data type defined in this module contains substitution for tyvar, covar and id. However, operations on IdSubstEnv (mapping from Id to CoreExpr) that require the definition of the Expr data type are defined in GHC.Core.Subst to avoid circular module dependency.

Constructors

Subst InScopeSet IdSubstEnv TvSubstEnv CvSubstEnv |

#### Instances

Instances details

Outputable Subst Source # |
Instance details Defined in GHC.Core.TyCo.Subst Methods ppr :: Subst -> SDoc 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

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 Note [The substitution invariant] holds after extending the substitution like this.

zapSubst :: Subst -> Subst Source #

Remove all substitutions that might have been built up while preserving the in-scope set originally called zapSubstEnv

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

Drop free vars from the breakpoint if they have a non-variable substitution.

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

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

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

type TvSubstEnv = TyVarEnv Type Source #

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

type IdSubstEnv = IdEnv CoreExpr Source #

A substitution of `Expr`s for non-coercion `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

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

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

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

substTyUnchecked :: Subst -> 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.

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 IdSubstEnv]

substExprSC :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr 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.

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

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

Find the substitution for an `Id` in the `Subst` The Id should not be a CoVar

lookupIdSubst_maybe :: HasDebugCallStack => Subst -> Id -> Maybe CoreExpr Source #

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

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

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

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

Substitute into some `IdInfo` with regard to the supplied new `Id`. Discards unfoldings, unless they are Stable

emptySubst :: Subst Source #

mkEmptySubst :: InScopeSet -> Subst Source #

mkTCvSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> 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

isEmptySubst :: Subst -> Bool Source #

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

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

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

extendIdSubstWithClone :: Subst -> Id -> Id -> Subst Source #

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 #

extendSubstInScope :: Subst -> Var -> Subst Source #

Add the `Var` to the in-scope set

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

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

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

getSubstInScope :: Subst -> InScopeSet Source #

Find the in-scope set: see Note [The substitution invariant]

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

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

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

Substitutes a `Var` 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 :: Traversable f => Subst -> f Var -> (Subst, f Var) Source #

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

substRecBndrs :: Traversable f => Subst -> f Id -> (Subst, f Id) Source #

Substitute in a mutually recursive group of `Id`s

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

cloneBndrs :: MonadUnique m => Subst -> [Var] -> m (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. Discards non-Stable unfoldings

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

Applies `cloneIdBndr` to a number of `Id`s, accumulating a final substitution from left to right Discards non-Stable unfoldings

cloneRecIdBndrs :: MonadUnique m => Subst -> [Id] -> m (Subst, [Id]) Source #

Clone a mutually recursive group of `Id`s

module GHC.Core.Rules

module GHC.Types.Annotations

module GHC.Driver.Session

module GHC.Driver.Ppr

module GHC.Unit.State

module GHC.Unit.Module

module GHC.Unit.Home

data Type Source #

#### Instances

Instances details

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

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

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

mkFunTy :: HasDebugCallStack => FunTyFlag -> Mult -> Type -> Type -> Type infixr 3 Source #

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`

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

type Kind = Type Source #

The key type representing kinds in the compiler.

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

NFData Specificity Source # |
Instance details Defined in GHC.Types.Var Methods rnf :: 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 #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Specificity # toConstr :: Specificity -> Constr # dataTypeOf :: Specificity -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Specificity) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Specificity) # gmapT :: (forall b. Data b => b -> b) -> Specificity -> Specificity # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r # gmapQ :: (forall d. Data d => d -> u) -> Specificity -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Specificity -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity #
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 #

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

type TyVar = Var Source #

Type or kind Variable

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.

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"

type ThetaType = [PredType] Source #

A collection of `PredType`s

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

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 -> JoinPointHood Source #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var # toConstr :: Var -> Constr # dataTypeOf :: Var -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) # gmapT :: (forall b. Data b => b -> b) -> Var -> Var # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var #
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 #
Eq (DeBruijn Var) Source # |
Instance details Defined in GHC.Core.Map.Type Methods (==) :: DeBruijn Var -> DeBruijn Var -> Bool # (/=) :: DeBruijn Var -> DeBruijn Var -> Bool #
OutputableBndr (Id, TagSig) Source # |
Instance details Defined in GHC.Stg.InferTags.TagSig Methods pprBndr :: BindingSite -> (Id, TagSig) -> SDoc Source # pprPrefixOcc :: (Id, TagSig) -> SDoc Source # pprInfixOcc :: (Id, TagSig) -> SDoc Source # bndrIsJoin_maybe :: (Id, TagSig) -> JoinPointHood Source #
type Anno Id Source # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN

liftedTypeKind :: Type Source #

unliftedTypeKind :: Type Source #

funTyFlagTyCon :: FunTyFlag -> TyCon Source #

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.

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

Extract the `Levity` of a type. For example, `getLevity Int = Lifted`, or `getLevity (Array# Int) = Unlifted`.

Panics if this is not possible. Does not look through type family applications.

type TyVarBinder = VarBndr TyVar ForAllTyFlag Source #

binderVar :: VarBndr tv argf -> tv Source #

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

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

type TyCoVar = Id Source #

Type or Coercion Variable

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

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

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

data Subst Source #

Type & coercion & id substitution

The Subst data type defined in this module contains substitution for tyvar, covar and id. However, operations on IdSubstEnv (mapping from Id to CoreExpr) that require the definition of the Expr data type are defined in GHC.Core.Subst to avoid circular module dependency.

Constructors

Subst InScopeSet IdSubstEnv TvSubstEnv CvSubstEnv |

#### Instances

Instances details

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

substTyVarBndr :: HasDebugCallStack => Subst -> TyVar -> (Subst, TyVar) Source #

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.

pattern OneTy :: Mult Source #

pattern ManyTy :: Mult Source #

data Scaled a Source #

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

#### Instances

Instances details

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

unrestricted :: a -> Scaled a Source #

Scale a payload by Many

linear :: a -> Scaled a Source #

Scale a payload by One

tymult :: a -> Scaled a Source #

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

irrelevantMult :: Scaled a -> a Source #

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

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

tyConAppArgs :: HasCallStack => Type -> [Type] Source #

tyCoVarsOfType :: Type -> TyCoVarSet 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 representation-polymorphic case)

closeOverKindsDSet :: DTyVarSet -> DTyVarSet Source #

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

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

Returns True if a type has a syntactically fixed runtime rep, as per Note [Fixed RuntimeRep] in GHC.Tc.Utils.Concrete.

This function is equivalent to `isFixedRuntimeRepKind . typeKind` but much faster.

Precondition: The type has kind `(`TYPE` blah)`

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

Add a substitution from a `CoVar` to a `Coercion` to the `Subst`: you must ensure that the in-scope set satisfies Note [The substitution invariant] after extending the substitution like this

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

zapSubst :: Subst -> Subst Source #

Remove all substitutions that might have been built up while preserving the in-scope set originally called zapSubstEnv

data PiTyBinder Source #

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

#### Instances

Instances details

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

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

getTyVar_maybe :: Type -> Maybe TyVar Source #

Attempts to obtain the type variable underlying a `Type`

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

tcSplitTyConApp_maybe splits a type constructor application into its type constructor and applied types.

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

Note that this may fail (in funTyConAppTy_maybe) 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`. This isn't usually a problem but may be temporarily the case during canonicalization: see Note [Decomposing FunTy] in GHC.Tc.Solver.Equality and Note [The Purely Kinded Type Invariant (PKTI)] in GHC.Tc.Gen.HsType, Wrinkle around FunTy

Consequently, you may need to zonk your type before using this function.

tyVarKind :: TyVar -> Kind Source #

seqType :: Type -> () Source #

isTyVar :: Var -> Bool Source #

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

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

typeSize :: Type -> Int Source #

type TvSubstEnv = TyVarEnv Type Source #

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

type IdSubstEnv = IdEnv CoreExpr Source #

A substitution of `Expr`s for non-coercion `Id`s

substTyUnchecked :: Subst -> 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.

emptySubst :: Subst Source #

mkEmptySubst :: InScopeSet -> Subst Source #

mkTCvSubst :: InScopeSet -> TvSubstEnv -> CvSubstEnv -> Subst Source #

isEmptySubst :: Subst -> Bool Source #

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

extendSubstInScope :: Subst -> Var -> Subst Source #

Add the `Var` to the in-scope set

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

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

extendSubstInScopeSet :: Subst -> VarSet -> Subst Source #

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

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

getSubstInScope :: Subst -> InScopeSet Source #

Find the in-scope set: see Note [The substitution invariant]

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 does not look through type family applications.

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

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

Just like splitAppTyNoView_maybe, but does not split (c => t) See Note [Decomposing fat arrow c=>t]

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

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

tyCoVarsOfTypes :: [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.

tyCoFVsBndr :: ForAllTyBinder -> FV -> FV Source #

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

tyCoFVsVarBndrs :: [Var] -> 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.

coVarsOfType :: Type -> CoVarSet Source #

coVarsOfTypes :: [Type] -> CoVarSet Source #

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

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

noFreeVarsOfType :: Type -> Bool 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.

occCheckExpand :: [Var] -> Type -> Maybe Type 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

tyCoVarsOfTypeWellScoped :: Type -> [TyVar] Source #

Get the free vars of a type in scoped order

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

Get the free vars of types in scoped order

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

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

closeOverKinds :: TyCoVarSet -> TyCoVarSet Source #

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

rewriterView :: Type -> Maybe Type Source #

pickyIsLiftedTypeKind :: Kind -> Bool Source #

splitForAllReqTyBinders :: Type -> ([ReqTyBinder], Type) Source #

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

splitForAllInvisTyBinders :: Type -> ([InvisTyBinder], Type) Source #

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

type KindOrType = Type Source #

The key representation of types within the compiler

type RuntimeRepType = Type Source #

Type synonym used for types of kind RuntimeRep.

type KnotTied (ty :: k) = 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

type FRRType = Type Source #

data ForAllTyFlag Source #

ForAllTyFlag

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, ForAllTyBinders, TyConBinders, and visibility] in GHC.Core.TyCo.Rep

Constructors

Invisible !Specificity |
Required |

Bundled Patterns

pattern Specified :: ForAllTyFlag |
pattern Inferred :: ForAllTyFlag |

#### Instances

Instances details

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

data FunTyFlag Source #

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

Constructors

FTF_T_T |
FTF_T_C |
FTF_C_T |
FTF_C_C |

#### Instances

Instances details

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

mkTyVarTy :: TyVar -> Type Source #

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

mkVisFunTy :: HasDebugCallStack => Mult -> Type -> Type -> Type Source #

mkScaledFunTys :: HasDebugCallStack => [Scaled Type] -> Type -> Type Source #

mkInvisFunTy :: HasDebugCallStack => Type -> Type -> Type infixr 3 Source #

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

tcMkVisFunTy :: Mult -> Type -> Type -> Type Source #

tcMkInvisFunTy :: TypeOrConstraint -> Type -> Type -> Type Source #

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

mkForAllTy :: ForAllTyBinder -> Type -> Type Source #

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

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

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

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

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

mkPiTy :: HasDebugCallStack => PiTyBinder -> Type -> Type Source #

mkPiTys :: HasDebugCallStack => [PiTyBinder] -> Type -> Type Source #

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

Make nested arrow types | Special, common, case: Arrow type with mult Many

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

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 -> ForAllTyFlag -> env The returned env is used in the extended scope

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

noView :: Type -> Maybe Type Source #

A view function that looks through nothing.

chooseFunTyFlag :: HasDebugCallStack => Type -> Type -> FunTyFlag Source #

See GHC.Types.Var Note [FunTyFlag]

typeTypeOrConstraint :: HasDebugCallStack => Type -> TypeOrConstraint Source #

emptyTvSubstEnv :: TvSubstEnv Source #

composeTCvSubst :: Subst -> Subst -> Subst Source #

Composes two substitutions, applying the second one provided first, like in function composition. This function leaves IdSubstEnv untouched because IdSubstEnv is not used during substitution for types.

isEmptyTCvSubst :: Subst -> Bool Source #

Checks whether the tyvar and covar environments are empty. This function should be used over `isEmptySubst` when substituting for types, because types currently do not contain expressions; we can safely disregard the expression environment when deciding whether to skip a substitution. Using `isEmptyTCvSubst` gives us a non-trivial performance boost (up to 70% less allocation for T18223)

getTvSubstEnv :: Subst -> TvSubstEnv Source #

getSubstRangeTyCoFVs :: Subst -> VarSet Source #

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

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

extendTCvSubstWithClone :: Subst -> TyCoVar -> TyCoVar -> Subst Source #

extendTvSubstBinderAndInScope :: Subst -> PiTyBinder -> Type -> Subst Source #

extendTvSubstWithClone :: Subst -> TyVar -> TyVar -> Subst Source #

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

unionSubst :: Subst -> Subst -> Subst Source #

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

The InScopeSet is just a thunk so with a bit of luck it'll never be evaluated

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

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

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

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

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

Generates the in-scope set for the `TCvSubst` from the types in the incoming environment. No CoVars, please! The InScopeSet is just a thunk so with a bit of luck it'll never be evaluated

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

Type substitution, see `zipTvSubst`

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

Type substitution, see `zipTvSubst`

substTyAddInScope :: HasDebugCallStack => Subst -> 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].

substScaledTy :: HasDebugCallStack => Subst -> Scaled Type -> Scaled Type Source #

substTysUnchecked :: Subst -> [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.

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

substThetaUnchecked :: Subst -> 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.

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.

substScaledTyUnchecked :: HasDebugCallStack => Subst -> Scaled Type -> Scaled Type Source #

substCoUnchecked :: Subst -> 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.

substTys :: HasDebugCallStack => Subst -> [Type] -> [Type] Source #

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

substScaledTys :: HasDebugCallStack => Subst -> [Scaled Type] -> [Scaled Type] Source #

substTheta :: HasDebugCallStack => Subst -> ThetaType -> ThetaType Source #

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

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

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

substVarBndr :: HasDebugCallStack => Subst -> TyCoVar -> (Subst, TyCoVar) Source #

substVarBndrs :: HasDebugCallStack => Subst -> [TyCoVar] -> (Subst, [TyCoVar]) Source #

substTyVarBndrs :: HasDebugCallStack => Subst -> [TyVar] -> (Subst, [TyVar]) Source #

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

substTyVarToTyVar :: HasDebugCallStack => Subst -> TyVar -> TyVar Source #

substTyCoBndr :: Subst -> PiTyBinder -> (Subst, PiTyBinder) Source #

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

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

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

isCoercionTy :: Type -> Bool 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]

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

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.

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

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 #

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

tidyTopType :: Type -> Type Source #

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

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

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

mkTyConTy :: TyCon -> Type Source #

(mkTyConTy tc) returns (TyConApp tc []) but arranges to share that TyConApp among all calls See Note [Sharing nullary TyConApps] So it's just an alias for tyConNullaryTy!

isLiftedTypeKind :: Kind -> Bool Source #

Returns True if the argument is (lifted) Type or Constraint See Note [TYPE and CONSTRAINT] in GHC.Builtin.Types.Prim

type ForAllTyBinder = VarBndr TyCoVar ForAllTyFlag Source #

Variable Binder

A `ForAllTyBinder` 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

getTyVar :: HasDebugCallStack => 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`

repGetTyVar_maybe :: Type -> Maybe TyVar Source #

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

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

mkAppTys :: Type -> [Type] -> 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

splitAppTys :: HasDebugCallStack => 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.

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

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

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!

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 (FunTyFlag, Mult, Type, Type) Source #

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

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

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

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

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"

funTyConAppTy_maybe :: FunTyFlag -> Type -> Type -> Type -> Maybe (TyCon, [Type]) Source #

Given the components of a FunTy figure out the corresponding TyConApp.

tyConAppFunTy_maybe :: HasDebugCallStack => TyCon -> [Type] -> Maybe Type Source #

Return Just if this TyConApp should be represented as a FunTy

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

Return Just if this TyConAppCo should be represented as a FunCo

mkFunctionType :: HasDebugCallStack => Mult -> Type -> Type -> Type Source #

This one works out the FunTyFlag from the argument type See GHC.Types.Var Note [FunTyFlag]

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

Like mkFunctionType, compute the FunTyFlag from the arguments

tyConAppTyCon_maybe :: Type -> Maybe TyCon Source #

The same as `fst . splitTyConApp` We can short-cut the FunTy case

tyConAppTyConPicky_maybe :: Type -> Maybe TyCon Source #

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

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

The same as `snd . splitTyConApp`

tyConAppTyCon :: HasDebugCallStack => Type -> TyCon 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

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

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

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

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

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

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

Like mkForAllTys, but assumes all variables are dependent and visible

mkTyCoForAllTy :: TyCoVar -> ForAllTyFlag -> Type -> Type Source #

Make a dependent forall over a TyCoVar

mkTyCoForAllTys :: [ForAllTyBinder] -> Type -> Type Source #

Make a dependent forall over a TyCoVar

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

Make a dependent forall over an `Inferred` variable

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

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

Like `splitForAllTyCoVars`, but split only for tyvars. 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.

splitForAllForAllTyBinders :: Type -> ([ForAllTyBinder], Type) Source #

Take a ForAllTy apart, returning the binders and result type

splitForAllForAllTyBinder_maybe :: Type -> Maybe (ForAllTyBinder, Type) Source #

Attempts to take a ForAllTy apart, returning the full ForAllTyBinder

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

Attempts to take a ForAllTy apart, returning the Var

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

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

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

Attempts to take a ForAllTy apart, but only if the binder is a TyVar

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

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

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

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

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

Takes a forall type apart, or panics

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

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

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

Extracts a list of run-time arguments from a function type, looking through newtypes to the right of arrows.

Examples:

       newtype Identity a = I a

       getRuntimeArgTys (Int -> Bool -> Double) == [(Int, FTF_T_T), (Bool, FTF_T_T)]
       getRuntimeArgTys (Identity Int -> Bool -> Double) == [(Identity Int, FTF_T_T), (Bool, FTF_T_T)]
       getRuntimeArgTys (Int -> Identity (Bool -> Identity Double)) == [(Int, FTF_T_T), (Bool, FTF_T_T)]
       getRuntimeArgTys (forall a. Show a => Identity a -> a -> Int -> Bool)
                == [(Show a, FTF_C_T), (Identity a, FTF_T_T),(a, FTF_T_T),(Int, FTF_T_T)]

Note that, in the last case, the returned types might mention an out-of-scope type variable. This function is used only when we really care about the kinds of the returned types, so this is OK.

- *Warning**: this function can return an infinite list. For example:

      newtype N a = MkN (a -> N a)
      getRuntimeArgTys (N a) == repeat (a, FTF_T_T)

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 PiTyBinders, 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.

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

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.

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

dropForAlls :: Type -> Type Source #

Drops all ForAllTys

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)

buildSynTyCon Source #

Arguments

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

mkNumLitTy :: Integer -> Type Source #

isNumLitTy :: Type -> Maybe Integer Source #

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

mkStrLitTy :: FastString -> Type Source #

isStrLitTy :: Type -> Maybe FastString Source #

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

mkCharLitTy :: Char -> Type Source #

isCharLitTy :: Type -> Maybe Char Source #

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

isLitTy :: Type -> Maybe TyLit Source #

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

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

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

splitRuntimeRep_maybe :: RuntimeRepType -> Maybe (TyCon, [Type]) Source #

(splitRuntimeRep_maybe rr) takes a Type rr :: RuntimeRep, and returns the (TyCon,[Type]) for the RuntimeRep, if possible, where the TyCon is one of the promoted DataCons of RuntimeRep. Remember: the unique on TyCon that is a a promoted DataCon is the same as the unique on the DataCon See Note [Promoted data constructors] in GHC.Core.TyCon May not be possible if `rr` is a type variable or type family application

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

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

kindRep :: HasDebugCallStack => Kind -> RuntimeRepType 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

levityType_maybe :: LevityType -> Maybe Levity Source #

`levityType_maybe` takes a Type of kind Levity, and returns its levity May not be possible for a type variable or type family application

mkCoercionTy :: Coercion -> Type Source #

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

type ErrorMsgType = Type Source #

A type of kind `ErrorMessage` (from the `TypeError` module).

userTypeError_maybe :: Type -> Maybe ErrorMsgType Source #

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

deepUserTypeError_maybe :: Type -> Maybe ErrorMsgType Source #

pprUserTypeErrorTy :: ErrorMsgType -> SDoc Source #

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

coAxNthLHS :: forall (br :: BranchFlag). CoAxiom br -> Int -> Type Source #

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

stripCoercionTy :: Type -> Coercion Source #

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

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

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

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

invisibleTyBndrCount :: Type -> Int Source #

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

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

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

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

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

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

tyConForAllTyFlags :: TyCon -> [Type] -> [ForAllTyFlag] 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
    tyConForAllTyFlags 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.

appTyForAllTyFlags :: Type -> [Type] -> [ForAllTyFlag] 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 `appTyForAllTyFlags` comes in handy, since `f Type Bool` would be represented in Core using `AppTy`s. (See also #15792).

data TyCoMapper env (m :: Type -> Type) 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 :: forall r. env -> TyCoVar -> ForAllTyFlag -> (env -> TyCoVar -> m r) -> m r 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

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 #

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.

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

Make a named binder

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

Make many named binders

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

isAnonPiTyBinder :: PiTyBinder -> Bool Source #

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

binderType :: VarBndr TyCoVar argf -> Type Source #

binderFlag :: VarBndr tv argf -> argf Source #

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

piTyBinderType :: PiTyBinder -> Type Source #

namedPiTyBinder_maybe :: PiTyBinder -> Maybe TyCoVar Source #

anonPiTyBinderType_maybe :: PiTyBinder -> Maybe Type Source #

Extract a relevant type, if there is one.

isVisibleForAllTyFlag :: ForAllTyFlag -> Bool Source #

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

isInvisibleForAllTyFlag :: ForAllTyFlag -> Bool Source #

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

isVisiblePiTyBinder :: PiTyBinder -> Bool Source #

Does this binder bind a visible argument?

isInvisiblePiTyBinder :: PiTyBinder -> Bool Source #

Does this binder bind an invisible argument?

isNamedPiTyBinder :: PiTyBinder -> Bool Source #

tyConBindersPiTyBinders :: [TyConBinder] -> [PiTyBinder] Source #

isTyVarTy :: Type -> Bool Source #

isFunTy :: Type -> Bool Source #

Is this a function?

isCoercionTy_maybe :: Type -> Maybe Coercion Source #

isForAllTy :: Type -> Bool Source #

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

isForAllTy_ty :: Type -> Bool Source #

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

isForAllTy_co :: Type -> Bool Source #

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

isForAllTy_invis_ty :: Type -> Bool Source #

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

isPiTy :: Type -> Bool Source #

Is this a function or forall?

isTauTy :: Type -> Bool Source #

isFamFreeTy :: Type -> Bool Source #

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

isAtomicTy :: Type -> Bool Source #

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]

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.)

mkTYPEapp :: RuntimeRepType -> Type Source #

mkTYPEapp_maybe :: RuntimeRepType -> Maybe Type Source #

Given a `RuntimeRep`, applies `TYPE` to it. On the fly it rewrites TYPE LiftedRep --> liftedTypeKind (a synonym) TYPE UnliftedRep --> unliftedTypeKind (ditto) TYPE ZeroBitRep --> zeroBitTypeKind (ditto) NB: no need to check for TYPE (BoxedRep Lifted), TYPE (BoxedRep Unlifted) because those inner types should already have been rewritten to LiftedRep and UnliftedRep respectively, by mkTyConApp

see Note [TYPE and CONSTRAINT] in GHC.Builtin.Types.Prim. See Note [Using synonyms to compress types] in GHC.Core.Type

mkCONSTRAINTapp :: RuntimeRepType -> Type Source #

Just like mkTYPEapp

mkCONSTRAINTapp_maybe :: RuntimeRepType -> Maybe Type Source #

Just like mkTYPEapp_maybe

mkBoxedRepApp_maybe :: LevityType -> Maybe Type Source #

Given a `Levity`, apply `BoxedRep` to it On the fly, rewrite BoxedRep Lifted --> liftedRepTy (a synonym) BoxedRep Unlifted --> unliftedRepTy (ditto) See Note [TYPE and CONSTRAINT] in GHC.Builtin.Types.Prim. See Note [Using synonyms to compress types] in GHC.Core.Type

mkTupleRepApp_maybe :: Type -> Maybe Type Source #

Given a `[RuntimeRep]`, apply `TupleRep` to it On the fly, rewrite TupleRep [] -> zeroBitRepTy (a synonym) See Note [TYPE and CONSTRAINT] in GHC.Builtin.Types.Prim. See Note [Using synonyms to compress types] in GHC.Core.Type

typeOrConstraintKind :: TypeOrConstraint -> RuntimeRepType -> Kind Source #

sORTKind_maybe :: Kind -> Maybe (TypeOrConstraint, Type) Source #

typeLevity :: HasDebugCallStack => Type -> Levity Source #

typeLevity_maybe :: HasDebugCallStack => Type -> Maybe Levity Source #

Tries to compute the `Levity` of the given type. Returns either a definite `Levity`, or `Nothing` if we aren't sure (e.g. the type is representation-polymorphic).

Panics if the kind does not have the shape `TYPE r`.

tyConIsTYPEorCONSTRAINT :: TyCon -> Bool Source #

isUnliftedTypeKind :: Kind -> Bool Source #

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

isLiftedRuntimeRep :: RuntimeRepType -> Bool Source #

Check whether a type of kind `RuntimeRep` is lifted.

`isLiftedRuntimeRep` is:

- True of `LiftedRep :: RuntimeRep`
- False of type variables, type family applications, and of other reps such as `IntRep :: RuntimeRep`.

isUnliftedRuntimeRep :: RuntimeRepType -> Bool Source #

Check whether a type of kind `RuntimeRep` is unlifted.

- True of definitely unlifted `RuntimeRep`s such as `UnliftedRep`, `IntRep`, `FloatRep`, ...
- False of `LiftedRep`,
- False for type variables and type family applications.

runtimeRepLevity_maybe :: RuntimeRepType -> Maybe Levity Source #

Check whether a type (usually of kind `RuntimeRep`) is lifted, unlifted, or unknown. Returns Nothing if the type isn't of kind `RuntimeRep`.

`runtimeRepLevity_maybe rr` returns:

- `Just Lifted` if `rr` is `LiftedRep :: RuntimeRep`
- `Just Unlifted` if `rr` is definitely unlifted, e.g. `IntRep`
- `Nothing` if not known (e.g. it's a type variable or a type family application).

isBoxedRuntimeRep :: RuntimeRepType -> Bool Source #

See `isBoxedRuntimeRep_maybe`.

isLiftedLevity :: Type -> Bool Source #

isUnliftedLevity :: Type -> Bool Source #

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

Is the given type definitely unlifted? See Type for what an unlifted type is.

Panics on representation-polymorphic types; See `mightBeUnliftedType` for a more approximate predicate that behaves better in the presence of representation polymorphism.

isBoxedType :: Type -> Bool Source #

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

isUnboxedTupleType :: Type -> Bool Source #

isUnboxedSumType :: Type -> Bool Source #

kindBoxedRepLevity_maybe :: Type -> Maybe Levity Source #

Check whether a kind is of the form `TYPE (BoxedRep Lifted)` or `TYPE (BoxedRep Unlifted)`.

Returns:

- `Just Lifted` for `TYPE (BoxedRep Lifted)` and `Type`,
- `Just Unlifted` for `TYPE (BoxedRep Unlifted)` and `UnliftedType`,
- `Nothing` for anything else, e.g. `TYPE IntRep`, `TYPE (BoxedRep l)`, etc.

mightBeLiftedType :: Type -> Bool Source #

Returns:

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

definitelyLiftedType :: Type -> Bool Source #

definitelyUnliftedType :: Type -> Bool Source #

isDataFamilyAppType :: Type -> Bool Source #

Check whether a type is a data family type

isPrimitiveType :: Type -> Bool Source #

Returns true of types that are opaque to Haskell.

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 representation-polymorphic types.

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

True = a term of this type cannot be bottom This identifies the types described by Note [NON-BOTTOM-DICTS invariant] in GHC.Core NB: unlifted types are not terminating types! e.g. you can write a term (loop 1)::Int# that diverges.

isLevityTy :: Type -> Bool Source #

Is this the type `Levity`?

isLevityVar :: TyVar -> Bool Source #

Is a tyvar of type `Levity`?

isRuntimeRepTy :: Type -> Bool Source #

Is this the type `RuntimeRep`?

isRuntimeRepVar :: TyVar -> Bool Source #

Is a tyvar of type `RuntimeRep`?

isRuntimeRepKindedTy :: Type -> Bool Source #

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

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#]

isMultiplicityTy :: Type -> Bool Source #

Is this the type `Multiplicity`?

isMultiplicityVar :: TyVar -> Bool Source #

Is a tyvar of type `Multiplicity`?

isOneTy :: Mult -> Bool Source #

isManyTy :: Mult -> Bool Source #

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.

tcIsLiftedTypeKind :: Kind -> Bool Source #

Is this kind equivalent to `Type` i.e. TYPE LiftedRep?

isConstraintKind :: Kind -> Bool Source #

isConstraintLikeKind :: Kind -> Bool Source #

returnsConstraintKind :: Kind -> Bool Source #

tcIsBoxedTypeKind :: Kind -> Bool Source #

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

isTypeLikeKind :: Kind -> Bool Source #

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

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

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`

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

coreFullView :: Type -> Type Source #

Iterates `coreView` until there is no more to synonym to expand. NB: coreFullView is non-recursive and can be inlined; core_full_view is the recursive one See Note [Inlining coreView].

isTYPEorCONSTRAINT :: Kind -> Bool Source #

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

True of a kind `TYPE _` or `CONSTRAINT _`

isConcreteType :: Type -> Bool Source #

Tests whether the given type is concrete, i.e. it whether it consists only of concrete type constructors, concrete type variables, and applications.

See Note [Concrete types] in GHC.Tc.Utils.Concrete.

isFixedRuntimeRepKind :: HasDebugCallStack => Kind -> Bool Source #

Checks that a kind of the form `Type`, `Constraint` or `'TYPE r` is concrete. See `isConcreteType`.

Precondition: The type has kind `TYPE blah` or `CONSTRAINT blah`

module GHC.Core.TyCon

data Coercion Source #

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

#### Instances

Instances details

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

data Role Source #

See Note [Roles] in GHC.Core.Coercion

Order of constructors matters: the Ord instance coincides with the *super*typing relation on roles.

Constructors

Nominal |
Representational |
Phantom |

#### Instances

Instances details

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 #
Data Role Source # |
Instance details Defined in Language.Haskell.Syntax.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Role -> c Role # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Role # toConstr :: Role -> Constr # dataTypeOf :: Role -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Role) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Role) # gmapT :: (forall b. Data b => b -> b) -> Role -> Role # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r # gmapQ :: (forall d. Data d => d -> u) -> Role -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Role -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Role -> m Role # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role #
Eq Role Source # |
Instance details Defined in Language.Haskell.Syntax.Basic Methods (==) :: Role -> Role -> Bool # (/=) :: Role -> Role -> Bool #
Ord Role Source # |
Instance details Defined in Language.Haskell.Syntax.Basic 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) = EpAnnCO
type Anno (Maybe Role) Source # |
Instance details Defined in GHC.Hs.Decls type Anno (Maybe Role) = EpAnnCO

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

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 -> JoinPointHood Source #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var # toConstr :: Var -> Constr # dataTypeOf :: Var -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) # gmapT :: (forall b. Data b => b -> b) -> Var -> Var # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var #
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 #
Eq (DeBruijn Var) Source # |
Instance details Defined in GHC.Core.Map.Type Methods (==) :: DeBruijn Var -> DeBruijn Var -> Bool # (/=) :: DeBruijn Var -> DeBruijn Var -> Bool #
OutputableBndr (Id, TagSig) Source # |
Instance details Defined in GHC.Stg.InferTags.TagSig Methods pprBndr :: BindingSite -> (Id, TagSig) -> SDoc Source # pprPrefixOcc :: (Id, TagSig) -> SDoc Source # pprInfixOcc :: (Id, TagSig) -> SDoc Source # bndrIsJoin_maybe :: (Id, TagSig) -> JoinPointHood Source #
type Anno Id Source # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN

type CoercionN = Coercion Source #

type CoercionR = Coercion Source #

type CoercionP = 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

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

type MCoercionN = MCoercion Source #

type MCoercionR = MCoercion Source #

data CoSel Source #

Constructors

SelTyCon Int Role |
SelFun FunSel |
SelForAll |

#### Instances

Instances details

NFData CoSel Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods rnf :: CoSel -> () Source #
Binary CoSel Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods put_ :: BinHandle -> CoSel -> IO () Source # put :: BinHandle -> CoSel -> IO (Bin CoSel) Source # get :: BinHandle -> IO CoSel Source #
Outputable CoSel Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods ppr :: CoSel -> SDoc Source #
Data CoSel 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) -> CoSel -> c CoSel # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CoSel # toConstr :: CoSel -> Constr # dataTypeOf :: CoSel -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CoSel) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CoSel) # gmapT :: (forall b. Data b => b -> b) -> CoSel -> CoSel # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CoSel -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CoSel -> r # gmapQ :: (forall d. Data d => d -> u) -> CoSel -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CoSel -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CoSel -> m CoSel # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CoSel -> m CoSel # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CoSel -> m CoSel #
Eq CoSel Source # |
Instance details Defined in GHC.Core.TyCo.Rep Methods (==) :: CoSel -> CoSel -> Bool # (/=) :: CoSel -> CoSel -> Bool #

data FunSel Source #

Constructors

SelMult |
SelArg |
SelRes |

#### Instances

Instances details

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

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

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

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) ch_hetero_kind :: Bool

#### Instances

Instances details

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 #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CoercionHole # toConstr :: CoercionHole -> Constr # dataTypeOf :: CoercionHole -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CoercionHole) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CoercionHole) # gmapT :: (forall b. Data b => b -> b) -> CoercionHole -> CoercionHole # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CoercionHole -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CoercionHole -> r # gmapQ :: (forall d. Data d => d -> u) -> CoercionHole -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CoercionHole -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole #

coHoleCoVar :: CoercionHole -> CoVar Source #

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

data LeftOrRight Source #

Constructors

CLeft |
CRight |

#### Instances

Instances details

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 #
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 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LeftOrRight # toConstr :: LeftOrRight -> Constr # dataTypeOf :: LeftOrRight -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LeftOrRight) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LeftOrRight) # gmapT :: (forall b. Data b => b -> b) -> LeftOrRight -> LeftOrRight # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LeftOrRight -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LeftOrRight -> r # gmapQ :: (forall d. Data d => d -> u) -> LeftOrRight -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LeftOrRight -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight #
Eq LeftOrRight Source # |
Instance details Defined in GHC.Types.Basic Methods (==) :: LeftOrRight -> LeftOrRight -> Bool # (/=) :: LeftOrRight -> LeftOrRight -> Bool #

type CoVar = Id Source #

Coercion Variable

type TyCoVar = Id Source #

Type or Coercion Variable

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

coVarRType :: HasDebugCallStack => CoVar -> Type Source #

coVarLType :: HasDebugCallStack => CoVar -> Type Source #

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

coVarKind :: CoVar -> Type Source #

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

coVarRole :: CoVar -> Role Source #

coercionType :: Coercion -> Type Source #

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

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

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 #

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

Apply `coercionKind` to multiple `Coercion`s

coercionRole :: Coercion -> Role Source #

Retrieve the role from a coercion.

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

Get a coercion's kind and role.

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

Make a generalized reflexive coercion

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

Make a reflexive coercion

mkRepReflCo :: Type -> Coercion Source #

Make a representational reflexive coercion

mkNomReflCo :: Type -> Coercion Source #

Make a nominal reflexive coercion

mkCoVarCo :: CoVar -> Coercion Source #

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

mkAxInstCo :: forall (br :: BranchFlag). Role -> CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Coercion Source #

mkUnbranchedAxInstCo :: Role -> CoAxiom Unbranched -> [Type] -> [Coercion] -> Coercion Source #

mkAxInstRHS :: forall (br :: BranchFlag). CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type Source #

mkUnbranchedAxInstRHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type Source #

mkAxInstLHS :: forall (br :: BranchFlag). CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type Source #

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

mkUnbranchedAxInstLHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type Source #

Instantiate the left-hand side of an unbranched axiom

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 #

mkCoCast :: Coercion -> CoercionR -> 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)

mkSelCo :: HasDebugCallStack => CoSel -> Coercion -> Coercion Source #

getNthFun Source #

Arguments

:: FunSel |
-> a | multiplicity
-> a | argument
-> a | result
-> a | One of the above three

Extract the nth field of a FunCo

getNthFromType :: HasDebugCallStack => CoSel -> Type -> Type Source #

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

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

Instantiates a `Coercion`.

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.

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

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

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.

mkFunCo :: Role -> FunTyFlag -> 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)` or `(a => x) ~ (b => y)`, depending on the kind of `a`/`b`. This (most common) version takes a single FunTyFlag, which is used for both fco_afl and ftf_afr of the FunCo

mkFunCo2 :: Role -> FunTyFlag -> FunTyFlag -> CoercionN -> Coercion -> Coercion -> Coercion Source #

mkFunCoNoFTF :: HasDebugCallStack => Role -> CoercionN -> Coercion -> Coercion -> Coercion Source #

mkFunResCo :: Role -> Id -> Coercion -> Coercion Source #

mkNakedFunCo :: Role -> FunTyFlag -> CoercionN -> Coercion -> Coercion -> Coercion Source #

mkNakedForAllCo :: TyVar -> ForAllTyFlag -> ForAllTyFlag -> CoercionN -> Coercion -> Coercion Source #

mkForAllCo :: HasDebugCallStack => TyCoVar -> ForAllTyFlag -> ForAllTyFlag -> CoercionN -> Coercion -> Coercion Source #

Make a Coercion from a tycovar, a kind coercion, and a body coercion.

mkHomoForAllCos :: [ForAllTyBinder] -> Coercion -> Coercion Source #

Make a Coercion quantified over a type/coercion variable; the variable has the same kind and visibility in both sides of the coercion

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.

mkHoleCo :: CoercionHole -> Coercion Source #

Make a coercion from a coercion hole

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.

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

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

mkProofIrrelCo Source #

Arguments

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

Make a "coercion between coercions".

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

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

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

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

Given `ty :: k1`, `co :: k1 ~ k2`, produces `co' :: ty ~r (ty |> co)`

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

Given `r`, `ty :: k1`, and `co :: k1 ~N k2`, produces `co' :: (ty |> co) ~r ty`

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.

mkKindCo :: Coercion -> Coercion Source #

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

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.

mkPrimEqPred :: Type -> Type -> Type Source #

Creates a primitive nominal type equality predicate. t1 ~# t2 Invariant: the types are not Coercions

mkReprPrimEqPred :: Type -> Type -> Type Source #

Creates a primitive representational type equality predicate. t1 ~R# t2 Invariant: the types are not Coercions

mkPrimEqPredRole :: Role -> Type -> Type -> PredType Source #

Makes a lifted equality predicate at the given role

mkNomPrimEqPred :: Kind -> Type -> Type -> Type Source #

Creates a primitive nominal type equality predicate with an explicit (but homogeneous) kind: (~#) k k ty1 ty2

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

If `instNewTyCon_maybe T ts = Just (rep_ty, co)` then `co :: T ts ~R# rep_ty`

Checks for a newtype, and for being saturated

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`.

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

Functor NormaliseStepResult Source # |
Instance details Defined in GHC.Core.Coercion Methods fmap :: (a -> b) -> NormaliseStepResult a -> NormaliseStepResult b # (<$) :: a -> NormaliseStepResult b -> NormaliseStepResult a #
Outputable ev => Outputable (NormaliseStepResult ev) Source # |
Instance details Defined in GHC.Core.Coercion Methods ppr :: NormaliseStepResult ev -> SDoc Source #

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

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`.

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 : ty ~R 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

decomposeCo :: Arity -> Coercion -> Infinite 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 => Coercion -> (CoercionN, Coercion, Coercion) Source #

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

getCoVar_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.)

splitAppCo_maybe :: Coercion -> Maybe (Coercion, Coercion) Source #

Attempt to take a coercion application apart.

splitFunCo_maybe :: Coercion -> Maybe (Coercion, Coercion) Source #

splitForAllCo_maybe :: Coercion -> Maybe (TyCoVar, ForAllTyFlag, ForAllTyFlag, Coercion, Coercion) Source #

splitForAllCo_ty_maybe :: Coercion -> Maybe (TyVar, ForAllTyFlag, ForAllTyFlag, Coercion, Coercion) Source #

Like `splitForAllCo_maybe`, but only returns Just for tyvar binder

splitForAllCo_co_maybe :: Coercion -> Maybe (CoVar, ForAllTyFlag, ForAllTyFlag, Coercion, Coercion) Source #

Like `splitForAllCo_maybe`, but only returns Just for covar binder

tyConRole :: Role -> TyCon -> Int -> Role Source #

tyConRolesX :: Role -> TyCon -> Infinite Role Source #

tyConRolesRepresentational :: TyCon -> Infinite Role Source #

setNominalRole_maybe :: Role -> Coercion -> Maybe CoercionN Source #

Converts a coercion to be nominal, if possible. See Note [Role twiddling functions]

tyConRoleListX :: Role -> TyCon -> [Role] Source #

tyConRoleListRepresentational :: TyCon -> [Role] Source #

funRole :: Role -> FunSel -> Role Source #

pickLR :: LeftOrRight -> (a, a) -> a 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`

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`

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

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

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.

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.

isReflCoVar_maybe :: Var -> Maybe Coercion Source #

isGReflMCo :: MCoercion -> Bool Source #

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

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

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

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

Like `mkCoherenceRightCo`, but with an `MCoercion`

coToMCo :: Coercion -> MCoercion Source #

mkTransMCo :: MCoercion -> MCoercion -> MCoercion Source #

Compose two MCoercions via transitivity

mkTransMCoL :: MCoercion -> Coercion -> MCoercion Source #

mkTransMCoR :: Coercion -> MCoercion -> MCoercion Source #

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

Cast a type by an `MCoercion`

mkSymMCo :: MCoercion -> MCoercion Source #

Get the reverse of an `MCoercion`

mkFunResMCo :: Id -> MCoercionR -> MCoercionR Source #

mkPiMCos :: [Var] -> MCoercion -> MCoercion Source #

isReflMCo :: MCoercion -> Bool Source #

checkReflexiveMCo :: MCoercion -> MCoercion Source #

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

isCoVar :: Var -> Bool Source #

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

coVarName :: CoVar -> Name Source #

setCoVarName :: CoVar -> Name -> CoVar Source #

setCoVarUnique :: CoVar -> Unique -> CoVar Source #

tyCoVarsOfCo :: Coercion -> TyCoVarSet Source #

tyCoVarsOfCos :: [Coercion] -> TyCoVarSet Source #

coVarsOfCo :: Coercion -> CoVarSet Source #

tyCoFVsOfCo :: Coercion -> FV Source #

tyCoFVsOfCos :: [Coercion] -> FV Source #

tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet Source #

Get a deterministic set of the vars free in a coercion

coercionSize :: Coercion -> Int Source #

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

type CvSubstEnv = CoVarEnv Coercion Source #

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

emptyCvSubstEnv :: CvSubstEnv Source #

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

substCos :: HasDebugCallStack => Subst -> [Coercion] -> [Coercion] Source #

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

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

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

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

Coercion substitution, see `zipTvSubst`

substCoVarBndr :: HasDebugCallStack => Subst -> CoVar -> (Subst, CoVar) Source #

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

getCvSubstEnv :: Subst -> CvSubstEnv Source #

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`.

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

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

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

emptyLiftingContext :: InScopeSet -> LiftingContext 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

liftCoSubstVarBndrUsing Source #

Arguments

:: (r -> CoercionN) | coercion getter
-> (LiftingContext -> Type -> r) | callback
-> LiftingContext |
-> TyCoVar |
-> (LiftingContext, TyCoVar, r) |

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

Is a var in the domain of a lifting context?

extendLiftingContextCvSubst :: LiftingContext -> CoVar -> Coercion -> LiftingContext Source #

Extend the substitution component of a lifting context with a new binding for a coercion variable. Used during coercion optimisation.

mkSubstLiftingContext :: Subst -> LiftingContext Source #

zapLiftingContext :: LiftingContext -> LiftingContext Source #

Erase the environments in a lifting context

substForAllCoBndrUsingLC :: Bool -> (Coercion -> Coercion) -> LiftingContext -> TyCoVar -> Coercion -> (LiftingContext, TyCoVar, Coercion) Source #

Like `substForAllCoBndr`, but works on a lifting context

lcLookupCoVar :: LiftingContext -> CoVar -> Maybe Coercion Source #

Lookup a `CoVar` in the substitution in a `LiftingContext`

lcInScopeSet :: LiftingContext -> InScopeSet Source #

Get the `InScopeSet` from a `LiftingContext`

type LiftCoEnv = VarEnv Coercion Source #

data LiftingContext Source #

Constructors

LC Subst LiftCoEnv |

#### Instances

Instances details

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

liftEnvSubstLeft :: Subst -> LiftCoEnv -> Subst Source #

liftEnvSubstRight :: Subst -> LiftCoEnv -> Subst Source #

substRightCo :: LiftingContext -> Coercion -> Coercion Source #

substLeftCo :: LiftingContext -> Coercion -> Coercion Source #

swapLiftCoEnv :: LiftCoEnv -> LiftCoEnv Source #

Apply "sym" to all coercions in a `LiftCoEnv`

lcSubstLeft :: LiftingContext -> Subst Source #

lcSubstRight :: LiftingContext -> Subst 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

seqCo :: Coercion -> () Source #

pprCo :: Coercion -> SDoc Source #

pprParendCo :: Coercion -> SDoc Source #

pprCoAxiom :: forall (br :: BranchFlag). CoAxiom br -> SDoc Source #

pprCoAxBranch :: TyCon -> CoAxBranch -> SDoc Source #

pprCoAxBranchLHS :: TyCon -> CoAxBranch -> SDoc Source #

pprCoAxBranchUser :: TyCon -> CoAxBranch -> SDoc Source #

tidyCoAxBndrsForUser :: TidyEnv -> [Var] -> (TidyEnv, [Var]) Source #

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

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

Tidy a Coercion

See Note [Strictness in tidyType and friends]

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

promoteCoercion :: HasDebugCallStack => Coercion -> CoercionN Source #

like mkKindCo, but aggressively & recursively optimizes to avoid using a KindCo constructor. The output role is nominal.

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.

multToCo :: Mult -> Coercion Source #

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

Given a coercion `co :: (t1 :: TYPE r1) ~ (t2 :: TYPE r2)` produce a coercion `rep_co :: r1 ~ r2` But actually it is possible that co :: (t1 :: CONSTRAINT r1) ~ (t2 :: CONSTRAINT r2) or co :: (t1 :: TYPE r1) ~ (t2 :: CONSTRAINT r2) or co :: (t1 :: CONSTRAINT r1) ~ (t2 :: TYPE r2) See Note [mkRuntimeRepCo]

hasCoercionHoleTy :: Type -> Bool Source #

Is there a hetero-kind coercion hole in this type? (That is, a coercion hole with ch_hetero_kind=True.) See wrinkle (EIK2) of Note [Equalities with incompatible kinds] in GHC.Tc.Solver.Equality

hasCoercionHoleCo :: Coercion -> Bool Source #

Is there a hetero-kind coercion hole in this coercion?

hasThisCoercionHoleTy :: Type -> CoercionHole -> Bool Source #

setCoHoleType :: CoercionHole -> Type -> CoercionHole Source #

Set the type of a `CoercionHole`

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

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

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 #
Show Unique Source # |
Instance details Defined in GHC.Types.Unique Methods showsPrec :: Int -> Unique -> ShowS # show :: Unique -> String # showList :: [Unique] -> ShowS #
Eq Unique Source # |
Instance details Defined in GHC.Types.Unique Methods (==) :: Unique -> Unique -> Bool # (/=) :: Unique -> Unique -> Bool #

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.Reg 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 SymName Source # |
Instance details Defined in GHC.CmmToAsm.Wasm.Types Methods getUnique :: SymName -> 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 Ident Source # |
Instance details Defined in GHC.JS.Ident Methods getUnique :: Ident -> 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 SkolemInfo Source # |
Instance details Defined in GHC.Tc.Types.Origin Methods getUnique :: SkolemInfo -> Unique Source #
Uniquable ConLikeName Source # |
Instance details Defined in GHC.Types.GREInfo Methods getUnique :: ConLikeName -> Unique Source #
Uniquable Name Source # |
Instance details Defined in GHC.Types.Name Methods getUnique :: Name -> Unique Source #
Uniquable NameSpace Source # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: NameSpace -> 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 WarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods getUnique :: WarningCategory -> 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 FieldLabelString Source # |
Instance details Defined in GHC.Types.FieldLabel Methods getUnique :: FieldLabelString -> Unique Source #
Uniquable ModuleName Source # |
Instance details Defined in GHC.Types.Unique Methods getUnique :: ModuleName -> 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 #

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.Tc.Errors.Hole.Plugin

module GHC.Unit.Module.ModGuts

module GHC.Unit.Module.ModSummary

module GHC.Unit.Module.ModIface

module GHC.Types.Meta

module GHC.Types.SourceError

type PsWarning = PsMessage Source #

type PsError = PsMessage Source #

data Messages e Source #

A collection of messages emitted by GHC during error reporting. A diagnostic message is typically a warning or an error. See Note [Messages].

INVARIANT: All the messages in this collection must be relevant, i.e. their `Severity` should not be `SevIgnore`. The smart constructor `mkMessages` will filter out any message which `Severity` is `SevIgnore`.

#### Instances

Instances details

Functor Messages Source # |
Instance details Defined in GHC.Types.Error Methods fmap :: (a -> b) -> Messages a -> Messages b # (<$) :: a -> Messages b -> Messages a #
Foldable Messages Source # |
Instance details Defined in GHC.Types.Error Methods fold :: Monoid m => Messages m -> m # foldMap :: Monoid m => (a -> m) -> Messages a -> m # foldMap' :: Monoid m => (a -> m) -> Messages a -> m # foldr :: (a -> b -> b) -> b -> Messages a -> b # foldr' :: (a -> b -> b) -> b -> Messages a -> b # foldl :: (b -> a -> b) -> b -> Messages a -> b # foldl' :: (b -> a -> b) -> b -> Messages a -> b # foldr1 :: (a -> a -> a) -> Messages a -> a # foldl1 :: (a -> a -> a) -> Messages a -> a # toList :: Messages a -> [a] # null :: Messages a -> Bool # length :: Messages a -> Int # elem :: Eq a => a -> Messages a -> Bool # maximum :: Ord a => Messages a -> a # minimum :: Ord a => Messages a -> a # sum :: Num a => Messages a -> a # product :: Num a => Messages a -> a #
Traversable Messages Source # |
Instance details Defined in GHC.Types.Error Methods traverse :: Applicative f => (a -> f b) -> Messages a -> f (Messages b) # sequenceA :: Applicative f => Messages (f a) -> f (Messages a) # mapM :: Monad m => (a -> m b) -> Messages a -> m (Messages b) # sequence :: Monad m => Messages (m a) -> m (Messages a) #
Diagnostic e => ToJson (Messages e) Source # |
Instance details Defined in GHC.Types.Error Methods json :: Messages e -> JsonDoc Source #
Diagnostic e => Outputable (Messages e) Source # |
Instance details Defined in GHC.Types.Error Methods ppr :: Messages e -> SDoc Source #
Monoid (Messages e) Source # |
Instance details Defined in GHC.Types.Error Methods mempty :: Messages e # mappend :: Messages e -> Messages e -> Messages e # mconcat :: [Messages e] -> Messages e #
Semigroup (Messages e) Source # |
Instance details Defined in GHC.Types.Error Methods (<>) :: Messages e -> Messages e -> Messages e # sconcat :: NonEmpty (Messages e) -> Messages e # stimes :: Integral b => b -> Messages e -> Messages e #

data HsParsedModule Source #

# 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.

thNameToGhcNameIO :: NameCache -> Name -> IO (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.

One must be careful to consistently use the same `NameCache` to create identifier that might be compared. (C.f. how the `ST` Monad enforces that variables from separate `runST` invocations are never intermingled; it would be valid to use the same tricks for `Name`s and `NameCache`s.)

For now, the easiest and recommended way to ensure a consistent `NameCache` is used it to retrieve the preexisting one from an active `HscEnv`. A single `HscEnv` is created per GHC "session", and this ensures everything in that session will get the same name cache.

# 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 #