[project @ 2005-02-28 12:03:12 by simonmar]
authorsimonmar <unknown>
Mon, 28 Feb 2005 12:03:12 +0000 (12:03 +0000)
committersimonmar <unknown>
Mon, 28 Feb 2005 12:03:12 +0000 (12:03 +0000)
The type variables in the types of wired-in entities were built using
mkVarOcc, which gives a variable name rather than a type variable
name.  Normally the compiler doesn't care, but when tidying types for
output to the user the tidier would consider a VarName as distinct
from a TvName, and not give them different print names.

This fix makes puts all the type variables in the TvName namespace.

ghc/compiler/basicTypes/OccName.lhs
ghc/compiler/prelude/TysPrim.lhs

index 29a6bbc..96a2f2f 100644 (file)
@@ -27,7 +27,7 @@ module OccName (
        foldOccSet, isEmptyOccSet, intersectOccSet, intersectsOccSet,
 
        mkOccName, mkOccFS, mkSysOcc, mkSysOccFS, mkFCallOcc, mkKindOccFS,
-       mkVarOcc, mkVarOccEncoded,
+       mkVarOcc, mkVarOccEncoded, mkTyVarOcc,
        mkSuperDictSelOcc, mkDFunOcc, mkForeignExportOcc,
        mkDictOcc, mkIPOcc, mkWorkerOcc, mkMethodOcc, mkDefaultMethodOcc,
        mkDerivedTyConOcc, mkClassTyConOcc, mkClassDataConOcc, mkSpecOcc,
@@ -241,6 +241,9 @@ mkOccName ns s = mkSysOcc ns (encode s)
 mkVarOcc :: UserFS -> OccName
 mkVarOcc fs = mkSysOccFS varName (encodeFS fs)
 
+mkTyVarOcc :: UserFS -> OccName
+mkTyVarOcc fs = mkSysOccFS tvName (encodeFS fs)
+
 mkVarOccEncoded :: EncodedFS -> OccName
 mkVarOccEncoded fs = mkSysOccFS varName fs
 \end{code}
index 155fdf8..b28506e 100644 (file)
@@ -47,7 +47,7 @@ module TysPrim(
 
 import Var             ( TyVar, mkTyVar )
 import Name            ( Name, BuiltInSyntax(..), mkInternalName, mkWiredInName )
-import OccName         ( mkVarOcc, mkOccFS, tcName )
+import OccName         ( mkOccFS, tcName, mkTyVarOcc )
 import TyCon           ( TyCon, ArgVrcs, mkPrimTyCon, mkLiftedPrimTyCon,
                          PrimRep(..) )
 import Type            ( mkTyConApp, mkTyConTy, mkTyVarTys, mkTyVarTy,
@@ -147,7 +147,7 @@ alphaTyVars is a list of type variables for use in templates:
 \begin{code}
 tyVarList :: Kind -> [TyVar]
 tyVarList kind = [ mkTyVar (mkInternalName (mkAlphaTyVarUnique u) 
-                               (mkVarOcc (mkFastString name))
+                               (mkTyVarOcc (mkFastString name))
                                noSrcLoc) kind
                 | u <- [2..],
                   let name | c <= 'z'  = [c]