[project @ 2004-08-16 09:53:47 by simonpj]
[ghc-hetmet.git] / ghc / compiler / utils / Outputable.lhs
index 6e98c2f..22856f1 100644 (file)
@@ -51,7 +51,8 @@ module Outputable (
 #include "HsVersions.h"
 
 
-import {-# SOURCE #-}  Name( Name )
+import {-# SOURCE #-}  Module( ModuleName )
+import {-# SOURCE #-}  OccName( OccName )
 
 import CmdLineOpts     ( opt_PprStyle_Debug, opt_PprUserLength )
 import FastString
@@ -62,7 +63,7 @@ import Panic
 import DATA_WORD       ( Word32 )
 
 import IO              ( Handle, stderr, stdout, hFlush )
-import Char             ( chr, ord )
+import Char             ( ord )
 \end{code}
 
 
@@ -90,13 +91,13 @@ data Depth = AllTheWay
            | PartWay Int       -- 0 => stop
 
 
-type PrintUnqualified = Name -> Bool
+type PrintUnqualified = ModuleName -> OccName -> Bool
        -- This function tells when it's ok to print 
        -- a (Global) name unqualified
 
 alwaysQualify,neverQualify :: PrintUnqualified
-alwaysQualify n = False
-neverQualify  n = True
+alwaysQualify m n = False
+neverQualify  m n = True
 
 defaultUserStyle = mkUserStyle alwaysQualify AllTheWay
 
@@ -149,9 +150,9 @@ getPprStyle df sty = df sty sty
 \end{code}
 
 \begin{code}
-unqualStyle :: PprStyle -> Name -> Bool
-unqualStyle (PprUser    unqual _) n = unqual n
-unqualStyle other                n = False
+unqualStyle :: PprStyle -> PrintUnqualified
+unqualStyle (PprUser    unqual _) m n = unqual m n
+unqualStyle other                m n = False
 
 codeStyle :: PprStyle -> Bool
 codeStyle (PprCode _)    = True
@@ -414,10 +415,10 @@ pprWithCommas :: (a -> SDoc) -> [a] -> SDoc
 pprWithCommas pp xs = fsep (punctuate comma (map pp xs))
 
 interppSP  :: Outputable a => [a] -> SDoc
-interppSP  xs = hsep (map ppr xs)
+interppSP  xs = sep (map ppr xs)
 
 interpp'SP :: Outputable a => [a] -> SDoc
-interpp'SP xs = hsep (punctuate comma (map ppr xs))
+interpp'SP xs = sep (punctuate comma (map ppr xs))
 
 pprQuotedList :: Outputable a => [a] -> SDoc
 -- [x,y,z]  ==>  `x', `y', `z'