aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock
diff options
context:
space:
mode:
authoralexbiehl <alex.biehl@gmail.com>2018-02-03 11:47:10 +0100
committerBen Gamari <ben@smart-cactus.org>2018-02-18 11:07:15 -0500
commit0ef6a26d49fc2b3a5785a55d95b64f77c40e58ad (patch)
treef23ba62fe0a3c4957d94d503bb41878a6b1ff438 /haddock-api/src/Haddock
parentdd80ae1773ea6aae48c3c5a899d510699783d6ee (diff)
QuickJump: Mitigate encoding problems on Windows
(cherry picked from commit 86292c54bfee2343aee84559ec01f1fc68f52231)
Diffstat (limited to 'haddock-api/src/Haddock')
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs
index 55175163..2d23ddc7 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml.hs
@@ -36,11 +36,13 @@ import Text.XHtml hiding ( name, title, p, quote )
import Haddock.GhcUtils
import Control.Monad ( when, unless )
+import qualified Data.ByteString.Builder as Builder
import Data.Char ( toUpper, isSpace )
import Data.List ( sortBy, isPrefixOf, intercalate, intersperse )
import Data.Maybe
-import System.FilePath hiding ( (</>) )
import System.Directory
+import System.FilePath hiding ( (</>) )
+import qualified System.IO as IO
import Data.Map ( Map )
import qualified Data.Map as Map hiding ( Map )
import qualified Data.Set as Set hiding ( Set )
@@ -353,9 +355,8 @@ ppJsonIndex :: FilePath
-> IO ()
ppJsonIndex odir maybe_source_url maybe_wiki_url unicode qual_opt ifaces = do
createDirectoryIfMissing True odir
- writeFile (joinPath [odir, indexJsonFile])
- (encodeToString modules)
-
+ IO.withFile (joinPath [odir, indexJsonFile]) IO.WriteMode $ \h -> do
+ Builder.hPutBuilder h (encodeToBuilder modules)
where
modules :: Value
modules = Array (concatMap goInterface ifaces)