summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-06-15 11:05:45 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-06-15 11:05:45 +0000
commitfb97019335ae012a11bbfb229b08d18316dcd1df (patch)
treebd13a54e296d2ae27ac18641f65bf42b30e8fafc /compiler
parent20633c5b582a2cd2b4cf8e2788e8bf7b536ba4e5 (diff)
downloadhaskell-fb97019335ae012a11bbfb229b08d18316dcd1df.tar.gz
copyFileWithHeader: use binary Handles
Fixes failure when Haddocking Data.Monoid in libraries/base
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main/SysTools.lhs13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index a64d73e11c..357616bfb9 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -420,12 +420,13 @@ copyWithHeader :: DynFlags -> String -> Maybe String -> FilePath -> FilePath
copyWithHeader dflags purpose maybe_header from to = do
showPass dflags purpose
- h <- openFile to WriteMode
- ls <- readFile from -- inefficient, but it'll do for now.
- -- ToDo: speed up via slurping.
- maybe (return ()) (hPutStr h) maybe_header
- hPutStr h ls
- hClose h
+ hout <- openBinaryFile to WriteMode
+ hin <- openBinaryFile from ReadMode
+ ls <- hGetContents hin -- inefficient, but it'll do for now. ToDo: speed up
+ maybe (return ()) (hPutStr hout) maybe_header
+ hPutStr hout ls
+ hClose hout
+ hClose hin
getExtraViaCOpts :: DynFlags -> IO [String]
getExtraViaCOpts dflags = do