Safe Haskell | None |
---|---|
Language | GHC2021 |
The Name Cache
Synopsis
- data NameCache = NameCache {
- nsUniqChar :: !Char
- nsNames :: !(MVar OrigNameCache)
- initNameCache :: Char -> [Name] -> IO NameCache
- takeUniqFromNameCache :: NameCache -> IO Unique
- updateNameCache' :: NameCache -> (OrigNameCache -> IO (OrigNameCache, c)) -> IO c
- updateNameCache :: NameCache -> Module -> OccName -> (OrigNameCache -> IO (OrigNameCache, c)) -> IO c
- type OrigNameCache = ModuleEnv (OccEnv Name)
- lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
- extendOrigNameCache' :: OrigNameCache -> Name -> OrigNameCache
- extendOrigNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
Documentation
The NameCache makes sure that there is just one Unique assigned for each original name; i.e. (module-name, occ-name) pair and provides something of a lookup mechanism for those names.
NameCache | |
|
updateNameCache' :: NameCache -> (OrigNameCache -> IO (OrigNameCache, c)) -> IO c Source #
Update the name cache with the given function
updateNameCache :: NameCache -> Module -> OccName -> (OrigNameCache -> IO (OrigNameCache, c)) -> IO c Source #
Update the name cache with the given function
Additionally, it ensures that the given Module and OccName are evaluated. If not, chaos can ensue: we read the name-cache then pull on mod (say) which does some stuff that modifies the name cache This did happen, with tycon_mod in GHC.IfaceToCore.tcIfaceAlt (DataAlt..)
OrigNameCache
lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name Source #
extendOrigNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache Source #