diff options
| author | simonpj <unknown> | 1998-12-18 17:42:39 +0000 |
|---|---|---|
| committer | simonpj <unknown> | 1998-12-18 17:42:39 +0000 |
| commit | 7e602b0a11e567fcb035d1afd34015aebcf9a577 (patch) | |
| tree | 54ca13c3ec0704e343b68d0d313a29f53d6c3855 /ghc/compiler/utils/Outputable.lhs | |
| parent | 139f0fd30e19f934aa51885a52b8e5d7c24ee460 (diff) | |
| download | haskell-7e602b0a11e567fcb035d1afd34015aebcf9a577.tar.gz | |
[project @ 1998-12-18 17:40:31 by simonpj]
Another big commit from Simon. Actually, the last one
didn't all go into the main trunk; because of a CVS glitch it
ended up in the wrong branch.
So this commit includes:
* Scoped type variables
* Warnings for unused variables should work now (they didn't before)
* Simplifier improvements:
- Much better treatment of strict arguments
- Better treatment of bottoming Ids
- No need for w/w split for fns that are merely strict
- Fewer iterations needed, I hope
* Less gratuitous renaming in interface files and abs C
* OccName is a separate module, and is an abstract data type
I think the whole Prelude and Exts libraries compile correctly.
Something isn't quite right about typechecking existentials though.
Diffstat (limited to 'ghc/compiler/utils/Outputable.lhs')
| -rw-r--r-- | ghc/compiler/utils/Outputable.lhs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/ghc/compiler/utils/Outputable.lhs b/ghc/compiler/utils/Outputable.lhs index a9cddcd98b..0e55176aa2 100644 --- a/ghc/compiler/utils/Outputable.lhs +++ b/ghc/compiler/utils/Outputable.lhs @@ -25,8 +25,8 @@ module Outputable ( text, char, ptext, int, integer, float, double, rational, parens, brackets, braces, quotes, doubleQuotes, - semi, comma, colon, space, equals, - lparen, rparen, lbrack, rbrack, lbrace, rbrace, + semi, comma, colon, dcolon, space, equals, dot, + lparen, rparen, lbrack, rbrack, lbrace, rbrace, underscore, (<>), (<+>), hcat, hsep, ($$), ($+$), vcat, sep, cat, @@ -42,7 +42,7 @@ module Outputable ( -- error handling pprPanic, pprPanic#, pprError, pprTrace, assertPprPanic, - panic, panic#, assertPanic + trace, panic, panic#, assertPanic ) where #include "HsVersions.h" @@ -53,7 +53,7 @@ import CmdLineOpts ( opt_PprStyle_Debug, opt_PprUserLength ) import FastString import qualified Pretty import Pretty ( Doc, Mode(..), TextDetails(..), fullRender ) -import Util ( panic, assertPanic, panic#, trace ) +import Panic import ST ( runST ) import Foreign \end{code} @@ -221,6 +221,9 @@ lbrack sty = Pretty.lbrack rbrack sty = Pretty.rbrack lbrace sty = Pretty.lbrace rbrace sty = Pretty.rbrace +dcolon sty = Pretty.ptext SLIT("::") +underscore = char '_' +dot = char '.' nest n d sty = Pretty.nest n (d sty) (<>) d1 d2 sty = (Pretty.<>) (d1 sty) (d2 sty) @@ -272,6 +275,10 @@ instance (Outputable a) => Outputable [a] where instance (Outputable a, Outputable b) => Outputable (a, b) where ppr (x,y) = parens (sep [ppr x <> comma, ppr y]) +instance Outputable a => Outputable (Maybe a) where + ppr Nothing = text "Nothing" + ppr (Just x) = text "Just" <+> ppr x + -- ToDo: may not be used instance (Outputable a, Outputable b, Outputable c) => Outputable (a, b, c) where ppr (x,y,z) = @@ -362,19 +369,23 @@ speakNTimes t | t == 1 = ptext SLIT("once") | otherwise = int t <+> ptext SLIT("times") \end{code} + %************************************************************************ %* * -\subsection[Utils-errors]{Error handling} +\subsection{Error handling} %* * %************************************************************************ \begin{code} +pprPanic :: String -> SDoc -> a pprPanic heading pretty_msg = panic (show (doc PprDebug)) where doc = text heading <+> pretty_msg +pprError :: String -> SDoc -> a pprError heading pretty_msg = error (heading++ " " ++ (showSDoc pretty_msg)) +pprTrace :: String -> SDoc -> a -> a pprTrace heading pretty_msg = trace (show (doc PprDebug)) where doc = text heading <+> pretty_msg |
