diff --git a/Cabal/src/Distribution/Simple/Haddock.hs b/Cabal/src/Distribution/Simple/Haddock.hs
index df637ae9c3c5ff8ee499c080922d777dfe3c3495..facfe14a6be0c51aa2c71366229fb35890262c5f 100644
--- a/Cabal/src/Distribution/Simple/Haddock.hs
+++ b/Cabal/src/Distribution/Simple/Haddock.hs
@@ -993,20 +993,18 @@ renderArgs verbosity mbWorkDir tmpFileOpts version comp platform args k = do
                   renderedArgs
                   (\responseFileName -> k ["@" ++ responseFileName] result)
               else k renderedArgs result
-  case argPrologue args of
-    Flag prologueText ->
+  case (argPrologueFile args, argPrologue args) of
+    (Flag pfile, _) ->
+      withPrologueArgs ["--prologue=" ++ pfile]
+    (_, Flag prologueText) ->
       withTempFileEx tmpFileOpts mbWorkDir outputDir "haddock-prologue.txt" $
         \prologueFileName h -> do
           when haddockSupportsUTF8 (hSetEncoding h utf8)
           hPutStrLn h prologueText
           hClose h
           withPrologueArgs ["--prologue=" ++ u prologueFileName]
-    _ ->
-      withPrologueArgs
-        ( case argPrologueFile args of
-            Flag pfile -> ["--prologue=" ++ pfile]
-            _ -> []
-        )
+    (NoFlag, NoFlag) ->
+      withPrologueArgs []
   where
     -- See Note [Symbolic paths] in Distribution.Utils.Path
     i = interpretSymbolicPath mbWorkDir