GHC.Types.Name.Cache

ghc-9.2.0.20210422: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Types.Name.Cache

Description

The Name Cache

Synopsis

- lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
- extendOrigNameCache :: OrigNameCache -> Name -> OrigNameCache
- extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
- initNameCache :: UniqSupply -> [Name] -> NameCache
- data NameCache = NameCache {
  - nsUniqs :: !UniqSupply
  - nsNames :: !OrigNameCache
  }
- type OrigNameCache = ModuleEnv (OccEnv Name)

# Documentation

lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name Source #

extendOrigNameCache :: OrigNameCache -> Name -> OrigNameCache Source #

extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache Source #

initNameCache :: UniqSupply -> [Name] -> NameCache Source #

Return a function to atomically update the name cache.

data NameCache Source #

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.

Constructors

NameCache |
Fields nsUniqs :: !UniqSupply Supply of uniques nsNames :: !OrigNameCache Ensures that one original name gets one unique

type OrigNameCache = ModuleEnv (OccEnv Name) Source #

Per-module cache of original `OccName`s given `Name`s