aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haddock-api/src/Haddock.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs
index 3971a5b7..f0e7e6c7 100644
--- a/haddock-api/src/Haddock.hs
+++ b/haddock-api/src/Haddock.hs
@@ -547,9 +547,10 @@ getPrologue :: DynFlags -> [Flag] -> IO (Maybe (MDoc RdrName))
getPrologue dflags flags =
case [filename | Flag_Prologue filename <- flags ] of
[] -> return Nothing
- [filename] -> withFile filename ReadMode $ \h -> do
+ [filename] -> do
+ h <- openFile filename ReadMode
hSetEncoding h utf8
- str <- hGetContents h
+ str <- hGetContents h -- semi-closes the handle
return . Just $! parseParas dflags str
_ -> throwE "multiple -p/--prologue options"