ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Types.Name.Occurrence

Contents

- The `NameSpace` type
  - Construction
  - Pretty Printing
- The `OccName` type
  - Construction
  - Derived `OccName`s
  - Deconstruction
- The `OccEnv` type
- The `OccSet` type
- Dealing with main
- Tidying up

Description

GHC uses several kinds of name internally:

- `OccName` represents names as strings with just a little more information: the "namespace" that the name came from, e.g. the namespace of value, type constructors or data constructors
- `RdrName`: see GHC.Types.Name.Reader
- `Name`: see GHC.Types.Name
- `Id`: see GHC.Types.Id
- `Var`: see GHC.Types.Var

Synopsis

- data NameSpace
- tcName :: NameSpace
- clsName :: NameSpace
- tcClsName :: NameSpace
- dataName :: NameSpace
- varName :: NameSpace
- fieldName :: FastString -> NameSpace
- tvName :: NameSpace
- srcDataName :: NameSpace
- pprNameSpace :: NameSpace -> SDoc
- pprNonVarNameSpace :: NameSpace -> SDoc
- pprNameSpaceBrief :: NameSpace -> SDoc
- data OccName
- pprOccName :: IsLine doc => OccName -> doc
- occNameMangledFS :: OccName -> FastString
- mkOccName :: NameSpace -> String -> OccName
- mkOccNameFS :: NameSpace -> FastString -> OccName
- mkVarOcc :: String -> OccName
- mkVarOccFS :: FastString -> OccName
- mkRecFieldOcc :: FastString -> String -> OccName
- mkRecFieldOccFS :: FastString -> FastString -> OccName
- mkDataOcc :: String -> OccName
- mkDataOccFS :: FastString -> OccName
- mkTyVarOcc :: String -> OccName
- mkTyVarOccFS :: FastString -> OccName
- mkTcOcc :: String -> OccName
- mkTcOccFS :: FastString -> OccName
- mkClsOcc :: String -> OccName
- mkClsOccFS :: FastString -> OccName
- mkDFunOcc :: String -> Bool -> OccSet -> OccName
- setOccNameSpace :: NameSpace -> OccName -> OccName
- demoteOccName :: OccName -> Maybe OccName
- demoteOccTcClsName :: OccName -> Maybe OccName
- demoteOccTvName :: OccName -> Maybe OccName
- promoteOccName :: OccName -> Maybe OccName
- varToRecFieldOcc :: HasDebugCallStack => FastString -> OccName -> OccName
- recFieldToVarOcc :: HasDebugCallStack => OccName -> OccName
- class HasOccName name where
  - occName :: name -> OccName
