diff options
author | Duncan Coutts <duncan@well-typed.com> | 2014-08-27 13:49:31 +0100 |
---|---|---|
committer | Duncan Coutts <duncan@well-typed.com> | 2014-08-27 13:49:31 +0100 |
commit | b2a807da55d197c648fd2df1f156f9862711d92b (patch) | |
tree | 448704dd8a31baf9f1a80bc1438d7d97b5a0438b /src/Haddock.hs | |
parent | f32ad30e9b8c5d4ee54c60c9c3b282fef7d297a5 (diff) |
Changes due to ghc api changes in package representation
Also fix a bug with finding the package name and version given a
module. This had become wrong due to the package key changes (it was
very hacky in the first place). We now look up the package key in the
package db to get the package info properly.
Diffstat (limited to 'src/Haddock.hs')
-rw-r--r-- | src/Haddock.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Haddock.hs b/src/Haddock.hs index 024b1098..bed47625 100644 --- a/src/Haddock.hs +++ b/src/Haddock.hs @@ -42,7 +42,6 @@ import Data.IORef import qualified Data.Map as Map import System.IO import System.Exit -import System.Directory #if defined(mingw32_HOST_OS) import Foreign @@ -63,6 +62,8 @@ import DynFlags hiding (verbosity) import StaticFlags (discardStaticFlags) import Panic (handleGhcException) import Module +import PackageConfig +import FastString -------------------------------------------------------------------------------- -- * Exception handling @@ -242,7 +243,7 @@ render dflags flags qual ifaces installedIfaces srcMap = do pkgMod = ifaceMod (head ifaces) pkgKey = modulePackageKey pkgMod pkgStr = Just (packageKeyString pkgKey) - (pkgName,pkgVer) = modulePackageInfo pkgMod + (pkgName,pkgVer) = modulePackageInfo dflags pkgMod (srcBase, srcModule, srcEntity, srcLEntity) = sourceUrls flags srcMap' = maybe srcMap (\path -> Map.insert pkgKey path srcMap) srcEntity @@ -276,14 +277,16 @@ render dflags flags qual ifaces installedIfaces srcMap = do copyHtmlBits odir libDir themes when (Flag_Hoogle `elem` flags) $ do - let pkgName2 = if pkgName == "main" && title /= [] then title else pkgName - ppHoogle dflags pkgName2 pkgVer title prologue visibleIfaces odir + let pkgNameStr | unpackFS pkgNameFS == "main" && title /= [] + = title + | otherwise = unpackFS pkgNameFS + where PackageName pkgNameFS = pkgName + ppHoogle dflags pkgNameStr pkgVer title prologue visibleIfaces odir when (Flag_LaTeX `elem` flags) $ do ppLaTeX title pkgStr visibleIfaces odir prologue opt_latex_style libDir - ------------------------------------------------------------------------------- -- * Reading and dumping interface files ------------------------------------------------------------------------------- |