aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2018-10-16 14:59:13 -0700
committerAlec Theriault <alec.theriault@gmail.com>2018-10-16 14:59:13 -0700
commit41d9846754cdccb82e667ece2f44725ed9cab4e7 (patch)
tree10228f82c23f1e25dcf7b6c097f76d673e0ea18e
parent44169f4b1907e34fdf8ff84cf8b7509b1dfcaf55 (diff)
parent9712d8899d452292913a260058a6dd3346e8d39b (diff)
Merge branch 'ghc-8.4' into ghc-8.6
-rw-r--r--CHANGES.md4
-rw-r--r--doc/markup.rst6
-rw-r--r--haddock-api/src/Haddock.hs11
-rw-r--r--haddock-api/src/Haddock/Interface.hs1
4 files changed, 16 insertions, 6 deletions
diff --git a/CHANGES.md b/CHANGES.md
index ee19ae3d..66703068 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,7 @@
+## TBA
+
+ * Make `--package-version` optional for `--hoogle` (#899)
+
## Changes in version 2.21.0
* Overhaul handling of data declarations in XHTML and LaTeX. Adds support for
diff --git a/doc/markup.rst b/doc/markup.rst
index a9878837..4e00f708 100644
--- a/doc/markup.rst
+++ b/doc/markup.rst
@@ -776,14 +776,14 @@ Special Characters
~~~~~~~~~~~~~~~~~~
The following characters have special meanings in documentation
-comments: ``\\``, ``/``, ``'``, ``\```, ``"``, ``@``, ``<``, ``$``. To insert a
+comments: ``\``, ``/``, ``'``, `````, ``"``, ``@``, ``<``, ``$``, ``#``. To insert a
literal occurrence of one of these special characters, precede it with a
-backslash (``\\``).
+backslash (``\``).
Additionally, the character ``>`` has a special meaning at the beginning
of a line, and the following characters have special meanings at the
beginning of a paragraph: ``*``, ``-``. These characters can also be
-escaped using ``\\``.
+escaped using ``\``.
Furthermore, the character sequence ``>>>`` has a special meaning at the
beginning of a line. To escape it, just prefix the characters in the
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs
index 86a65901..dbfba0f4 100644
--- a/haddock-api/src/Haddock.hs
+++ b/haddock-api/src/Haddock.hs
@@ -48,6 +48,7 @@ import Control.Exception
import Data.Maybe
import Data.IORef
import Data.Map (Map)
+import Data.Version (makeVersion)
import qualified Data.Map as Map
import System.IO
import System.Exit
@@ -363,9 +364,13 @@ render dflags flags sinceQual qual ifaces installedIfaces extSrcMap = do
-- might want to fix that if/when these two get some work on them
when (Flag_Hoogle `elem` flags) $ do
case pkgNameVer of
- (Just (PackageName pkgNameFS), Just pkgVer) ->
- let pkgNameStr | unpackFS pkgNameFS == "main" && title /= [] = title
- | otherwise = unpackFS pkgNameFS
+ (Just (PackageName pkgNameFS), mpkgVer) ->
+ let
+ pkgNameStr | unpackFS pkgNameFS == "main" && title /= [] = title
+ | otherwise = unpackFS pkgNameFS
+
+ pkgVer =
+ fromMaybe (makeVersion []) mpkgVer
in ppHoogle dflags' pkgNameStr pkgVer title (fmap _doc prologue)
visibleIfaces odir
_ -> putStrLn . unlines $
diff --git a/haddock-api/src/Haddock/Interface.hs b/haddock-api/src/Haddock/Interface.hs
index c330c5fe..759d5d03 100644
--- a/haddock-api/src/Haddock/Interface.hs
+++ b/haddock-api/src/Haddock/Interface.hs
@@ -84,6 +84,7 @@ processModules
processModules verbosity modules flags extIfaces = do
#if defined(mingw32_HOST_OS)
-- Avoid internal error: <stderr>: hPutChar: invalid argument (invalid character)' non UTF-8 Windows
+ liftIO $ hSetEncoding stdout $ mkLocaleEncoding TransliterateCodingFailure
liftIO $ hSetEncoding stderr $ mkLocaleEncoding TransliterateCodingFailure
#endif