- isDerivedOccName :: OccName -> Bool
- mkDataConWrapperOcc :: OccName -> OccName
- mkWorkerOcc :: OccName -> OccName
- mkMatcherOcc :: OccName -> OccName
- mkBuilderOcc :: OccName -> OccName
- mkDefaultMethodOcc :: OccName -> OccName
- isDefaultMethodOcc :: OccName -> Bool
- isTypeableBindOcc :: OccName -> Bool
- mkNewTyCoOcc :: OccName -> OccName
- mkClassOpAuxOcc :: OccName -> OccName
- mkCon2TagOcc :: OccName -> OccName
- mkTag2ConOcc :: OccName -> OccName
- mkMaxTagOcc :: OccName -> OccName
- mkClassDataConOcc :: OccName -> OccName
- mkDictOcc :: OccName -> OccName
- mkIPOcc :: OccName -> OccName
- mkSpecOcc :: OccName -> OccName
- mkForeignExportOcc :: OccName -> OccName
- mkRepEqOcc :: OccName -> OccName
- mkGenR :: OccName -> OccName
- mkGen1R :: OccName -> OccName
- mkDataTOcc :: OccName -> OccName
- mkDataCOcc :: OccName -> OccName
- mkDataConWorkerOcc :: OccName -> OccName
- mkSuperDictSelOcc :: Int -> OccName -> OccName
- mkSuperDictAuxOcc :: Int -> OccName -> OccName
- mkLocalOcc :: Unique -> OccName -> OccName
- mkMethodOcc :: OccName -> OccName
- mkInstTyTcOcc :: String -> OccSet -> OccName
- mkInstTyCoOcc :: OccName -> OccName
- mkEqPredCoOcc :: OccName -> OccName
- mkTyConRepOcc :: OccName -> OccName
- occNameFS :: OccName -> FastString
- occNameString :: OccName -> String
- occNameSpace :: OccName -> NameSpace
- isVarOcc :: OccName -> Bool
- isTvOcc :: OccName -> Bool
- isTcOcc :: OccName -> Bool
- isDataOcc :: OccName -> Bool
- isDataSymOcc :: OccName -> Bool
- isSymOcc :: OccName -> Bool
- isValOcc :: OccName -> Bool
- isFieldOcc :: OccName -> Bool
- fieldOcc_maybe :: OccName -> Maybe FastString
- parenSymOcc :: OccName -> SDoc -> SDoc
- startsWithUnderscore :: OccName -> Bool
- isUnderscore :: OccName -> Bool
- isTcClsNameSpace :: NameSpace -> Bool
- isTvNameSpace :: NameSpace -> Bool
- isDataConNameSpace :: NameSpace -> Bool
- isVarNameSpace :: NameSpace -> Bool
- isValNameSpace :: NameSpace -> Bool
- isFieldNameSpace :: NameSpace -> Bool
- isTermVarOrFieldNameSpace :: NameSpace -> Bool
- data OccEnv a
- emptyOccEnv :: OccEnv a
- unitOccEnv :: OccName -> a -> OccEnv a
- extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a
- mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
- strictMapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b
- mapMaybeOccEnv :: (a -> Maybe b) -> OccEnv a -> OccEnv b
- lookupOccEnv :: OccEnv a -> OccName -> Maybe a
- lookupOccEnv_AllNameSpaces :: OccEnv a -> OccName -> [a]
- lookupOccEnv_WithFields :: OccEnv a -> OccName -> [a]
- lookupFieldsOccEnv :: OccEnv a -> FastString -> [a]
- mkOccEnv :: [(OccName, a)] -> OccEnv a
- mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a
- extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a
- elemOccEnv :: OccName -> OccEnv a -> Bool
- nonDetOccEnvElts :: OccEnv a -> [a]
- nonDetFoldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b
- plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a
- plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a
- extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b
- filterOccEnv :: (a -> Bool) -> OccEnv a -> OccEnv a
- delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a
- delFromOccEnv :: OccEnv a -> OccName -> OccEnv a
- alterOccEnv :: (Maybe a -> Maybe a) -> OccEnv a -> OccName -> OccEnv a
- minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a
- minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a
- minusOccEnv_C_Ns :: (UniqFM NameSpace a -> UniqFM NameSpace b -> UniqFM NameSpace a) -> OccEnv a -> OccEnv b -> OccEnv a
- sizeOccEnv :: OccEnv a -> Int
- pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc
- forceOccEnv :: (a -> ()) -> OccEnv a -> ()
- intersectOccEnv_C :: (a -> b -> c) -> OccEnv a -> OccEnv b -> OccEnv c
- data OccSet
- emptyOccSet :: OccSet
- unitOccSet :: OccName -> OccSet
- mkOccSet :: [OccName] -> OccSet
- extendOccSet :: OccSet -> OccName -> OccSet
- extendOccSetList :: OccSet -> [OccName] -> OccSet
- unionOccSets :: OccSet -> OccSet -> OccSet
- unionManyOccSets :: [OccSet] -> OccSet
- elemOccSet :: OccName -> OccSet -> Bool
- isEmptyOccSet :: OccSet -> Bool
- mainOcc :: OccName
- ppMainFn :: OccName -> SDoc
- type TidyOccEnv = UniqFM FastString Int
- emptyTidyOccEnv :: TidyOccEnv
- initTidyOccEnv :: [OccName] -> TidyOccEnv
- trimTidyOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
- tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)
- avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv
- delTidyOccEnvList :: TidyOccEnv -> [OccName] -> TidyOccEnv
- type FastStringEnv a = UniqFM FastString a
- emptyFsEnv :: FastStringEnv a
- lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a
- extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a
- mkFsEnv :: [(FastString, a)] -> FastStringEnv a

# The `NameSpace` type

