|
|
|
|
|
Description |
GHC uses several kinds of name internally:
|
|
Synopsis |
|
|
|
|
The NameSpace type
|
|
data NameSpace |
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.
|
|
clsName :: NameSpace |
|
varName :: NameSpace |
|
srcDataName :: NameSpace |
|
Pretty Printing
|
|
pprNameSpace :: NameSpace -> SDoc |
|
pprNonVarNameSpace :: NameSpace -> SDoc |
|
pprNameSpaceBrief :: NameSpace -> SDoc |
|
The OccName type
|
|
data OccName |
Instances | |
|
|
pprOccName :: OccName -> SDoc |
|
Construction
|
|
mkOccName :: NameSpace -> String -> OccName |
|
mkOccNameFS :: NameSpace -> FastString -> OccName |
|
mkVarOcc :: String -> OccName |
|
mkVarOccFS :: 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 | 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?
| -> Int | Unique index
| -> OccName | E.g. $f3OrdMaybe
|
|
|
mkTupleOcc :: NameSpace -> Boxity -> Arity -> OccName |
|
setOccNameSpace :: NameSpace -> OccName -> OccName |
|
Derived OccNames
|
|
isDerivedOccName :: OccName -> Bool |
|
mkWorkerOcc :: OccName -> OccName |
|
mkSuperDictSelOcc |
:: Int | Index of superclass, e.g. 3
| -> OccName | Class, e.g. Ord
| -> OccName | Derived Occname, e.g. $p3Ord
|
|
|
mkLocalOcc |
|
|
mkMethodOcc :: OccName -> OccName |
|
mkInstTyTcOcc |
:: Int | DFun Index
| -> OccName | Family name, e.g. Map
| -> OccName | Nice unique version, e.g. :R23Map
| Derive a name for the representation type constructor of a
data/newtype instance.
|
|
|
Deconstruction
|
|
occNameFS :: OccName -> FastString |
|
occNameString :: OccName -> String |
|
occNameSpace :: OccName -> NameSpace |
|
isTvOcc :: 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 OccNamess are those that are either in
the variable or data constructor namespaces
|
|
parenSymOcc :: OccName -> SDoc -> SDoc |
Wrap parens around an operator
|
|
reportIfUnused :: OccName -> Bool |
Haskell 98 encourages compilers to suppress warnings about
unused names in a pattern if they start with _: this implements
that test
|
|
isTcClsNameSpace :: NameSpace -> Bool |
|
isTvNameSpace :: NameSpace -> Bool |
|
isDataConNameSpace :: NameSpace -> Bool |
|
isVarNameSpace :: NameSpace -> Bool |
|
isValNameSpace :: NameSpace -> Bool |
|
isTupleOcc_maybe :: OccName -> Maybe (NameSpace, Boxity, Arity) |
|
The OccEnv type
|
|
data OccEnv a |
Instances | |
|
|
emptyOccEnv :: OccEnv a |
|
unitOccEnv :: OccName -> a -> OccEnv a |
|
extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a |
|
mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b |
|
lookupOccEnv :: OccEnv a -> OccName -> Maybe 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 |
|
occEnvElts :: OccEnv a -> [a] |
|
foldOccEnv :: (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_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv a |
|
filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt |
|
delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a |
|
delFromOccEnv :: OccEnv a -> OccName -> OccEnv a |
|
The OccSet type
|
|
type OccSet = UniqSet OccName |
|
emptyOccSet :: OccSet |
|
unitOccSet :: OccName -> OccSet |
|
mkOccSet :: [OccName] -> OccSet |
|
extendOccSet :: OccSet -> OccName -> OccSet |
|
extendOccSetList :: OccSet -> [OccName] -> OccSet |
|
unionOccSets :: OccSet -> OccSet -> OccSet |
|
unionManyOccSets :: [OccSet] -> OccSet |
|
minusOccSet :: OccSet -> OccSet -> OccSet |
|
elemOccSet :: OccName -> OccSet -> Bool |
|
occSetElts :: OccSet -> [OccName] |
|
foldOccSet :: (OccName -> b -> b) -> b -> OccSet -> b |
|
isEmptyOccSet :: OccSet -> Bool |
|
intersectOccSet :: OccSet -> OccSet -> OccSet |
|
intersectsOccSet :: OccSet -> OccSet -> Bool |
|
Tidying up
|
|
type TidyOccEnv = OccEnv Int |
|
emptyTidyOccEnv :: TidyOccEnv |
|
tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName) |
|
initTidyOccEnv :: [OccName] -> TidyOccEnv |
|
Lexical characteristics of Haskell names
|
|
isLexVar :: FastString -> Bool |
|
isLexConSym :: FastString -> Bool |
|
startsVarId :: Char -> Bool |
|
Produced by Haddock version 2.3.0 |