aboutsummaryrefslogtreecommitdiff
path: root/haddock-api
diff options
context:
space:
mode:
authorAlexander Biehl <alexbiehl@gmail.com>2018-08-06 13:04:02 +0200
committerGitHub <noreply@github.com>2018-08-06 13:04:02 +0200
commit1c4076328cfdd3aadbbbd494a240e25bd7309b0c (patch)
tree09deb48892e2ebfb5d53db9ccf4205c854ccf4ee /haddock-api
parent1868443b01232d57ec11dfc831ac0a6915a2b337 (diff)
Make --package-version optional for --hoogle generation (#899)
* Make --package-version optional for --hoogle generation * Import mkVersion * It's makeVersion not mkVersion
Diffstat (limited to 'haddock-api')
-rw-r--r--haddock-api/src/Haddock.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs
index 00eb50f6..1651866a 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
@@ -362,9 +363,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 $