data NameSpace #

#### Instances

Instances details

NFData NameSpace # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: NameSpace -> () #
Uniquable NameSpace # |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: NameSpace -> Unique #
Binary NameSpace # |
Instance details Defined in GHC.Types.Name.Occurrence Methods put_ :: WriteBinHandle -> NameSpace -> IO () # put :: WriteBinHandle -> NameSpace -> IO (Bin NameSpace) # get :: ReadBinHandle -> IO NameSpace #
Eq NameSpace # |
Instance details Defined in GHC.Types.Name.Occurrence Methods (==) :: NameSpace -> NameSpace -> Bool # (/=) :: NameSpace -> NameSpace -> Bool #
Ord NameSpace # |
Instance details Defined in GHC.Types.Name.Occurrence Methods compare :: NameSpace -> NameSpace -> Ordering # (<) :: NameSpace -> NameSpace -> Bool # (<=) :: NameSpace -> NameSpace -> Bool # (>) :: NameSpace -> NameSpace -> Bool # (>=) :: NameSpace -> NameSpace -> Bool # max :: NameSpace -> NameSpace -> NameSpace # min :: NameSpace -> NameSpace -> NameSpace #

## Construction

tcName :: NameSpace #

clsName :: NameSpace #

tcClsName :: NameSpace #

dataName :: NameSpace #

varName :: NameSpace #

fieldName :: FastString -> NameSpace #

tvName :: NameSpace #

srcDataName :: NameSpace #

## Pretty Printing

pprNameSpace :: NameSpace -> SDoc #

pprNonVarNameSpace :: NameSpace -> SDoc #

pprNameSpaceBrief :: NameSpace -> SDoc #

# The `OccName` type

data OccName #

Occurrence Name

In this context that means: "classified (i.e. as a type name, value name, etc) but not qualified and not yet resolved"

#### Instances

Instances details

NFData OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: OccName -> () #
Data OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OccName -> c OccName # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OccName # toConstr :: OccName -> Constr # dataTypeOf :: OccName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OccName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OccName) # gmapT :: (forall b. Data b => b -> b) -> OccName -> OccName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r # gmapQ :: (forall d. Data d => d -> u) -> OccName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> OccName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccName -> m OccName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName #
HasOccName OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods occName :: OccName -> OccName #
Binary OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods put_ :: WriteBinHandle -> OccName -> IO () # put :: WriteBinHandle -> OccName -> IO (Bin OccName) # get :: ReadBinHandle -> IO OccName #
Outputable OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods ppr :: OccName -> SDoc #
OutputableBndr OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods pprBndr :: BindingSite -> OccName -> SDoc # pprPrefixOcc :: OccName -> SDoc # pprInfixOcc :: OccName -> SDoc # bndrIsJoin_maybe :: OccName -> JoinPointHood #
Eq OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods (==) :: OccName -> OccName -> Bool # (/=) :: OccName -> OccName -> Bool #
Ord OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods compare :: OccName -> OccName -> Ordering # (<) :: OccName -> OccName -> Bool # (<=) :: OccName -> OccName -> Bool # (>) :: OccName -> OccName -> Bool # (>=) :: OccName -> OccName -> Bool # max :: OccName -> OccName -> OccName # min :: OccName -> OccName -> OccName #

pprOccName :: IsLine doc => OccName -> doc #

occNameMangledFS :: OccName -> FastString #

Mangle field names to avoid duplicate symbols.

See Note [Mangling OccNames].

## Construction

mkOccName :: NameSpace -> String -> OccName #

mkOccNameFS :: NameSpace -> FastString -> OccName #

mkVarOcc :: String -> OccName #

mkVarOccFS :: FastString -> OccName #

mkRecFieldOcc :: FastString -> String -> OccName #

mkRecFieldOccFS :: FastString -> FastString -> OccName #

mkDataOcc :: String -> OccName #

mkDataOccFS :: FastString -> OccName #

mkTyVarOcc :: String -> OccName #

mkTyVarOccFS :: FastString -> OccName #

mkTcOcc :: String -> OccName #

mkTcOccFS :: FastString -> OccName #

mkClsOcc :: String -> OccName #

