HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleghc-10.0.0.20260917GHC2024

GHC.Types.Name.Occurrence

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_types

  • Name: see GHC.Types.Name#name_types

  • GHC.Types.Id.Id: see GHC.Types.Id#name_types

  • Var: see GHC.Types.Var#name_types

Contents
  1. The NameSpace type
  2. Construction
  3. Pretty Printing
  4. The OccName type
  5. Construction
  6. Derived OccNames
  7. Deconstruction
  8. The OccEnv type
  9. The OccSet type
  10. Dealing with main
  11. Tidying up
Synopsis

The NameSpace type

datadata NameSpace
#
Instances5Eq, Ord, NFData, Uniquable, Binary
  • Eq NameSpaceDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • Ord NameSpaceDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • NFData NameSpaceDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • Uniquable NameSpaceDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • Binary NameSpaceDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence

Construction

Pretty Printing

The OccName type

datadata 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"

Instances8Eq, Data, Ord, NFData, Outputable, Binary, …
  • Eq OccNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • Data OccNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • Ord OccNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • NFData OccNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • Outputable OccNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • Binary OccNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • OutputableBndr OccNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence
  • HasOccName OccNameDefined in ghc-10.0.0.20260917 · GHC.Types.Name.Occurrence

Construction

valuemkDFunOcc
  1. :: String

    Typically the class and type glommed together e.g. OrdMaybe. Only used in debug mode, for extra clarity

  2. -> Bool

    Is this a hs-boot instance DFun?

  3. -> OccSet

    avoid these Occs

  4. -> OccName

    E.g. $f3OrdMaybe

#
classclass 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

Instances12HasOccName, …

Derived OccNames

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

Deconstruction

valueisValOcc :: OccName -> Bool

Value OccNamess are those that are either in the variable, field name or data constructor namespaces

The OccEnv type

valuenonDetFoldOccEnv :: (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).

The OccSet type

Dealing with main

Tidying up

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.