-hashName name = IBOX( u2i (nameUnique name) )
-
-nameUnique name = n_uniq name
-nameOccName name = n_occ name
-
-nameModule name =
- case n_sort name of
- Local -> pprPanic "nameModule" (ppr name)
- x -> nameSortModule x
-
-nameSortModule (Global mod) = mod
-nameSortModule (WiredInId mod _) = mod
-nameSortModule (WiredInTyCon mod _) = mod
-
-nameRdrName :: Name -> RdrName
-nameRdrName (Name { n_sort = Local, n_occ = occ }) = mkRdrUnqual occ
-nameRdrName (Name { n_sort = sort, n_occ = occ }) = mkRdrQual (moduleName (nameSortModule sort)) occ
-
-isUserExportedName (Name { n_prov = LocalDef _ Exported }) = True
-isUserExportedName other = False
-
-isUserImportedExplicitlyName (Name { n_prov = NonLocalDef (UserImport _ _ explicit) _ }) = explicit
-isUserImportedExplicitlyName other = False
-
-isUserImportedName (Name { n_prov = NonLocalDef (UserImport _ _ _) _ }) = True
-isUserImportedName other = False
-
-isDynName :: Name -> Bool
- -- Does this name come from a DLL?
-isDynName nm = not (isLocallyDefinedName nm) &&
- isDynamicModule (nameModule nm)
-
-nameSrcLoc name = provSrcLoc (n_prov name)
-
-provSrcLoc (LocalDef loc _) = loc
-provSrcLoc (NonLocalDef (UserImport _ loc _) _) = loc
-provSrcLoc other = noSrcLoc
-
-isLocallyDefinedName (Name {n_sort = Local}) = True -- Local (might have SystemProv)
-isLocallyDefinedName (Name {n_prov = LocalDef _ _}) = True -- Global, but defined here
-isLocallyDefinedName other = False -- Other
-
--- Things the compiler "knows about" are in some sense
--- "imported". When we are compiling the module where
--- the entities are defined, we need to be able to pick
--- them out, often in combination with isLocallyDefined.
-isWiredInName (Name {n_sort = WiredInTyCon _ _}) = True
-isWiredInName (Name {n_sort = WiredInId _ _}) = True
-isWiredInName _ = False
-
-maybeWiredInIdName :: Name -> Maybe Id
-maybeWiredInIdName (Name {n_sort = WiredInId _ id}) = Just id
-maybeWiredInIdName other = Nothing
-
-maybeWiredInTyConName :: Name -> Maybe TyCon
-maybeWiredInTyConName (Name {n_sort = WiredInTyCon _ tc}) = Just tc
-maybeWiredInTyConName other = Nothing
-
-
-isLocalName (Name {n_sort = Local}) = True
-isLocalName _ = False
-
-isGlobalName (Name {n_sort = Local}) = False
-isGlobalName other = True
-
--- Global names are by definition those that are visible
--- outside the module, *as seen by the linker*. Externally visible
--- does not mean visible at the source level (that's isExported).
-isExternallyVisibleName name = isGlobalName name
-
-hasBetterProv :: Name -> Name -> Bool
-hasBetterProv name1 name2
- = case n_prov name1 of
- LocalDef _ _ -> True
- SystemProv -> False
- NonLocalDef _ _ -> case n_prov name2 of
- LocalDef _ _ -> False
- other -> True
-
-isSystemName (Name {n_prov = SystemProv}) = True
-isSystemName other = False