summaryrefslogtreecommitdiff
path: root/compiler/utils/Outputable.lhs
diff options
context:
space:
mode:
authorBen.Lippmeier@anu.edu.au <unknown>2007-08-21 16:31:10 +0000
committerBen.Lippmeier@anu.edu.au <unknown>2007-08-21 16:31:10 +0000
commita8dc65d6582cc8dda6a1de2862e2d6da80a78d0c (patch)
treeae106c710c4291102694e75c8d321614d3f66d86 /compiler/utils/Outputable.lhs
parent55fe426859d8e9922e46821e52cff150d5628253 (diff)
downloadhaskell-a8dc65d6582cc8dda6a1de2862e2d6da80a78d0c.tar.gz
Allow redirection of -ddump-* to file
Whilst compiling Main.hs with -ddump-stg, ddump-asm and friends you can how add -ddump-to-file and you'll get the dumps redirected to Main.dump-stg, Main.dump-asm etc.
Diffstat (limited to 'compiler/utils/Outputable.lhs')
-rw-r--r--compiler/utils/Outputable.lhs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs
index 6d9132e105..84e71d0b06 100644
--- a/compiler/utils/Outputable.lhs
+++ b/compiler/utils/Outputable.lhs
@@ -36,7 +36,7 @@ module Outputable (
hang, punctuate,
speakNth, speakNTimes, speakN, speakNOf, plural,
- printSDoc, printErrs, printDump,
+ printSDoc, printErrs, hPrintDump, printDump,
printForC, printForAsm, printForUser,
pprCode, mkCodeStyle,
showSDoc, showSDocForUser, showSDocDebug, showSDocDump,
@@ -258,9 +258,12 @@ printErrs doc = do Pretty.printDoc PageMode stderr doc
hFlush stderr
printDump :: SDoc -> IO ()
-printDump doc = do
- Pretty.printDoc PageMode stdout (better_doc defaultDumpStyle)
- hFlush stdout
+printDump doc = hPrintDump stdout doc
+
+hPrintDump :: Handle -> SDoc -> IO ()
+hPrintDump h doc = do
+ Pretty.printDoc PageMode h (better_doc defaultDumpStyle)
+ hFlush h
where
better_doc = doc $$ text ""