-mkImportedLocalName :: Unique -> OccName -> SrcLoc -> Name
- -- Just the same as mkLocalName, except the provenance is different
- -- Reason: this flags the name as one that came in from an interface file.
- -- This is useful when trying to decide which of two type variables
- -- should 'win' when unifying them.
- -- NB: this is only for non-top-level names, so we use ImplicitImport
-mkImportedLocalName uniq occ loc = Name { n_uniq = uniq, n_sort = Local, n_occ = occ,
- n_prov = NonLocalDef ImplicitImport True }
-
-
-mkGlobalName :: Unique -> Module -> OccName -> Provenance -> Name
-mkGlobalName uniq mod occ prov = Name { n_uniq = uniq, n_sort = Global mod,
- n_occ = occ, n_prov = prov }
-
-
-mkKnownKeyGlobal :: (RdrName, Unique) -> Name
-mkKnownKeyGlobal (rdr_name, uniq)
- = mkGlobalName uniq (mkVanillaModule (rdrNameModule rdr_name))
- (rdrNameOcc rdr_name)
- systemProvenance
-
-mkSysLocalName :: Unique -> FAST_STRING -> Name
-mkSysLocalName uniq fs = Name { n_uniq = uniq, n_sort = Local,
- n_occ = mkSrcVarOcc fs, n_prov = systemProvenance }
-
-mkTopName :: Unique -> Module -> FAST_STRING -> Name
- -- Make a top-level name; make it Global if top-level
- -- things should be externally visible; Local otherwise
- -- This chap is only used *after* the tidyCore phase
- -- Notably, it is used during STG lambda lifting
- --
- -- We have to make sure that the name is globally unique
- -- and we don't have tidyCore to help us. So we append
- -- the unique. Hack! Hack!
-mkTopName uniq mod fs
- = Name { n_uniq = uniq,
- n_sort = mk_top_sort mod,
- n_occ = mkSrcVarOcc (_PK_ ((_UNPK_ fs) ++ show uniq)),
- n_prov = LocalDef noSrcLoc NotExported }
-
-------------------------- Wired in names -------------------------
-
-mkWiredInIdName :: Unique -> Module -> OccName -> Id -> Name
-mkWiredInIdName uniq mod occ id = Name { n_uniq = uniq, n_sort = WiredInId mod id,
- n_occ = occ, n_prov = SystemProv }
-
--- mkWiredInTyConName takes a FAST_STRING instead of
--- an OccName, which is a bit yukky but that's what the
--- clients find easiest.
-mkWiredInTyConName :: Unique -> Module -> FAST_STRING -> TyCon -> Name
-mkWiredInTyConName uniq mod fs tycon
- = Name { n_uniq = uniq, n_sort = WiredInTyCon mod tycon,
- n_occ = mkSrcOccFS tcName fs, n_prov = SystemProv }
-
-
----------------------------------------------------------------------
-mkDerivedName :: (OccName -> OccName)
- -> Name -- Base name
- -> Unique -- New unique
- -> Name -- Result is always a value name
-
-mkDerivedName f name uniq = name {n_uniq = uniq, n_occ = f (n_occ name)}