mkClsOccFS :: FastString -> OccName #

mkDFunOcc #

Arguments

:: String | Typically the class and type glommed together e.g. `OrdMaybe`. Only used in debug mode, for extra clarity
-> Bool | Is this a hs-boot instance DFun?
-> OccSet | avoid these Occs
-> OccName | E.g. `$f3OrdMaybe`

setOccNameSpace :: NameSpace -> OccName -> OccName #

demoteOccName :: OccName -> Maybe OccName #

demoteOccTcClsName :: OccName -> Maybe OccName #

demoteOccTvName :: OccName -> Maybe OccName #

promoteOccName :: OccName -> Maybe OccName #

varToRecFieldOcc :: HasDebugCallStack => FastString -> OccName -> OccName #

recFieldToVarOcc :: HasDebugCallStack => OccName -> OccName #

class HasOccName name where #

Other names in the compiler add additional information to an OccName. This class provides a consistent way to access the underlying OccName.

Methods

occName :: name -> OccName #

#### Instances

Instances details

HasOccName IfaceClassOp # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceClassOp -> OccName #
HasOccName IfaceConDecl # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceConDecl -> OccName #
HasOccName IfaceDecl # |
Instance details Defined in GHC.Iface.Syntax Methods occName :: IfaceDecl -> OccName #
HasOccName HoleFitCandidate # |
Instance details Defined in GHC.Tc.Errors.Hole.FitTypes Methods occName :: HoleFitCandidate -> OccName #
HasOccName TcBinder # |
Instance details Defined in GHC.Tc.Types.BasicTypes Methods occName :: TcBinder -> OccName #
HasOccName FieldLabel # |
Instance details Defined in GHC.Types.FieldLabel Methods occName :: FieldLabel -> OccName #
HasOccName Name # |
Instance details Defined in GHC.Types.Name Methods occName :: Name -> OccName #
HasOccName OccName # |
Instance details Defined in GHC.Types.Name.Occurrence Methods occName :: OccName -> OccName #
HasOccName RdrName # |
Instance details Defined in GHC.Types.Name.Reader Methods occName :: RdrName -> OccName #
HasOccName Var # |
Instance details Defined in GHC.Types.Var Methods occName :: Var -> OccName #
HasOccName (GlobalRdrEltX info) # |
Instance details Defined in GHC.Types.Name.Reader Methods occName :: GlobalRdrEltX info -> OccName #
(HasOccName (IdP (GhcPass p)), OutputableBndrId p) => HasOccName (IEWrappedName (GhcPass p)) # |
Instance details Defined in GHC.Hs.ImpExp Methods occName :: IEWrappedName (GhcPass p) -> OccName #

## Derived `OccName`s

isDerivedOccName :: OccName -> Bool #

Test for definitions internally generated by GHC. This predicate is used to suppress printing of internal definitions in some debug prints

mkDataConWrapperOcc :: OccName -> OccName #

mkWorkerOcc :: OccName -> OccName #

mkMatcherOcc :: OccName -> OccName #

mkBuilderOcc :: OccName -> OccName #

mkDefaultMethodOcc :: OccName -> OccName #

isDefaultMethodOcc :: OccName -> Bool #

isTypeableBindOcc :: OccName -> Bool #

Is an `OccName` one of a Typeable `TyCon` or `Module` binding? This is needed as these bindings are renamed differently. See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.

mkNewTyCoOcc :: OccName -> OccName #

mkClassOpAuxOcc :: OccName -> OccName #

mkCon2TagOcc :: OccName -> OccName #

mkTag2ConOcc :: OccName -> OccName #

mkMaxTagOcc :: OccName -> OccName #

mkClassDataConOcc :: OccName -> OccName #

mkDictOcc :: OccName -> OccName #

mkIPOcc :: OccName -> OccName #

mkSpecOcc :: OccName -> OccName #

mkForeignExportOcc :: OccName -> OccName #

mkRepEqOcc :: OccName -> OccName #

mkGenR :: OccName -> OccName #

mkGen1R :: OccName -> OccName #

mkDataTOcc :: OccName -> OccName #

mkDataCOcc :: OccName -> OccName #

mkDataConWorkerOcc :: OccName -> OccName #

mkSuperDictSelOcc #

