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 6af0874a..637ccf2b 100644
--- a/haddock-api/src/Haddock.hs
+++ b/haddock-api/src/Haddock.hs
@@ -540,9 +540,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"