[project @ 2000-12-07 08:28:05 by simonpj]
[ghc-hetmet.git] / ghc / compiler / basicTypes / Name.lhs
index 8d8f56c..aef8355 100644 (file)
@@ -12,7 +12,7 @@ module Name (
        Name,                                   -- Abstract
        mkLocalName, mkSysLocalName, mkCCallName,
        mkIPName,
-       mkDerivedName, mkGlobalName, mkKnownKeyGlobal, mkWiredInName,
+       mkGlobalName, mkKnownKeyGlobal, mkWiredInName,
 
        nameUnique, setNameUnique,
        nameOccName, nameModule, nameModule_maybe,
@@ -198,14 +198,6 @@ mkIPName uniq occ
           n_sort = Local,
           n_occ  = occ,
           n_loc = noSrcLoc }
-
----------------------------------------------------------------------
-mkDerivedName :: (OccName -> OccName)
-             -> Name           -- Base name
-             -> Unique         -- New unique
-             -> Name           -- Result is always a value name
-
-mkDerivedName f name uniq = name {n_uniq = uniq, n_occ = f (n_occ name)}
 \end{code}
 
 \begin{code}
@@ -354,27 +346,32 @@ pprName name@(Name {n_sort = sort, n_uniq = uniq, n_occ = occ})
       System     -> pprSysLocal sty uniq occ
       Local      -> pprLocal sty uniq occ
 
-pprLocal sty uniq occ
-  | codeStyle sty  = pprUnique uniq
-  | debugStyle sty = pprOccName occ <> 
-                    text "{-" <> pprUnique10 uniq <> text "-}"
-  | otherwise      = pprOccName occ
-
 pprGlobal sty name uniq mod occ
   | codeStyle sty        = ppr (moduleName mod) <> char '_' <> pprOccName occ
 
   | debugStyle sty       = ppr (moduleName mod) <> dot <> pprOccName occ <> 
-                           text "{-" <> pprUnique10 uniq <> text "-}"
+                           text "{-" <> pprUnique uniq <> text "-}"
 
   | unqualStyle sty name = pprOccName occ
   | otherwise           = ppr (moduleName mod) <> dot <> pprOccName occ
 
+pprLocal sty uniq occ
+  | codeStyle sty  = pprUnique uniq
+  | debugStyle sty = pprOccName occ <> 
+                    text "{-" <> pprUnique10 uniq <> text "-}"
+  | otherwise      = pprOccName occ    -- User and Iface styles
+
+-- Like Local, except that we only omit the unique in Iface style
 pprSysLocal sty uniq occ
   | codeStyle sty  = pprUnique uniq
+  | ifaceStyle sty = pprOccName occ    -- The tidy phase has ensured that OccNames
+                                       -- are enough
   | otherwise     = pprOccName occ <> char '_' <> pprUnique uniq
+                               -- If the tidy phase hasn't run, the OccName
+                               -- is unlikely to be informative (like 's'),
+                               -- so print the unique
 \end{code}
 
-
 %************************************************************************
 %*                                                                     *
 \subsection{Overloaded functions related to Names}