Arguments

:: Int | Index of superclass, e.g. 3
-> OccName | Class, e.g. `Ord`
-> OccName | Derived `Occname`, e.g. `$p3Ord`

mkSuperDictAuxOcc :: Int -> OccName -> OccName #

mkLocalOcc #

Arguments

:: Unique | Unique to combine with the `OccName`
-> OccName | Local name, e.g. `sat`
-> OccName | Nice unique version, e.g. `$L23sat`

mkMethodOcc :: OccName -> OccName #

mkInstTyTcOcc #

Arguments

:: String | Family name, e.g. `Map`
-> OccSet | avoid these Occs
-> OccName |
    R:Map

Derive a name for the representation type constructor of a `data`/`newtype` instance.

mkInstTyCoOcc :: OccName -> OccName #

mkEqPredCoOcc :: OccName -> OccName #

mkTyConRepOcc :: OccName -> OccName #

## Deconstruction

occNameFS :: OccName -> FastString #

occNameString :: OccName -> String #

occNameSpace :: OccName -> NameSpace #

isVarOcc :: OccName -> Bool #

isTvOcc :: OccName -> Bool #

isTcOcc :: OccName -> Bool #

isDataOcc :: OccName -> Bool #

isDataSymOcc :: OccName -> Bool #

Test if the `OccName` is a data constructor that starts with a symbol (e.g. `:`, or `[]`)

isSymOcc :: OccName -> Bool #

Test if the `OccName` is that for any operator (whether it is a data constructor or variable or whatever)

isValOcc :: OccName -> Bool #

Value `OccNames`s are those that are either in the variable, field name or data constructor namespaces

isFieldOcc :: OccName -> Bool #

fieldOcc_maybe :: OccName -> Maybe FastString #

parenSymOcc :: OccName -> SDoc -> SDoc #

Wrap parens around an operator

startsWithUnderscore :: OccName -> Bool #

Haskell 98 encourages compilers to suppress warnings about unused names in a pattern if they start with `_`: this implements that test

isUnderscore :: OccName -> Bool #

isTcClsNameSpace :: NameSpace -> Bool #

isTvNameSpace :: NameSpace -> Bool #

isDataConNameSpace :: NameSpace -> Bool #

isVarNameSpace :: NameSpace -> Bool #

isValNameSpace :: NameSpace -> Bool #

isFieldNameSpace :: NameSpace -> Bool #

isTermVarOrFieldNameSpace :: NameSpace -> Bool #

Is this a term variable or field name namespace?

# The `OccEnv` type

data OccEnv a #

A map keyed on `OccName`. See Note [OccEnv].

#### Instances

Instances details

Functor OccEnv # |
Instance details Defined in GHC.Types.Name.Occurrence Methods fmap :: (a -> b) -> OccEnv a -> OccEnv b # (<$) :: a -> OccEnv b -> OccEnv a #
NFData a => NFData (OccEnv a) # |
Instance details Defined in GHC.Types.Name.Occurrence Methods rnf :: OccEnv a -> () #
Outputable a => Outputable (OccEnv a) # |
Instance details Defined in GHC.Types.Name.Occurrence Methods ppr :: OccEnv a -> SDoc #

emptyOccEnv :: OccEnv a #

The empty `OccEnv`.

unitOccEnv :: OccName -> a -> OccEnv a #

A singleton `OccEnv`.

extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a #

Add a single element to an `OccEnv`.

mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b #

Map over an `OccEnv` (`Functor` instance).

strictMapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b #

Map over an `OccEnv` strictly.

mapMaybeOccEnv :: (a -> Maybe b) -> OccEnv a -> OccEnv b #

`mapMaybe` for b `OccEnv`.

lookupOccEnv :: OccEnv a -> OccName -> Maybe a #

Look an element up in an `OccEnv`.

lookupOccEnv_AllNameSpaces :: OccEnv a -> OccName -> [a] #

Lookup an element in an `OccEnv`, ignoring `NameSpace`s entirely.

lookupOccEnv_WithFields :: OccEnv a -> OccName -> [a] #

Lookup an element in an `OccEnv`, looking in the record field namespace for a variable.

lookupFieldsOccEnv :: OccEnv a -> FastString -> [a] #

