GHC.Types.Name.Env

ghc-9.14.0.20251028: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Types.Name.Env

Contents

- Var, Id and TyVar environments (maps)
  - Manipulating these environments
  - Dependency analysis

Synopsis

- type NameEnv a = UniqFM Name a
- mkNameEnv :: [(Name, a)] -> NameEnv a
- mkNameEnvWith :: (a -> Name) -> [a] -> NameEnv a
- fromUniqMap :: UniqMap Name a -> NameEnv a
- emptyNameEnv :: NameEnv a
- isEmptyNameEnv :: NameEnv a -> Bool
- unitNameEnv :: Name -> a -> NameEnv a
- nonDetNameEnvElts :: NameEnv a -> [a]
- extendNameEnv_C :: (a -> a -> a) -> NameEnv a -> Name -> a -> NameEnv a
- extendNameEnv_Acc :: (a -> b -> b) -> (a -> b) -> NameEnv b -> Name -> a -> NameEnv b
- extendNameEnv :: NameEnv a -> Name -> a -> NameEnv a
- extendNameEnvList :: NameEnv a -> [(Name, a)] -> NameEnv a
- extendNameEnvList_C :: (a -> a -> a) -> NameEnv a -> [(Name, a)] -> NameEnv a
- filterNameEnv :: (elt -> Bool) -> NameEnv elt -> NameEnv elt
- anyNameEnv :: (elt -> Bool) -> NameEnv elt -> Bool
- mapMaybeNameEnv :: (a -> Maybe b) -> NameEnv a -> NameEnv b
- extendNameEnvListWith :: (a -> Name) -> NameEnv a -> [a] -> NameEnv a
- plusNameEnv :: NameEnv a -> NameEnv a -> NameEnv a
- plusNameEnv_C :: (a -> a -> a) -> NameEnv a -> NameEnv a -> NameEnv a
- plusNameEnv_CD :: (a -> a -> a) -> NameEnv a -> a -> NameEnv a -> a -> NameEnv a
- plusNameEnv_CD2 :: (Maybe a -> Maybe a -> a) -> NameEnv a -> NameEnv a -> NameEnv a
- alterNameEnv :: (Maybe a -> Maybe a) -> NameEnv a -> Name -> NameEnv a
- plusNameEnvList :: [NameEnv a] -> NameEnv a
- plusNameEnvListWith :: (a -> a -> a) -> [NameEnv a] -> NameEnv a
- lookupNameEnv :: NameEnv a -> Name -> Maybe a
- lookupNameEnv_NF :: NameEnv a -> Name -> a
- delFromNameEnv :: NameEnv a -> Name -> NameEnv a
- delListFromNameEnv :: NameEnv a -> [Name] -> NameEnv a
- elemNameEnv :: Name -> NameEnv a -> Bool
- mapNameEnv :: (elt1 -> elt2) -> NameEnv elt1 -> NameEnv elt2
- disjointNameEnv :: NameEnv a -> NameEnv a -> Bool
- seqEltsNameEnv :: (elt -> ()) -> NameEnv elt -> ()
- type DNameEnv a = UniqDFM Name a
- emptyDNameEnv :: DNameEnv a
- isEmptyDNameEnv :: DNameEnv a -> Bool
- lookupDNameEnv :: DNameEnv a -> Name -> Maybe a
- delFromDNameEnv :: DNameEnv a -> Name -> DNameEnv a
- filterDNameEnv :: (a -> Bool) -> DNameEnv a -> DNameEnv a
- mapDNameEnv :: (a -> b) -> DNameEnv a -> DNameEnv b
- adjustDNameEnv :: (a -> a) -> DNameEnv a -> Name -> DNameEnv a
- alterDNameEnv :: (Maybe a -> Maybe a) -> DNameEnv a -> Name -> DNameEnv a
- extendDNameEnv :: DNameEnv a -> Name -> a -> DNameEnv a
- eltsDNameEnv :: DNameEnv a -> [a]
- extendDNameEnv_C :: (a -> a -> a) -> DNameEnv a -> Name -> a -> DNameEnv a
- plusDNameEnv_C :: (elt -> elt -> elt) -> DNameEnv elt -> DNameEnv elt -> DNameEnv elt
- foldDNameEnv :: (a -> b -> b) -> b -> DNameEnv a -> b
- nonDetStrictFoldDNameEnv :: (a -> b -> b) -> b -> DNameEnv a -> b
- depAnal :: (node -> [Name]) -> (node -> [Name]) -> [node] -> [SCC node]

# Var, Id and TyVar environments (maps)

type NameEnv a = UniqFM Name a Source #

