- data NameSpace
- tcName, tcClsName, clsName :: NameSpace
- dataName, srcDataName :: NameSpace
- tvName, varName :: NameSpace
- pprNameSpace :: NameSpace -> SDoc
- pprNonVarNameSpace :: NameSpace -> SDoc
- pprNameSpaceBrief :: NameSpace -> SDoc
- data OccName
- pprOccName :: OccName -> SDoc
- 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 -> Bool -> OccSet -> OccName
- mkTupleOcc :: NameSpace -> Boxity -> Arity -> OccName
- setOccNameSpace :: NameSpace -> OccName -> OccName
- isDerivedOccName :: OccName -> Bool
- mkDataConWrapperOcc, mkPADFunOcc, mkPReprTyConOcc, mkPDataDataConOcc, mkPDataTyConOcc, mkVectIsoOcc, mkVectDataConOcc, mkVectTyConOcc, mkVectOcc, mkMaxTagOcc, mkTag2ConOcc, mkCon2TagOcc, mkClassOpAuxOcc, mkEqPredCoOcc, mkInstTyCoOcc, mkNewTyCoOcc, mkDataConWorkerOcc, mkDataCOcc, mkDataTOcc, mkGenRCo, mkGenR, mkGenD, mkGenOcc2, mkGenOcc1, mkForeignExportOcc, mkSpecOcc, mkIPOcc, mkDictOcc, mkClassDataConOcc, mkClassTyConOcc, mkDerivedTyConOcc, mkGenDefMethodOcc, mkDefaultMethodOcc, mkWorkerOcc :: OccName -> OccName
- mkGenC :: OccName -> Int -> OccName
- mkGenS :: OccName -> Int -> Int -> OccName
- mkSuperDictSelOcc :: Int -> OccName -> OccName
- mkLocalOcc :: Unique -> OccName -> OccName
- mkMethodOcc :: OccName -> OccName
- mkInstTyTcOcc :: String -> OccSet -> OccName
- occNameFS :: OccName -> FastString
- occNameString :: OccName -> String
- occNameSpace :: OccName -> NameSpace
- isVarOcc, isDataOcc, isTcOcc, isTvOcc :: OccName -> Bool
- isDataSymOcc :: OccName -> Bool
- isSymOcc :: OccName -> Bool
- isValOcc :: OccName -> Bool
- parenSymOcc :: OccName -> SDoc -> SDoc
- startsWithUnderscore :: OccName -> Bool
- isTcClsNameSpace :: NameSpace -> Bool
- isTvNameSpace :: NameSpace -> Bool
- isDataConNameSpace :: NameSpace -> Bool
- isVarNameSpace :: NameSpace -> Bool
- isValNameSpace :: NameSpace -> Bool
- isTupleOcc_maybe :: OccName -> Maybe (NameSpace, Boxity, Arity)
- 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
- 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
- extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b
- filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt
- delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a
- delFromOccEnv :: OccEnv a -> OccName -> OccEnv a
- 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
- type TidyOccEnv = OccEnv Int
- emptyTidyOccEnv :: TidyOccEnv
- tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)
- initTidyOccEnv :: [OccName] -> TidyOccEnv
- isLexCon, isLexSym, isLexId, isLexVar :: FastString -> Bool
- isLexConId, isLexVarSym, isLexVarId, isLexConSym :: FastString -> Bool
- startsVarSym, startsConId, startsConSym, startsVarId :: Char -> Bool
The NameSpace
type
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
pprNameSpace :: NameSpace -> SDocSource
The OccName
type
pprOccName :: OccName -> SDocSource
Construction
mkOccNameFS :: NameSpace -> FastString -> OccNameSource
mkTyVarOcc :: String -> OccNameSource
mkTcOccFS :: FastString -> OccNameSource
setOccNameSpace :: NameSpace -> OccName -> OccNameSource
Derived OccName
s
mkDataConWrapperOcc, mkPADFunOcc, mkPReprTyConOcc, mkPDataDataConOcc, mkPDataTyConOcc, mkVectIsoOcc, mkVectDataConOcc, mkVectTyConOcc, mkVectOcc, mkMaxTagOcc, mkTag2ConOcc, mkCon2TagOcc, mkClassOpAuxOcc, mkEqPredCoOcc, mkInstTyCoOcc, mkNewTyCoOcc, mkDataConWorkerOcc, mkDataCOcc, mkDataTOcc, mkGenRCo, mkGenR, mkGenD, mkGenOcc2, mkGenOcc1, mkForeignExportOcc, mkSpecOcc, mkIPOcc, mkDictOcc, mkClassDataConOcc, mkClassTyConOcc, mkDerivedTyConOcc, mkGenDefMethodOcc, mkDefaultMethodOcc, mkWorkerOcc :: OccName -> OccNameSource
mkMethodOcc :: OccName -> OccNameSource
Derive a name for the representation type constructor of a
data
/newtype
instance.
Deconstruction
occNameFS :: OccName -> FastStringSource
occNameString :: OccName -> StringSource
isDataSymOcc :: OccName -> BoolSource
Test if the OccName
is a data constructor that starts with
a symbol (e.g. :
, or []
)
isSymOcc :: OccName -> BoolSource
Test if the OccName
is that for any operator (whether
it is a data constructor or variable or whatever)
isValOcc :: OccName -> BoolSource
Value OccNames
s are those that are either in
the variable or data constructor namespaces
parenSymOcc :: OccName -> SDoc -> SDocSource
Wrap parens around an operator
startsWithUnderscore :: OccName -> BoolSource
Haskell 98 encourages compilers to suppress warnings about unsed
names in a pattern if they start with _
: this implements that test
isTvNameSpace :: NameSpace -> BoolSource
The OccEnv
type
Outputable a => Outputable (OccEnv a) |
emptyOccEnv :: OccEnv aSource
unitOccEnv :: OccName -> a -> OccEnv aSource
extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv aSource
lookupOccEnv :: OccEnv a -> OccName -> Maybe aSource
mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv aSource
extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv aSource
elemOccEnv :: OccName -> OccEnv a -> BoolSource
occEnvElts :: OccEnv a -> [a]Source
foldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> bSource
plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv aSource
plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv aSource
extendOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv aSource
extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv bSource
filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv eltSource
delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv aSource
delFromOccEnv :: OccEnv a -> OccName -> OccEnv aSource
The OccSet
type
unitOccSet :: OccName -> OccSetSource
extendOccSet :: OccSet -> OccName -> OccSetSource
extendOccSetList :: OccSet -> [OccName] -> OccSetSource
unionOccSets :: OccSet -> OccSet -> OccSetSource
unionManyOccSets :: [OccSet] -> OccSetSource
minusOccSet :: OccSet -> OccSet -> OccSetSource
elemOccSet :: OccName -> OccSet -> BoolSource
occSetElts :: OccSet -> [OccName]Source
foldOccSet :: (OccName -> b -> b) -> b -> OccSet -> bSource
isEmptyOccSet :: OccSet -> BoolSource
intersectOccSet :: OccSet -> OccSet -> OccSetSource
intersectsOccSet :: OccSet -> OccSet -> BoolSource
Tidying up
type TidyOccEnv = OccEnv IntSource
tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName)Source
initTidyOccEnv :: [OccName] -> TidyOccEnvSource