Look up all the record fields that match with the given `FastString` in an `OccEnv`.

mkOccEnv :: [(OccName, a)] -> OccEnv a #

Create an `OccEnv` from a list.

`OccName`s later on in the list override earlier `OccName`s.

mkOccEnv_C #

Arguments

:: (a -> a -> a) | old -> new -> result
-> [(OccName, a)] |
-> OccEnv a |

Create an `OccEnv` from a list, combining different values with the same `OccName` using the combining function.

extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a #

Extend an `OccEnv` by a list.

`OccName`s later on in the list override earlier `OccName`s.

elemOccEnv :: OccName -> OccEnv a -> Bool #

Compute whether there is a value keyed by the given `OccName`.

nonDetOccEnvElts :: OccEnv a -> [a] #

Obtain the elements of an `OccEnv`.

The resulting order is non-deterministic.

nonDetFoldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b #

Fold over an `OccEnv`. Non-deterministic, unless the folding function is commutative (i.e. `a1 `f` ( a2 `f` b ) == a2 `f` ( a1 `f` b )` for all `a1`, `a2`, `b`).

plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a #

Union of two `OccEnv`s, right-biased.

plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a #

Union of two `OccEnv`s with a combining function.

extendOccEnv_Acc #

Arguments

:: (a -> b -> b) | add to existing
-> (a -> b) | new element
-> OccEnv b | old
-> OccName |
-> a | new
-> OccEnv b |

Add a single element to an `OccEnv`, using a different function whether the `OccName` already exists or not.

filterOccEnv :: (a -> Bool) -> OccEnv a -> OccEnv a #

Filter out all elements in an `OccEnv` using a predicate.

delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a #

Delete multiple elements from an `OccEnv`.

delFromOccEnv :: OccEnv a -> OccName -> OccEnv a #

Delete one element from an `OccEnv`.

alterOccEnv :: (Maybe a -> Maybe a) -> OccEnv a -> OccName -> OccEnv a #

Alter an `OccEnv`, adding or removing an element at the given key.

minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a #

Remove elements of the first `OccEnv` that appear in the second `OccEnv`.

minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a #

Alters (replaces or removes) those elements of the first `OccEnv` that are mentioned in the second `OccEnv`.

Same idea as `differenceWith`.

minusOccEnv_C_Ns :: (UniqFM NameSpace a -> UniqFM NameSpace b -> UniqFM NameSpace a) -> OccEnv a -> OccEnv b -> OccEnv a #

sizeOccEnv :: OccEnv a -> Int #

pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc #

forceOccEnv :: (a -> ()) -> OccEnv a -> () #

Force an `OccEnv` with the provided function.

intersectOccEnv_C :: (a -> b -> c) -> OccEnv a -> OccEnv b -> OccEnv c #

# The `OccSet` type

data OccSet #

emptyOccSet :: OccSet #

unitOccSet :: OccName -> OccSet #

mkOccSet :: [OccName] -> OccSet #

extendOccSet :: OccSet -> OccName -> OccSet #

extendOccSetList :: OccSet -> [OccName] -> OccSet #

unionOccSets :: OccSet -> OccSet -> OccSet #

unionManyOccSets :: [OccSet] -> OccSet #

elemOccSet :: OccName -> OccSet -> Bool #

isEmptyOccSet :: OccSet -> Bool #

# Dealing with main

mainOcc :: OccName #

ppMainFn :: OccName -> SDoc #

# Tidying up

type TidyOccEnv = UniqFM FastString Int #

emptyTidyOccEnv :: TidyOccEnv #

initTidyOccEnv :: [OccName] -> TidyOccEnv #

trimTidyOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv #

tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName) #

avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv #

delTidyOccEnvList :: TidyOccEnv -> [OccName] -> TidyOccEnv #

type FastStringEnv a = UniqFM FastString a #

A non-deterministic set of FastStrings. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why it's not deterministic and why it matters. Use DFastStringEnv if the set eventually gets converted into a list or folded over in a way where the order changes the generated code.

emptyFsEnv :: FastStringEnv a #

lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a #

extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a #

mkFsEnv :: [(FastString, a)] -> FastStringEnv a #