Safe Haskell | None |
---|---|
Language | Haskell2010 |
GHC uses several kinds of name internally:
OccName
: see GHC.Types.Name.OccurrenceRdrName
is the type of names that come directly from the parser. They have not yet had their scoping and binding resolved by the renamer and can be thought of to a first approximation as anOccName
with an optional module qualifierName
: see GHC.Types.NameId
: see GHC.Types.IdVar
: see GHC.Types.Var
Synopsis
- data RdrName
- mkRdrUnqual :: OccName -> RdrName
- mkRdrQual :: ModuleName -> OccName -> RdrName
- mkUnqual :: NameSpace -> FastString -> RdrName
- mkVarUnqual :: FastString -> RdrName
- mkQual :: NameSpace -> (FastString, FastString) -> RdrName
- mkOrig :: Module -> OccName -> RdrName
- nameRdrName :: Name -> RdrName
- getRdrName :: NamedThing thing => thing -> RdrName
- rdrNameOcc :: RdrName -> OccName
- rdrNameSpace :: RdrName -> NameSpace
- demoteRdrName :: RdrName -> Maybe RdrName
- demoteRdrNameTv :: RdrName -> Maybe RdrName
- promoteRdrName :: RdrName -> Maybe RdrName
- isRdrDataCon :: RdrName -> Bool
- isRdrTyVar :: RdrName -> Bool
- isRdrTc :: RdrName -> Bool
- isQual :: RdrName -> Bool
- isQual_maybe :: RdrName -> Maybe (ModuleName, OccName)
- isUnqual :: RdrName -> Bool
- isOrig :: RdrName -> Bool
- isOrig_maybe :: RdrName -> Maybe (Module, OccName)
- isExact :: RdrName -> Bool
- isExact_maybe :: RdrName -> Maybe Name
- isSrcRdrName :: RdrName -> Bool
- data LocalRdrEnv
- emptyLocalRdrEnv :: LocalRdrEnv
- extendLocalRdrEnv :: LocalRdrEnv -> Name -> LocalRdrEnv
- extendLocalRdrEnvList :: LocalRdrEnv -> [Name] -> LocalRdrEnv
- lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name
- lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name
- elemLocalRdrEnv :: RdrName -> LocalRdrEnv -> Bool
- inLocalRdrEnvScope :: Name -> LocalRdrEnv -> Bool
- localRdrEnvElts :: LocalRdrEnv -> [Name]
- minusLocalRdrEnv :: LocalRdrEnv -> OccEnv a -> LocalRdrEnv
- minusLocalRdrEnvList :: LocalRdrEnv -> [OccName] -> LocalRdrEnv
- type GlobalRdrEnvX info = OccEnv [GlobalRdrEltX info]
- type GlobalRdrEnv = GlobalRdrEnvX GREInfo
- type IfGlobalRdrEnv = GlobalRdrEnvX ()
- emptyGlobalRdrEnv :: GlobalRdrEnvX info
- mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv
- plusGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrEnv -> GlobalRdrEnv
- extendGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrElt -> GlobalRdrEnv
- greOccName :: GlobalRdrEltX info -> OccName
- pprGlobalRdrEnv :: Bool -> GlobalRdrEnv -> SDoc
- globalRdrEnvElts :: GlobalRdrEnvX info -> [GlobalRdrEltX info]
- data FieldsOrSelectors
- filterFieldGREs :: FieldsOrSelectors -> [GlobalRdrElt] -> [GlobalRdrElt]
- allowGRE :: FieldsOrSelectors -> GlobalRdrElt -> Bool
- data LookupGRE info where
- LookupOccName :: forall info. OccName -> WhichGREs info -> LookupGRE info
- LookupRdrName :: forall info. RdrName -> WhichGREs info -> LookupGRE info
- LookupExactName :: forall info. {..} -> LookupGRE info
- LookupChildren :: forall info. OccName -> LookupChild -> LookupGRE info
- lookupGRE :: GlobalRdrEnvX info -> LookupGRE info -> [GlobalRdrEltX info]
- data WhichGREs info where
- SameNameSpace :: forall info. WhichGREs info
- RelevantGREs :: {..} -> WhichGREs GREInfo
- pattern AllRelevantGREs :: WhichGREs GREInfo
- pattern RelevantGREsFOS :: FieldsOrSelectors -> WhichGREs GREInfo
- greIsRelevant :: WhichGREs GREInfo -> NameSpace -> GlobalRdrElt -> Bool
- data LookupChild = LookupChild {}
- lookupGRE_Name :: Outputable info => GlobalRdrEnvX info -> Name -> Maybe (GlobalRdrEltX info)
- lookupGRE_FieldLabel :: GlobalRdrEnv -> FieldLabel -> Maybe FieldGlobalRdrElt
- getGRE_NameQualifier_maybes :: GlobalRdrEnv -> Name -> [Maybe [ModuleName]]
- transformGREs :: (GlobalRdrElt -> GlobalRdrElt) -> [OccName] -> GlobalRdrEnv -> GlobalRdrEnv
- pickGREs :: RdrName -> [GlobalRdrEltX info] -> [GlobalRdrEltX info]
- pickGREsModExp :: ModuleName -> [GlobalRdrEltX info] -> [(GlobalRdrEltX info, GlobalRdrEltX info)]
- availFromGRE :: GlobalRdrEltX info -> AvailInfo
- greRdrNames :: GlobalRdrEltX info -> [RdrName]
- greSrcSpan :: Outputable info => GlobalRdrEltX info -> SrcSpan
- greQualModName :: Outputable info => GlobalRdrEltX info -> ModuleName
- gresToAvailInfo :: [GlobalRdrEltX info] -> [AvailInfo]
- greDefinitionModule :: GlobalRdrEltX info -> Maybe Module
- greDefinitionSrcSpan :: GlobalRdrEltX info -> SrcSpan
- greFieldLabel_maybe :: GlobalRdrElt -> Maybe FieldLabel
- data GlobalRdrEltX info = GRE {}
- type GlobalRdrElt = GlobalRdrEltX GREInfo
- type IfGlobalRdrElt = GlobalRdrEltX ()
- type FieldGlobalRdrElt = GlobalRdrElt
- greName :: GlobalRdrEltX info -> Name
- greNameSpace :: GlobalRdrEltX info -> NameSpace
- greParent :: GlobalRdrEltX info -> Parent
- greInfo :: GlobalRdrElt -> GREInfo
- forceGlobalRdrEnv :: GlobalRdrEnvX info -> IfGlobalRdrEnv
- hydrateGlobalRdrEnv :: (Name -> IO info) -> GlobalRdrEnvX noInfo -> GlobalRdrEnvX info
- isLocalGRE :: GlobalRdrEltX info -> Bool
- isImportedGRE :: GlobalRdrEltX info -> Bool
- isRecFldGRE :: GlobalRdrEltX info -> Bool
- fieldGREInfo :: HasDebugCallStack => FieldGlobalRdrElt -> RecFieldInfo
- isDuplicateRecFldGRE :: GlobalRdrElt -> Bool
- isNoFieldSelectorGRE :: GlobalRdrElt -> Bool
- isFieldSelectorGRE :: GlobalRdrElt -> Bool
- unQualOK :: GlobalRdrEltX info -> Bool
- qualSpecOK :: ModuleName -> ImportSpec -> Bool
- unQualSpecOK :: ImportSpec -> Bool
- pprNameProvenance :: GlobalRdrEltX info -> SDoc
- mkGRE :: (Name -> Maybe ImportSpec) -> GREInfo -> Parent -> Name -> GlobalRdrElt
- mkExactGRE :: Name -> GREInfo -> GlobalRdrElt
- mkLocalGRE :: GREInfo -> Parent -> Name -> GlobalRdrElt
- mkLocalVanillaGRE :: Parent -> Name -> GlobalRdrElt
- mkLocalTyConGRE :: TyConFlavour Name -> Name -> GlobalRdrElt
- mkLocalConLikeGRE :: Parent -> (ConLikeName, ConInfo) -> GlobalRdrElt
- mkLocalFieldGREs :: Parent -> [(ConLikeName, ConInfo)] -> [GlobalRdrElt]
- gresToNameSet :: [GlobalRdrEltX info] -> NameSet
- greClashesWith :: GlobalRdrElt -> GlobalRdrElt -> Bool
- shadowNames :: Bool -> GlobalRdrEnv -> GlobalRdrEnv -> GlobalRdrEnv
- data ConLikeName
- = DataConName {
- conLikeName_Name :: !Name
- | PatSynName {
- conLikeName_Name :: !Name
- = DataConName {
- data GREInfo
- data RecFieldInfo = RecFieldInfo {}
- plusGREInfo :: GREInfo -> GREInfo -> GREInfo
- recFieldConLike_maybe :: HasDebugCallStack => GlobalRdrElt -> Maybe ConInfo
- recFieldInfo_maybe :: HasDebugCallStack => GlobalRdrElt -> Maybe RecFieldInfo
- fieldGRE_maybe :: GlobalRdrElt -> Maybe FieldGlobalRdrElt
- fieldGRELabel :: HasDebugCallStack => FieldGlobalRdrElt -> FieldLabel
- data Parent
- greParent_maybe :: GlobalRdrEltX info -> Maybe Name
- mkParent :: Name -> AvailInfo -> Parent
- availParent :: AvailInfo -> Parent
- data ImportSpec = ImpSpec {}
- data ImpDeclSpec = ImpDeclSpec {}
- data ImpItemSpec
- importSpecLoc :: ImportSpec -> SrcSpan
- importSpecModule :: ImportSpec -> ModuleName
- isExplicitItem :: ImpItemSpec -> Bool
- bestImport :: NonEmpty ImportSpec -> ImportSpec
- opIsAt :: RdrName -> Bool
The main type
Reader Name
Do not use the data constructors of RdrName directly: prefer the family
of functions that creates them, such as mkRdrUnqual
- Note: A Located RdrName will only have API Annotations if it is a compound one, e.g.
`bar` ( ~ )
AnnKeywordId
:AnnType
,AnnOpen
'('
or'['
or'[:'
,AnnClose
')'
or']'
or':]'
,,AnnBackquote
'`'
,AnnVal
AnnTilde
,
Unqual OccName | Unqualified name Used for ordinary, unqualified occurrences, e.g. |
Qual ModuleName OccName | Qualified name A qualified name written by the user in
source code. The module isn't necessarily
the module where the thing is defined;
just the one from which it is imported.
Examples are |
Orig Module OccName | Original name An original name; the module is the defining module.
This is used when GHC generates code that will be fed
into the renamer (e.g. from deriving clauses), but where
we want to say "Use Prelude.map dammit". One of these
can be created with |
Exact Name | Exact name We know exactly the
Such a |
Instances
Data RdrName Source # | |
Defined in GHC.Types.Name.Reader gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RdrName -> c RdrName Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RdrName Source # toConstr :: RdrName -> Constr Source # dataTypeOf :: RdrName -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RdrName) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RdrName) Source # gmapT :: (forall b. Data b => b -> b) -> RdrName -> RdrName Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RdrName -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RdrName -> r Source # gmapQ :: (forall d. Data d => d -> u) -> RdrName -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> RdrName -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> RdrName -> m RdrName Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RdrName -> m RdrName Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RdrName -> m RdrName Source # | |
DisambInfixOp RdrName Source # | |
Defined in GHC.Parser.PostProcess | |
HasOccName RdrName Source # | |
Outputable RdrName Source # | |
OutputableBndr RdrName Source # | |
Defined in GHC.Types.Name.Reader | |
Eq RdrName Source # | |
Ord RdrName Source # | |
type Anno RdrName Source # | |
Defined in GHC.Hs.Extension | |
type Anno (LocatedN RdrName) Source # | |
Defined in GHC.Hs.Binds | |
type Anno [LocatedN RdrName] Source # | |
Defined in GHC.Hs.Binds |
Construction
mkRdrUnqual :: OccName -> RdrName Source #
mkVarUnqual :: FastString -> RdrName Source #
mkQual :: NameSpace -> (FastString, FastString) -> RdrName Source #
Make a qualified RdrName
in the given namespace and where the ModuleName
and
the OccName
are taken from the first and second elements of the tuple respectively
nameRdrName :: Name -> RdrName Source #
getRdrName :: NamedThing thing => thing -> RdrName Source #
Destruction
rdrNameOcc :: RdrName -> OccName Source #
rdrNameSpace :: RdrName -> NameSpace Source #
isRdrDataCon :: RdrName -> Bool Source #
isRdrTyVar :: RdrName -> Bool Source #
isQual_maybe :: RdrName -> Maybe (ModuleName, OccName) Source #
isSrcRdrName :: RdrName -> Bool Source #
Local mapping of RdrName
to Name
data LocalRdrEnv Source #
Local Reader Environment See Note [LocalRdrEnv]
Instances
Outputable LocalRdrEnv Source # | |
Defined in GHC.Types.Name.Reader ppr :: LocalRdrEnv -> SDoc Source # |
extendLocalRdrEnv :: LocalRdrEnv -> Name -> LocalRdrEnv Source #
extendLocalRdrEnvList :: LocalRdrEnv -> [Name] -> LocalRdrEnv Source #
lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name Source #
lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name Source #
elemLocalRdrEnv :: RdrName -> LocalRdrEnv -> Bool Source #
inLocalRdrEnvScope :: Name -> LocalRdrEnv -> Bool Source #
localRdrEnvElts :: LocalRdrEnv -> [Name] Source #
minusLocalRdrEnv :: LocalRdrEnv -> OccEnv a -> LocalRdrEnv Source #
minusLocalRdrEnvList :: LocalRdrEnv -> [OccName] -> LocalRdrEnv Source #
Global mapping of RdrName
to GlobalRdrElt
s
type GlobalRdrEnvX info = OccEnv [GlobalRdrEltX info] Source #
Parametrises GlobalRdrEnv
over the presence or absence of GREInfo
.
See Note [IfGlobalRdrEnv].
type GlobalRdrEnv = GlobalRdrEnvX GREInfo Source #
Global Reader Environment
Keyed by OccName
; when looking up a qualified name
we look up the OccName
part, and then check the Provenance
to see if the appropriate qualification is valid. This
saves routinely doubling the size of the env by adding both
qualified and unqualified names to the domain.
The list in the codomain is required because there may be name clashes These only get reported on lookup, not on construction
INVARIANT 1: All the members of the list have distinct
gre_name
fields; that is, no duplicate Names
INVARIANT 2: Imported provenance => Name is an ExternalName However LocalDefs can have an InternalName. This happens only when type-checking a [d| ... |] Template Haskell quotation; see this note in GHC.Rename.Names Note [Top-level Names in Template Haskell decl quotes]
INVARIANT 3: If the GlobalRdrEnv maps [occ -> gre], then greOccName gre = occ
type IfGlobalRdrEnv = GlobalRdrEnvX () Source #
A GlobalRdrEnv
in which the GlobalRdrElt
s don't have any GREInfo
attached to them. This is useful to avoid space leaks, see Note [IfGlobalRdrEnv].
emptyGlobalRdrEnv :: GlobalRdrEnvX info Source #
mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv Source #
greOccName :: GlobalRdrEltX info -> OccName Source #
pprGlobalRdrEnv :: Bool -> GlobalRdrEnv -> SDoc Source #
globalRdrEnvElts :: GlobalRdrEnvX info -> [GlobalRdrEltX info] Source #
Looking up GlobalRdrElt
s
data FieldsOrSelectors Source #
When looking up GREs, we may or may not want to include fields that were
defined in modules with NoFieldSelectors
enabled. See Note
[NoFieldSelectors].
WantNormal | Include normal names, and fields with selectors, but ignore fields without selectors. |
WantBoth | Include normal names and all fields (regardless of whether they have selectors). |
WantField | Include only fields, with or without selectors, ignoring any non-fields in scope. |
Instances
Show FieldsOrSelectors Source # | |
Defined in GHC.Types.Name.Reader | |
Eq FieldsOrSelectors Source # | |
Defined in GHC.Types.Name.Reader (==) :: FieldsOrSelectors -> FieldsOrSelectors -> Bool # (/=) :: FieldsOrSelectors -> FieldsOrSelectors -> Bool # |
filterFieldGREs :: FieldsOrSelectors -> [GlobalRdrElt] -> [GlobalRdrElt] Source #
allowGRE :: FieldsOrSelectors -> GlobalRdrElt -> Bool Source #
data LookupGRE info where Source #
What should we look up in a GlobalRdrEnv
? Should we only look up
names with the exact same OccName
, or do we allow different NameSpace
s?
Depending on the answer, we might need more or less information from the
GlobalRdrEnv
, e.g. if we want to include matching record fields we need
to know if the corresponding record fields define field selectors, for which
we need to consult the GREInfo
. This is why this datatype is a GADT.
See Note [IfGlobalRdrEnv].
LookupOccName | Look for this specific |
LookupRdrName | Look up the |
LookupExactName | Look for |
| |
LookupChildren | Look up children |
|
lookupGRE :: GlobalRdrEnvX info -> LookupGRE info -> [GlobalRdrEltX info] Source #
data WhichGREs info where Source #
How should we look up in a GlobalRdrEnv
?
Which NameSpace
s are considered relevant for a given lookup?
SameNameSpace :: forall info. WhichGREs info | Only consider |
RelevantGREs | Allow |
|
pattern AllRelevantGREs :: WhichGREs GREInfo | Look up as many possibly relevant |
pattern RelevantGREsFOS :: FieldsOrSelectors -> WhichGREs GREInfo | Look up relevant GREs, taking into account the interaction between the
variable and field |
:: WhichGREs GREInfo | specification of which |
-> NameSpace | the |
-> GlobalRdrElt | the |
-> Bool |
After looking up something with the given NameSpace
, is the resulting
GlobalRdrElt
we have obtained relevant, according to the RelevantGREs
specification of which NameSpace
s are relevant?
data LookupChild Source #
LookupChild | |
|
lookupGRE_Name :: Outputable info => GlobalRdrEnvX info -> Name -> Maybe (GlobalRdrEltX info) Source #
lookupGRE_FieldLabel :: GlobalRdrEnv -> FieldLabel -> Maybe FieldGlobalRdrElt Source #
Look for a particular record field selector in the environment.
getGRE_NameQualifier_maybes :: GlobalRdrEnv -> Name -> [Maybe [ModuleName]] Source #
transformGREs :: (GlobalRdrElt -> GlobalRdrElt) -> [OccName] -> GlobalRdrEnv -> GlobalRdrEnv Source #
Apply a transformation function to the GREs for these OccNames
pickGREs :: RdrName -> [GlobalRdrEltX info] -> [GlobalRdrEltX info] Source #
Takes a list of GREs which have the right OccName x
Pick those GREs that are in scope
* Qualified, as x
if want_qual is Qual M _
* Unqualified, as x
if want_unqual is Unqual _
Return each such GRE, with its ImportSpecs filtered, to reflect how it is in scope qualified or unqualified respectively. See Note [GRE filtering]
pickGREsModExp :: ModuleName -> [GlobalRdrEltX info] -> [(GlobalRdrEltX info, GlobalRdrEltX info)] Source #
Pick GREs that are in scope *both* qualified *and* unqualified Return each GRE that is, as a pair (qual_gre, unqual_gre) These two GREs are the original GRE with imports filtered to express how it is in scope qualified an unqualified respectively
Used only for the 'module M' item in export list;
see exports_from_avail
GlobalRdrElts
availFromGRE :: GlobalRdrEltX info -> AvailInfo Source #
greRdrNames :: GlobalRdrEltX info -> [RdrName] Source #
greSrcSpan :: Outputable info => GlobalRdrEltX info -> SrcSpan Source #
greQualModName :: Outputable info => GlobalRdrEltX info -> ModuleName Source #
gresToAvailInfo :: [GlobalRdrEltX info] -> [AvailInfo] Source #
Takes a list of distinct GREs and folds them
into AvailInfos. This is more efficient than mapping each individual
GRE to an AvailInfo and then folding using plusAvail
, but needs the
uniqueness assumption.
greDefinitionModule :: GlobalRdrEltX info -> Maybe Module Source #
The module in which the name pointed to by the GRE is defined.
greDefinitionSrcSpan :: GlobalRdrEltX info -> SrcSpan Source #
The SrcSpan of the name pointed to by the GRE.
greFieldLabel_maybe :: GlobalRdrElt -> Maybe FieldLabel Source #
Returns the field label of this GRE, if it has one
Global RdrName
mapping elements: GlobalRdrElt
, Provenance
, ImportSpec
data GlobalRdrEltX info Source #
Global Reader Element
Something in scope in the renamer; usually a member of the GlobalRdrEnv
.
See Note [GlobalRdrElt provenance].
Why do we parametrise over the gre_info
field? See Note [IfGlobalRdrEnv].
GRE | |
|
Instances
NFData IfGlobalRdrElt Source # | |
Defined in GHC.Types.Name.Reader rnf :: IfGlobalRdrElt -> () Source # | |
Data info => Data (GlobalRdrEltX info) Source # | |
Defined in GHC.Types.Name.Reader gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> GlobalRdrEltX info -> c (GlobalRdrEltX info) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (GlobalRdrEltX info) Source # toConstr :: GlobalRdrEltX info -> Constr Source # dataTypeOf :: GlobalRdrEltX info -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (GlobalRdrEltX info)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (GlobalRdrEltX info)) Source # gmapT :: (forall b. Data b => b -> b) -> GlobalRdrEltX info -> GlobalRdrEltX info Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GlobalRdrEltX info -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GlobalRdrEltX info -> r Source # gmapQ :: (forall d. Data d => d -> u) -> GlobalRdrEltX info -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> GlobalRdrEltX info -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> GlobalRdrEltX info -> m (GlobalRdrEltX info) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GlobalRdrEltX info -> m (GlobalRdrEltX info) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GlobalRdrEltX info -> m (GlobalRdrEltX info) Source # | |
HasOccName (GlobalRdrEltX info) Source # | |
Defined in GHC.Types.Name.Reader occName :: GlobalRdrEltX info -> OccName Source # | |
Outputable info => Outputable (GlobalRdrEltX info) Source # | |
Defined in GHC.Types.Name.Reader ppr :: GlobalRdrEltX info -> SDoc Source # |
type GlobalRdrElt = GlobalRdrEltX GREInfo Source #
Global Reader Element
Something in scope in the renamer; usually a member of the GlobalRdrEnv
.
See Note [GlobalRdrElt provenance].
type IfGlobalRdrElt = GlobalRdrEltX () Source #
A GlobalRdrElt
in which we stripped out the GREInfo
field,
in order to avoid space leaks.
See Note [IfGlobalRdrEnv].
type FieldGlobalRdrElt = GlobalRdrElt Source #
A FieldGlobalRdrElt
is a GlobalRdrElt
in which the gre_info
field is IAmRecField
.
greName :: GlobalRdrEltX info -> Name Source #
greNameSpace :: GlobalRdrEltX info -> NameSpace Source #
greParent :: GlobalRdrEltX info -> Parent Source #
greInfo :: GlobalRdrElt -> GREInfo Source #
forceGlobalRdrEnv :: GlobalRdrEnvX info -> IfGlobalRdrEnv Source #
Drop all GREInfo
fields in a GlobalRdrEnv
in order to
avoid space leaks.
See Note [Forcing GREInfo] in GHC.Types.GREInfo.
hydrateGlobalRdrEnv :: (Name -> IO info) -> GlobalRdrEnvX noInfo -> GlobalRdrEnvX info Source #
Hydrate a previously dehydrated GlobalRdrEnv
,
by (lazily!) looking up the GREInfo
using the provided function.
See Note [Forcing GREInfo] in GHC.Types.GREInfo.
isLocalGRE :: GlobalRdrEltX info -> Bool Source #
Is this GlobalRdrElt
defined locally?
isImportedGRE :: GlobalRdrEltX info -> Bool Source #
Is this GlobalRdrElt
imported?
Not just the negation of isLocalGRE
, because it might be an Exact or
Orig name reference. See Note [GlobalRdrElt provenance].
isRecFldGRE :: GlobalRdrEltX info -> Bool Source #
Is this a record field GRE?
Important: does not consult the GreInfo
field.
isDuplicateRecFldGRE :: GlobalRdrElt -> Bool Source #
Is this a record field defined with DuplicateRecordFields?
isNoFieldSelectorGRE :: GlobalRdrElt -> Bool Source #
Is this a record field defined with NoFieldSelectors? (See Note [NoFieldSelectors] in GHC.Rename.Env)
isFieldSelectorGRE :: GlobalRdrElt -> Bool Source #
Is this a record field defined with FieldSelectors? (See Note [NoFieldSelectors] in GHC.Rename.Env)
unQualOK :: GlobalRdrEltX info -> Bool Source #
Test if an unqualified version of this thing would be in scope
qualSpecOK :: ModuleName -> ImportSpec -> Bool Source #
Is in scope qualified with the given module?
unQualSpecOK :: ImportSpec -> Bool Source #
Is in scope unqualified?
pprNameProvenance :: GlobalRdrEltX info -> SDoc Source #
Print out one place where the name was define/imported (With -dppr-debug, print them all)
mkGRE :: (Name -> Maybe ImportSpec) -> GREInfo -> Parent -> Name -> GlobalRdrElt Source #
mkExactGRE :: Name -> GREInfo -> GlobalRdrElt Source #
mkLocalGRE :: GREInfo -> Parent -> Name -> GlobalRdrElt Source #
mkLocalVanillaGRE :: Parent -> Name -> GlobalRdrElt Source #
mkLocalTyConGRE :: TyConFlavour Name -> Name -> GlobalRdrElt Source #
Create a local GlobalRdrElt
for a TyCon
.
mkLocalConLikeGRE :: Parent -> (ConLikeName, ConInfo) -> GlobalRdrElt Source #
mkLocalFieldGREs :: Parent -> [(ConLikeName, ConInfo)] -> [GlobalRdrElt] Source #
gresToNameSet :: [GlobalRdrEltX info] -> NameSet Source #
Shadowing
greClashesWith :: GlobalRdrElt -> GlobalRdrElt -> Bool Source #
greClashesWith new_gre old_gre
computes whether new_gre
clashes
with old_gre
(assuming they both have the same underlying occNameFS
).
:: Bool | discard names that are only available qualified? |
-> GlobalRdrEnv | |
-> GlobalRdrEnv | |
-> GlobalRdrEnv |
Information attached to a GlobalRdrElt
data ConLikeName Source #
Useful when we are in the renamer and don't yet have a full DataCon
or
PatSyn
to hand.
Instances
Information about a Name
that is pertinent to the renamer.
See Note [GREInfo]
Vanilla | No particular information... e.g. a function |
UnboundGRE | An unbound GRE... could be anything |
IAmTyCon !(TyConFlavour Name) |
|
IAmConLike | |
| |
IAmRecField !RecFieldInfo |
Instances
Data GREInfo Source # | |
Defined in GHC.Types.GREInfo gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> GREInfo -> c GREInfo Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c GREInfo Source # toConstr :: GREInfo -> Constr Source # dataTypeOf :: GREInfo -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c GREInfo) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GREInfo) Source # gmapT :: (forall b. Data b => b -> b) -> GREInfo -> GREInfo Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GREInfo -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GREInfo -> r Source # gmapQ :: (forall d. Data d => d -> u) -> GREInfo -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> GREInfo -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> GREInfo -> m GREInfo Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GREInfo -> m GREInfo Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GREInfo -> m GREInfo Source # | |
NFData GREInfo Source # | |
Defined in GHC.Types.GREInfo | |
Outputable GREInfo Source # | |
data RecFieldInfo Source #
RecFieldInfo | |
|
Instances
Parent information
See Note [Parents]
Instances
Data Parent Source # | |
Defined in GHC.Types.Name.Reader gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Parent -> c Parent Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Parent Source # toConstr :: Parent -> Constr Source # dataTypeOf :: Parent -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Parent) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Parent) Source # gmapT :: (forall b. Data b => b -> b) -> Parent -> Parent Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Parent -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Parent -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Parent -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Parent -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Parent -> m Parent Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Parent -> m Parent Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Parent -> m Parent Source # | |
Outputable Parent Source # | |
Eq Parent Source # | |
greParent_maybe :: GlobalRdrEltX info -> Maybe Name Source #
availParent :: AvailInfo -> Parent Source #
data ImportSpec Source #
Import Specification
The ImportSpec
of something says how it came to be imported
It's quite elaborate so that we can give accurate unused-name warnings.
Instances
Data ImportSpec Source # | |
Defined in GHC.Types.Name.Reader gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ImportSpec -> c ImportSpec Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ImportSpec Source # toConstr :: ImportSpec -> Constr Source # dataTypeOf :: ImportSpec -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ImportSpec) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ImportSpec) Source # gmapT :: (forall b. Data b => b -> b) -> ImportSpec -> ImportSpec Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ImportSpec -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ImportSpec -> r Source # gmapQ :: (forall d. Data d => d -> u) -> ImportSpec -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> ImportSpec -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ImportSpec -> m ImportSpec Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportSpec -> m ImportSpec Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ImportSpec -> m ImportSpec Source # | |
Outputable ImportSpec Source # | |
Defined in GHC.Types.Name.Reader ppr :: ImportSpec -> SDoc Source # | |
Eq ImportSpec Source # | |
Defined in GHC.Types.Name.Reader (==) :: ImportSpec -> ImportSpec -> Bool # (/=) :: ImportSpec -> ImportSpec -> Bool # |
data ImpDeclSpec Source #
Import Declaration Specification
Describes a particular import declaration and is
shared among all the Provenance
s for that decl
ImpDeclSpec | |
|
Instances
Data ImpDeclSpec Source # | |
Defined in GHC.Types.Name.Reader gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ImpDeclSpec -> c ImpDeclSpec Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ImpDeclSpec Source # toConstr :: ImpDeclSpec -> Constr Source # dataTypeOf :: ImpDeclSpec -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ImpDeclSpec) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ImpDeclSpec) Source # gmapT :: (forall b. Data b => b -> b) -> ImpDeclSpec -> ImpDeclSpec Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ImpDeclSpec -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ImpDeclSpec -> r Source # gmapQ :: (forall d. Data d => d -> u) -> ImpDeclSpec -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> ImpDeclSpec -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ImpDeclSpec -> m ImpDeclSpec Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ImpDeclSpec -> m ImpDeclSpec Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ImpDeclSpec -> m ImpDeclSpec Source # | |
Eq ImpDeclSpec Source # | |
Defined in GHC.Types.Name.Reader (==) :: ImpDeclSpec -> ImpDeclSpec -> Bool # (/=) :: ImpDeclSpec -> ImpDeclSpec -> Bool # |
data ImpItemSpec Source #
Import Item Specification
Describes import info a particular Name
ImpAll | The import had no import list, or had a hiding list |
ImpSome | The import had an import list.
The import C( T(..) ) Here the constructors of |
|
Instances
Data ImpItemSpec Source # | |
Defined in GHC.Types.Name.Reader gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ImpItemSpec -> c ImpItemSpec Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ImpItemSpec Source # toConstr :: ImpItemSpec -> Constr Source # dataTypeOf :: ImpItemSpec -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ImpItemSpec) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ImpItemSpec) Source # gmapT :: (forall b. Data b => b -> b) -> ImpItemSpec -> ImpItemSpec Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ImpItemSpec -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ImpItemSpec -> r Source # gmapQ :: (forall d. Data d => d -> u) -> ImpItemSpec -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> ImpItemSpec -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ImpItemSpec -> m ImpItemSpec Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ImpItemSpec -> m ImpItemSpec Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ImpItemSpec -> m ImpItemSpec Source # | |
Eq ImpItemSpec Source # | |
Defined in GHC.Types.Name.Reader (==) :: ImpItemSpec -> ImpItemSpec -> Bool # (/=) :: ImpItemSpec -> ImpItemSpec -> Bool # |
importSpecLoc :: ImportSpec -> SrcSpan Source #
isExplicitItem :: ImpItemSpec -> Bool Source #