|
|
|
|
|
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.RdrName: see RdrName
- Name.Name: see Name
- Id.Id: see Id
- Var.Var: see Var
|
|
Synopsis |
|
|
|
|
The NameSpace type
|
|
|
Instances | |
|
|
Construction
|
|
There are two forms of data constructor:
- Source data constructors
- The data constructors mentioned in Haskell source code
- Real data constructors
- The data constructors of the representation type, which may not be the same as the source type
For example:
data T = T !(Int, Int)
The source datacon has type (Int, Int) -> T
The real datacon has type Int -> Int -> T
GHC chooses a representation based on the strictness etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pretty Printing
|
|
|
|
|
|
|
|
The OccName type
|
|
|
Instances | |
|
|
|
|
Construction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:: 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
|
|
|
|
|
|
|
Derived OccNames
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:: Int | Index of superclass, e.g. 3
| -> OccName | Class, e.g. Ord
| -> OccName | Derived Occname, e.g. $p3Ord
|
|
|
|
|
|
|
|
|
:: 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Deconstruction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Test if the OccName is a data constructor that starts with
a symbol (e.g. :, or [])
|
|
|
Test if the OccName is that for any operator (whether
it is a data constructor or variable or whatever)
|
|
|
Value OccNamess are those that are either in
the variable or data constructor namespaces
|
|
|
Wrap parens around an operator
|
|
|
Haskell 98 encourages compilers to suppress warnings about unsed
names in a pattern if they start with _: this implements that test
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The OccEnv type
|
|
|
Instances | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The OccSet type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tidying up
|
|
|
|
|
|
|
|
|
|
Lexical characteristics of Haskell names
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Produced by Haddock version 2.6.1 |