showSDocUnqual, showsPrecSDoc,
pprHsChar, pprHsString,
-
-- error handling
- pprPanic, pprPanic#, pprError, pprTrace, assertPprPanic, warnPprTrace,
- trace, panic, panic#, assertPanic
+ pprPanic, assertPprPanic, pprPanic#, pprPgmError,
+ pprTrace, warnPprTrace,
+ trace, pgmError, panic, panic#, assertPanic
) where
#include "HsVersions.h"
-import {-# SOURCE #-} Name( Name )
+import {-# SOURCE #-} Module( Module )
+import {-# SOURCE #-} OccName( OccName )
import CmdLineOpts ( opt_PprStyle_Debug, opt_PprUserLength )
+import PackageConfig ( PackageId, packageIdString )
import FastString
import qualified Pretty
import Pretty ( Doc, Mode(..) )
| PartWay Int -- 0 => stop
-type PrintUnqualified = Name -> Bool
+type PrintUnqualified = Module -> 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
\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
instance Outputable FastString where
ppr fs = text (unpackFS fs) -- Prints an unadorned string,
-- no double quotes or anything
+
+instance Outputable PackageId where
+ ppr pid = text (packageIdString pid)
\end{code}
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'
%************************************************************************
\begin{code}
-pprPanic :: String -> SDoc -> a
-pprError :: String -> SDoc -> a
+pprPanic, pprPgmError :: String -> SDoc -> a
pprTrace :: String -> SDoc -> a -> a
-pprPanic = pprAndThen panic
-pprError = pprAndThen error
-pprTrace = pprAndThen trace
+pprPanic = pprAndThen panic -- Throw an exn saying "bug in GHC"
+
+pprPgmError = pprAndThen pgmError -- Throw an exn saying "bug in pgm being compiled"
+ -- (used for unusual pgm errors)
+pprTrace = pprAndThen trace
pprPanic# heading pretty_msg = panic# (show (doc PprDebug))
where