Name Environment

## Manipulating these environments

mkNameEnv :: [(Name, a)] -> NameEnv a Source #

mkNameEnvWith :: (a -> Name) -> [a] -> NameEnv a Source #

fromUniqMap :: UniqMap Name a -> NameEnv a Source #

emptyNameEnv :: NameEnv a Source #

isEmptyNameEnv :: NameEnv a -> Bool Source #

unitNameEnv :: Name -> a -> NameEnv a Source #

nonDetNameEnvElts :: NameEnv a -> [a] Source #

extendNameEnv_C :: (a -> a -> a) -> NameEnv a -> Name -> a -> NameEnv a Source #

extendNameEnv_Acc :: (a -> b -> b) -> (a -> b) -> NameEnv b -> Name -> a -> NameEnv b Source #

extendNameEnv :: NameEnv a -> Name -> a -> NameEnv a Source #

extendNameEnvList :: NameEnv a -> [(Name, a)] -> NameEnv a Source #

extendNameEnvList_C :: (a -> a -> a) -> NameEnv a -> [(Name, a)] -> NameEnv a Source #

filterNameEnv :: (elt -> Bool) -> NameEnv elt -> NameEnv elt Source #

anyNameEnv :: (elt -> Bool) -> NameEnv elt -> Bool Source #

mapMaybeNameEnv :: (a -> Maybe b) -> NameEnv a -> NameEnv b Source #

extendNameEnvListWith :: (a -> Name) -> NameEnv a -> [a] -> NameEnv a Source #

plusNameEnv :: NameEnv a -> NameEnv a -> NameEnv a Source #

plusNameEnv_C :: (a -> a -> a) -> NameEnv a -> NameEnv a -> NameEnv a Source #

plusNameEnv_CD :: (a -> a -> a) -> NameEnv a -> a -> NameEnv a -> a -> NameEnv a Source #

plusNameEnv_CD2 :: (Maybe a -> Maybe a -> a) -> NameEnv a -> NameEnv a -> NameEnv a Source #

alterNameEnv :: (Maybe a -> Maybe a) -> NameEnv a -> Name -> NameEnv a Source #

plusNameEnvList :: [NameEnv a] -> NameEnv a Source #

plusNameEnvListWith :: (a -> a -> a) -> [NameEnv a] -> NameEnv a Source #

lookupNameEnv :: NameEnv a -> Name -> Maybe a Source #

lookupNameEnv_NF :: NameEnv a -> Name -> a Source #

delFromNameEnv :: NameEnv a -> Name -> NameEnv a Source #

delListFromNameEnv :: NameEnv a -> [Name] -> NameEnv a Source #

elemNameEnv :: Name -> NameEnv a -> Bool Source #

mapNameEnv :: (elt1 -> elt2) -> NameEnv elt1 -> NameEnv elt2 Source #

disjointNameEnv :: NameEnv a -> NameEnv a -> Bool Source #

seqEltsNameEnv :: (elt -> ()) -> NameEnv elt -> () Source #

type DNameEnv a = UniqDFM Name a Source #

Deterministic Name Environment

See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why we need DNameEnv.

emptyDNameEnv :: DNameEnv a Source #

isEmptyDNameEnv :: DNameEnv a -> Bool Source #

lookupDNameEnv :: DNameEnv a -> Name -> Maybe a Source #

delFromDNameEnv :: DNameEnv a -> Name -> DNameEnv a Source #

filterDNameEnv :: (a -> Bool) -> DNameEnv a -> DNameEnv a Source #

mapDNameEnv :: (a -> b) -> DNameEnv a -> DNameEnv b Source #

adjustDNameEnv :: (a -> a) -> DNameEnv a -> Name -> DNameEnv a Source #

alterDNameEnv :: (Maybe a -> Maybe a) -> DNameEnv a -> Name -> DNameEnv a Source #

extendDNameEnv :: DNameEnv a -> Name -> a -> DNameEnv a Source #

eltsDNameEnv :: DNameEnv a -> [a] Source #

extendDNameEnv_C :: (a -> a -> a) -> DNameEnv a -> Name -> a -> DNameEnv a Source #

plusDNameEnv_C :: (elt -> elt -> elt) -> DNameEnv elt -> DNameEnv elt -> DNameEnv elt Source #

foldDNameEnv :: (a -> b -> b) -> b -> DNameEnv a -> b Source #

nonDetStrictFoldDNameEnv :: (a -> b -> b) -> b -> DNameEnv a -> b Source #

## Dependency analysis

depAnal :: (node -> [Name]) -> (node -> [Name]) -> [node] -> [SCC node] Source #