ghc-6.10.2: The GHC APIContentsIndex
Id
Contents
The main types
Simple construction
Taking an Id apart
Modifying an Id
Predicates on Ids
Inline pragma stuff
One-shot lambdas
Reading IdInfo fields
Writing IdInfo fields
Description

GHC uses several kinds of name internally:

  • OccName: see OccName
  • RdrName.RdrName: see RdrName
  • Name: see Name
  • Id.Id represents names that not only have a Name but also a TypeRep.Type and some additional details (a IdInfo and one of Var.LocalIdDetails or GlobalIdDetails) that are added, modified and inspected by various compiler passes. These Var names may either be global or local, see Var
  • Var: see Var
Synopsis
type Id = Var
type DictId = Var
mkGlobalId :: GlobalIdDetails -> Name -> Type -> IdInfo -> Id
mkVanillaGlobal :: Name -> Type -> Id
mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id
mkLocalId :: Name -> Type -> Id
mkLocalIdWithInfo :: Name -> Type -> IdInfo -> Id
mkSysLocal :: FastString -> Unique -> Type -> Id
mkSysLocalM :: MonadUnique m => FastString -> Type -> m Id
mkUserLocal :: OccName -> Unique -> Type -> SrcSpan -> Id
mkUserLocalM :: MonadUnique m => OccName -> Type -> SrcSpan -> m Id
mkTemplateLocals :: [Type] -> [Id]
mkTemplateLocalsNum :: Int -> [Type] -> [Id]
mkWildId :: Type -> Id
mkTemplateLocal :: Int -> Type -> Id
mkWorkerId :: Unique -> Id -> Type -> Id
mkExportedLocalId :: Name -> Type -> Id
idName :: Id -> Name
idType :: Id -> Kind
idUnique :: Id -> Unique
idInfo :: Id -> IdInfo
isId :: Id -> Bool
globalIdDetails :: Id -> GlobalIdDetails
idPrimRep :: Id -> PrimRep
recordSelectorFieldLabel :: Id -> (TyCon, FieldLabel)
setIdName :: Id -> Name -> Id
setIdUnique :: Id -> Unique -> Id
setIdType :: Id -> Type -> Id
setIdExported :: Id -> Id
setIdNotExported :: Id -> Id
globaliseId :: GlobalIdDetails -> Id -> Id
setIdInfo :: Id -> IdInfo -> Id
lazySetIdInfo :: Id -> IdInfo -> Id
modifyIdInfo :: (IdInfo -> IdInfo) -> Id -> Id
maybeModifyIdInfo :: Maybe IdInfo -> Id -> Id
zapLamIdInfo :: Id -> Id
zapDemandIdInfo :: Id -> Id
zapFragileIdInfo :: Id -> Id
transferPolyIdInfo :: Id -> Id -> Id
isImplicitId :: Id -> Bool
isDeadBinder :: Id -> Bool
isDictId :: Id -> Bool
isStrictId :: Id -> Bool
isExportedId :: Id -> Bool
isLocalId :: Id -> Bool
isGlobalId :: Id -> Bool
isRecordSelector :: Id -> Bool
isNaughtyRecordSelector :: Id -> Bool
isClassOpId_maybe :: Id -> Maybe Class
isPrimOpId :: Id -> Bool
isPrimOpId_maybe :: Id -> Maybe PrimOp
isFCallId :: Id -> Bool
isFCallId_maybe :: Id -> Maybe ForeignCall
isDataConWorkId :: Id -> Bool
isDataConWorkId_maybe :: Id -> Maybe DataCon
isDataConId_maybe :: Id -> Maybe DataCon
idDataCon :: Id -> DataCon
isBottomingId :: Id -> Bool
idIsFrom :: Module -> Id -> Bool
isTickBoxOp :: Id -> Bool
isTickBoxOp_maybe :: Id -> Maybe TickBoxOp
hasNoBinding :: Id -> Bool
idInlinePragma :: Id -> InlinePragInfo
setInlinePragma :: Id -> InlinePragInfo -> Id
modifyInlinePragma :: Id -> (InlinePragInfo -> InlinePragInfo) -> Id
isOneShotBndr :: Id -> Bool
isOneShotLambda :: Id -> Bool
isStateHackType :: Type -> Bool
setOneShotLambda :: Id -> Id
clearOneShotLambda :: Id -> Id
idArity :: Id -> Arity
idNewDemandInfo :: Id -> Demand
idNewDemandInfo_maybe :: Id -> Maybe Demand
idNewStrictness :: Id -> StrictSig
idNewStrictness_maybe :: Id -> Maybe StrictSig
idWorkerInfo :: Id -> WorkerInfo
idUnfolding :: Id -> Unfolding
idSpecialisation :: Id -> SpecInfo
idCoreRules :: Id -> [CoreRule]
idHasRules :: Id -> Bool
idCafInfo :: Id -> CafInfo
idLBVarInfo :: Id -> LBVarInfo
idOccInfo :: Id -> OccInfo
setIdUnfolding :: Id -> Unfolding -> Id
setIdArity :: Id -> Arity -> Id
setIdNewDemandInfo :: Id -> Demand -> Id
setIdNewStrictness :: Id -> StrictSig -> Id
zapIdNewStrictness :: Id -> Id
setIdWorkerInfo :: Id -> WorkerInfo -> Id
setIdSpecialisation :: Id -> SpecInfo -> Id
setIdCafInfo :: Id -> CafInfo -> Id
setIdOccInfo :: Id -> OccInfo -> Id
The main types
type Id = Var
type DictId = Var
Simple construction
mkGlobalId :: GlobalIdDetails -> Name -> Type -> IdInfo -> Id
For an explanation of global vs. local Ids, see Var
mkVanillaGlobal :: Name -> Type -> Id
Make a global Id without any extra information at all
mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id
Make a global Id with no global information but some generic IdInfo
mkLocalId :: Name -> Type -> Id
For an explanation of global vs. local Ids, see Var
mkLocalIdWithInfo :: Name -> Type -> IdInfo -> Id
mkSysLocal :: FastString -> Unique -> Type -> Id
Create a system local Id. These are local Ids (see Var) that are created by the compiler out of thin air
mkSysLocalM :: MonadUnique m => FastString -> Type -> m Id
mkUserLocal :: OccName -> Unique -> Type -> SrcSpan -> Id
Create a user local Id. These are local Ids (see Var) with a name and location that the user might recognize
mkUserLocalM :: MonadUnique m => OccName -> Type -> SrcSpan -> m Id
mkTemplateLocals :: [Type] -> [Id]
Create a template local for a series of types
mkTemplateLocalsNum :: Int -> [Type] -> [Id]
Create a template local for a series of type, but start from a specified template local
mkWildId :: Type -> Id
Make a wild Id. This is typically used when you need a binder that you don't expect to use
mkTemplateLocal :: Int -> Type -> Id
Create a template local: a family of system local Ids in bijection with Ints, typically used in unfoldings
mkWorkerId :: Unique -> Id -> Type -> Id
Workers get local names. CoreTidy will externalise these if necessary
mkExportedLocalId :: Name -> Type -> Id
Create a local Id that is marked as exported. This prevents things attached to it from being removed as dead code.
Taking an Id apart
idName :: Id -> Name
idType :: Id -> Kind
idUnique :: Id -> Unique
idInfo :: Id -> IdInfo
isId :: Id -> Bool
globalIdDetails :: Id -> GlobalIdDetails
idPrimRep :: Id -> PrimRep
recordSelectorFieldLabel :: Id -> (TyCon, FieldLabel)
If the Id is that for a record selector, extract the sel_tycon and label. Panic otherwise
Modifying an Id
setIdName :: Id -> Name -> Id
setIdUnique :: Id -> Unique -> Id
setIdType :: Id -> Type -> Id
Not only does this set the Id Type, it also evaluates the type to try and reduce space usage
setIdExported :: Id -> Id
setIdNotExported :: Id -> Id
globaliseId :: GlobalIdDetails -> Id -> Id
setIdInfo :: Id -> IdInfo -> Id
lazySetIdInfo :: Id -> IdInfo -> Id
modifyIdInfo :: (IdInfo -> IdInfo) -> Id -> Id
maybeModifyIdInfo :: Maybe IdInfo -> Id -> Id
zapLamIdInfo :: Id -> Id
zapDemandIdInfo :: Id -> Id
zapFragileIdInfo :: Id -> Id
transferPolyIdInfo :: Id -> Id -> Id
Predicates on Ids
isImplicitId :: Id -> Bool
isImplicitId tells whether an Ids 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
isDictId :: Id -> Bool
isStrictId :: Id -> Bool
This predicate says whether the Id has a strict demand placed on it or has a type such that it can always be evaluated strictly (e.g., an unlifted type, but see the comment for isStrictType). We need to check separately whether the Id has a so-called "strict type" because if the demand for the given id hasn't been computed yet but id has a strict type, we still want isStrictId id to be True.
isExportedId :: Id -> Bool
Determines whether an Id is marked as exported and hence will not be considered dead code
isLocalId :: Id -> Bool
For an explanation of global vs. local Ids, see Var
isGlobalId :: Id -> Bool
For an explanation of global vs. local Ids, see Var
isRecordSelector :: Id -> Bool
isNaughtyRecordSelector :: Id -> Bool
isClassOpId_maybe :: Id -> Maybe Class
isPrimOpId :: Id -> Bool
isPrimOpId_maybe :: Id -> Maybe PrimOp
isFCallId :: Id -> Bool
isFCallId_maybe :: Id -> Maybe ForeignCall
isDataConWorkId :: Id -> Bool
isDataConWorkId_maybe :: Id -> Maybe DataCon
isDataConId_maybe :: Id -> Maybe DataCon
idDataCon :: Id -> DataCon

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

