summaryrefslogtreecommitdiff
path: root/ghc/compiler/utils
diff options
context:
space:
mode:
authorsof <unknown>2002-07-10 16:33:09 +0000
committersof <unknown>2002-07-10 16:33:09 +0000
commitde37d36e8ffcd9f51d0f74fcb451e72fc99a3a93 (patch)
tree5bf1d5364fee41520ebd6cae9d1e0fc129b8fca9 /ghc/compiler/utils
parent5562ede1f4fe080aef4b93dd2767889285c388a0 (diff)
downloadhaskell-de37d36e8ffcd9f51d0f74fcb451e72fc99a3a93.tar.gz
[project @ 2002-07-10 16:33:09 by sof]
printDump,printErrs,printSDoc: flush stdout and stderr
Diffstat (limited to 'ghc/compiler/utils')
-rw-r--r--ghc/compiler/utils/Outputable.lhs29
1 files changed, 18 insertions, 11 deletions
diff --git a/ghc/compiler/utils/Outputable.lhs b/ghc/compiler/utils/Outputable.lhs
index 2be035c694..a23b44e38a 100644
--- a/ghc/compiler/utils/Outputable.lhs
+++ b/ghc/compiler/utils/Outputable.lhs
@@ -57,7 +57,7 @@ import Pretty ( Doc, Mode(..) )
import Panic
import Word ( Word32 )
-import IO ( Handle, stderr, stdout )
+import IO ( Handle, stderr, stdout, hFlush )
import Char ( chr )
#if __GLASGOW_HASKELL__ < 410
import Char ( ord, isDigit )
@@ -165,23 +165,30 @@ ifPprDebug d sty = Pretty.empty
\end{code}
\begin{code}
+-- Unused [7/02 sof]
printSDoc :: SDoc -> PprStyle -> IO ()
-printSDoc d sty = Pretty.printDoc PageMode stdout (d sty)
+printSDoc d sty = do
+ Pretty.printDoc PageMode stdout (d sty)
+ hFlush stdout
-- I'm not sure whether the direct-IO approach of Pretty.printDoc
-- above is better or worse than the put-big-string approach here
printErrs :: PrintUnqualified -> SDoc -> IO ()
-printErrs unqual doc = Pretty.printDoc PageMode stderr (doc style)
- where
- style = mkUserStyle unqual (PartWay opt_PprUserLength)
+printErrs unqual doc = do
+ Pretty.printDoc PageMode stderr (doc style)
+ hFlush stderr
+ where
+ style = mkUserStyle unqual (PartWay opt_PprUserLength)
printDump :: SDoc -> IO ()
-printDump doc = Pretty.printDoc PageMode stdout (better_doc defaultUserStyle)
- where
- better_doc = doc $$ text ""
- -- We used to always print in debug style, but I want
- -- to try the effect of a more user-ish style (unless you
- -- say -dppr-debug
+printDump doc = do
+ Pretty.printDoc PageMode stdout (better_doc defaultUserStyle)
+ hFlush stdout
+ where
+ better_doc = doc $$ text ""
+ -- We used to always print in debug style, but I want
+ -- to try the effect of a more user-ish style (unless you
+ -- say -dppr-debug
printForUser :: Handle -> PrintUnqualified -> SDoc -> IO ()
printForUser handle unqual doc