From: sof Date: Wed, 10 Jul 2002 16:33:09 +0000 (+0000) Subject: [project @ 2002-07-10 16:33:09 by sof] X-Git-Tag: Approx_11550_changesets_converted~1868 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=de37d36e8ffcd9f51d0f74fcb451e72fc99a3a93;p=ghc-hetmet.git [project @ 2002-07-10 16:33:09 by sof] printDump,printErrs,printSDoc: flush stdout and stderr --- diff --git a/ghc/compiler/utils/Outputable.lhs b/ghc/compiler/utils/Outputable.lhs index 2be035c..a23b44e 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