isBottomingId :: Id -> Bool
Returns true if an application to n args would diverge
idIsFrom :: Module -> Id -> Bool
isTickBoxOp :: Id -> Bool
isTickBoxOp_maybe :: Id -> Maybe TickBoxOp
hasNoBinding :: Id -> Bool
Returns True of an Id which may not have a binding, even though it is defined in this module.
Inline pragma stuff
idInlinePragma :: Id -> InlinePragInfo
setInlinePragma :: Id -> InlinePragInfo -> Id
modifyInlinePragma :: Id -> (InlinePragInfo -> InlinePragInfo) -> Id
One-shot lambdas
isOneShotBndr :: Id -> Bool
Returns whether the lambda associated with the Id is certainly applied at most once OR we are applying the "state hack" which makes it appear as if theis is the case for lambdas used in IO. You should prefer using this over isOneShotLambda
isOneShotLambda :: Id -> Bool
Returns whether the lambda associated with the Id is certainly applied at most once. You probably want to use isOneShotBndr instead
isStateHackType :: Type -> Bool
Should we apply the state hack to values of this Type?
setOneShotLambda :: Id -> Id
clearOneShotLambda :: Id -> Id
Reading IdInfo fields
idArity :: Id -> Arity
idNewDemandInfo :: Id -> Demand
idNewDemandInfo_maybe :: Id -> Maybe Demand
idNewStrictness :: Id -> StrictSig
idNewStrictness_maybe :: Id -> Maybe StrictSig
idWorkerInfo :: Id -> WorkerInfo
idUnfolding :: Id -> Unfolding
idSpecialisation :: Id -> SpecInfo
idCoreRules :: Id -> [CoreRule]
idHasRules :: Id -> Bool
idCafInfo :: Id -> CafInfo
idLBVarInfo :: Id -> LBVarInfo
idOccInfo :: Id -> OccInfo
Writing IdInfo fields
setIdUnfolding :: Id -> Unfolding -> Id
setIdArity :: Id -> Arity -> Id
setIdNewDemandInfo :: Id -> Demand -> Id
setIdNewStrictness :: Id -> StrictSig -> Id
zapIdNewStrictness :: Id -> Id
setIdWorkerInfo :: Id -> WorkerInfo -> Id
setIdSpecialisation :: Id -> SpecInfo -> Id
setIdCafInfo :: Id -> CafInfo -> Id
setIdOccInfo :: Id -> OccInfo -> Id
Produced by Haddock version 2.4.2