diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2018-07-06 10:06:32 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-07-06 10:06:32 -0400 |
commit | 657b1b3d519545f8d4ca048c06210d6cbf0f0da0 (patch) | |
tree | 9b06fd6874ef867b2ce52a41dd2e41ca74c68c08 /haddock-api/src/Haddock/Backends/Hoogle.hs | |
parent | 88316b972e3d47197b1019111bae0f7f87275fce (diff) |
Avoid line breaks due to line length in Hoogle (#868)
* Avoid line breaks due to line length in Hoogle
Hoogle operates in a line-oriented fashion, so we should avoid ever
breaking due to long lines.
One way of doing this non-intrusively is to modify the 'DynFlags' that
are threaded through the 'Hoogle' module (note this is anyways only
passed through for use in the various 'showSDoc' functions).
* Amend test case
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Hoogle.hs')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Hoogle.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs index df626c4c..a89ac2c7 100644 --- a/haddock-api/src/Haddock/Backends/Hoogle.hs +++ b/haddock-api/src/Haddock/Backends/Hoogle.hs @@ -45,13 +45,15 @@ prefix = ["-- Hoogle documentation, generated by Haddock" ppHoogle :: DynFlags -> String -> Version -> String -> Maybe (Doc RdrName) -> [Interface] -> FilePath -> IO () ppHoogle dflags package version synopsis prologue ifaces odir = do - let filename = package ++ ".txt" + let -- Since Hoogle is line based, we want to avoid breaking long lines. + dflags' = dflags{ pprCols = maxBound } + filename = package ++ ".txt" contents = prefix ++ - docWith dflags (drop 2 $ dropWhile (/= ':') synopsis) prologue ++ + docWith dflags' (drop 2 $ dropWhile (/= ':') synopsis) prologue ++ ["@package " ++ package] ++ ["@version " ++ showVersion version | not (null (versionBranch version)) ] ++ - concat [ppModule dflags i | i <- ifaces, OptHide `notElem` ifaceOptions i] + concat [ppModule dflags' i | i <- ifaces, OptHide `notElem` ifaceOptions i] createDirectoryIfMissing True odir h <- openFile (odir </> filename) WriteMode hSetEncoding h utf8 |