diff options
author | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-08-14 20:23:42 +0100 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-08-14 20:23:42 +0100 |
commit | 9f37affe403f19faad0d9874f7d552f094d18af0 (patch) | |
tree | 44908301443a76e7c19936d3cb686de07bfcf82e /src | |
parent | c90796ed7a6a625854d28bf55c71eeb36d298c55 (diff) |
Revert "Track GHC PackageId to PackageKey renaming."
This reverts commit 8ac42d3327473939c013551750425cac191ff0fd.
Diffstat (limited to 'src')
-rw-r--r-- | src/Haddock.hs | 10 | ||||
-rw-r--r-- | src/Haddock/Backends/Xhtml.hs | 2 | ||||
-rw-r--r-- | src/Haddock/Backends/Xhtml/Layout.hs | 2 | ||||
-rw-r--r-- | src/Haddock/Backends/Xhtml/Types.hs | 2 | ||||
-rw-r--r-- | src/Haddock/GhcUtils.hs | 14 | ||||
-rw-r--r-- | src/Haddock/Interface/Create.hs | 10 | ||||
-rw-r--r-- | src/Haddock/InterfaceFile.hs | 12 | ||||
-rw-r--r-- | src/Haddock/ModuleTree.hs | 6 | ||||
-rw-r--r-- | src/Haddock/Types.hs | 2 |
9 files changed, 30 insertions, 30 deletions
diff --git a/src/Haddock.hs b/src/Haddock.hs index 024b1098..3d049b18 100644 --- a/src/Haddock.hs +++ b/src/Haddock.hs @@ -215,7 +215,7 @@ renderStep dflags flags qual pkgs interfaces = do let ifaceFiles = map snd pkgs installedIfaces = concatMap ifInstalledIfaces ifaceFiles - srcMap = Map.fromList [ (ifPackageKey if_, x) | ((_, Just x), if_) <- pkgs ] + srcMap = Map.fromList [ (ifPackageId if_, x) | ((_, Just x), if_) <- pkgs ] render dflags flags qual interfaces installedIfaces srcMap @@ -240,14 +240,14 @@ render dflags flags qual ifaces installedIfaces srcMap = do allVisibleIfaces = [ i | i <- allIfaces, OptHide `notElem` instOptions i ] pkgMod = ifaceMod (head ifaces) - pkgKey = modulePackageKey pkgMod - pkgStr = Just (packageKeyString pkgKey) + pkgId = modulePackageId pkgMod + pkgStr = Just (packageIdString pkgId) (pkgName,pkgVer) = modulePackageInfo pkgMod (srcBase, srcModule, srcEntity, srcLEntity) = sourceUrls flags - srcMap' = maybe srcMap (\path -> Map.insert pkgKey path srcMap) srcEntity + srcMap' = maybe srcMap (\path -> Map.insert pkgId path srcMap) srcEntity -- TODO: Get these from the interface files as with srcMap - srcLMap' = maybe Map.empty (\path -> Map.singleton pkgKey path) srcLEntity + srcLMap' = maybe Map.empty (\path -> Map.singleton pkgId path) srcLEntity sourceUrls' = (srcBase, srcModule, srcMap', srcLMap') libDir <- getHaddockLibDir flags diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs index 192c708a..9628a33d 100644 --- a/src/Haddock/Backends/Xhtml.hs +++ b/src/Haddock/Backends/Xhtml.hs @@ -306,7 +306,7 @@ mkNode qual ss p (Node s leaf pkg short ts) = htmlModule = thespan ! modAttrs << (cBtn +++ if leaf - then ppModule (mkModule (stringToPackageKey (fromMaybe "" pkg)) + then ppModule (mkModule (stringToPackageId (fromMaybe "" pkg)) (mkModuleName mdl)) else toHtml s ) diff --git a/src/Haddock/Backends/Xhtml/Layout.hs b/src/Haddock/Backends/Xhtml/Layout.hs index 253854c8..e84a57b3 100644 --- a/src/Haddock/Backends/Xhtml/Layout.hs +++ b/src/Haddock/Backends/Xhtml/Layout.hs @@ -224,7 +224,7 @@ topDeclElem ((_,_,sourceMap,lineMap), (_,_,maybe_wiki_url)) loc splice names htm -- TODO: do something about type instances. They will point to -- the module defining the type family, which is wrong. origMod = nameModule n - origPkg = modulePackageKey origMod + origPkg = modulePackageId origMod -- Name must be documented, otherwise we wouldn't get here Documented n mdl = head names diff --git a/src/Haddock/Backends/Xhtml/Types.hs b/src/Haddock/Backends/Xhtml/Types.hs index 3d1db887..122861c3 100644 --- a/src/Haddock/Backends/Xhtml/Types.hs +++ b/src/Haddock/Backends/Xhtml/Types.hs @@ -23,7 +23,7 @@ import GHC -- the base, module and entity URLs for the source code and wiki links. -type SourceURLs = (Maybe FilePath, Maybe FilePath, Map PackageKey FilePath, Map PackageKey FilePath) +type SourceURLs = (Maybe FilePath, Maybe FilePath, Map PackageId FilePath, Map PackageId FilePath) type WikiURLs = (Maybe FilePath, Maybe FilePath, Maybe FilePath) diff --git a/src/Haddock/GhcUtils.hs b/src/Haddock/GhcUtils.hs index 33d92131..8ea5485b 100644 --- a/src/Haddock/GhcUtils.hs +++ b/src/Haddock/GhcUtils.hs @@ -44,23 +44,23 @@ moduleString = moduleNameString . moduleName -- return the (name,version) of the package modulePackageInfo :: Module -> (String, [Char]) -modulePackageInfo modu = case unpackPackageKey pkg of - Nothing -> (packageKeyString pkg, "") +modulePackageInfo modu = case unpackPackageId pkg of + Nothing -> (packageIdString pkg, "") Just x -> (display $ pkgName x, showVersion (pkgVersion x)) - where pkg = modulePackageKey modu + where pkg = modulePackageId modu -- This was removed from GHC 6.11 -- XXX we shouldn't be using it, probably --- | Try and interpret a GHC 'PackageKey' as a cabal 'PackageIdentifer'. Returns @Nothing@ if +-- | Try and interpret a GHC 'PackageId' as a cabal 'PackageIdentifer'. Returns @Nothing@ if -- we could not parse it as such an object. -unpackPackageKey :: PackageKey -> Maybe PackageIdentifier -unpackPackageKey p +unpackPackageId :: PackageId -> Maybe PackageIdentifier +unpackPackageId p = case [ pid | (pid,"") <- readP_to_S parse str ] of [] -> Nothing (pid:_) -> Just pid - where str = packageKeyString p + where str = packageIdString p lookupLoadedHomeModuleGRE :: GhcMonad m => ModuleName -> m (Maybe GlobalRdrEnv) diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs index abc65f12..bc615cde 100644 --- a/src/Haddock/Interface/Create.hs +++ b/src/Haddock/Interface/Create.hs @@ -157,7 +157,7 @@ mkAliasMap dflags mRenamedSource = alias <- ideclAs impDecl return $ (lookupModuleDyn dflags - (fmap Module.fsToPackageKey $ + (fmap Module.fsToPackageId $ ideclPkgQual impDecl) (case ideclName impDecl of SrcLoc.L _ name -> name), alias)) @@ -165,7 +165,7 @@ mkAliasMap dflags mRenamedSource = -- similar to GHC.lookupModule lookupModuleDyn :: - DynFlags -> Maybe PackageKey -> ModuleName -> Module + DynFlags -> Maybe PackageId -> ModuleName -> Module lookupModuleDyn _ (Just pkgId) mdlName = Module.mkModule pkgId mdlName lookupModuleDyn dflags Nothing mdlName = @@ -173,7 +173,7 @@ lookupModuleDyn dflags Nothing mdlName = case filter snd $ Packages.lookupModuleInAllPackages dflags mdlName of (pkgId,_):_ -> Packages.packageConfigId pkgId - [] -> Module.mainPackageKey + [] -> Module.mainPackageId ------------------------------------------------------------------------------- @@ -678,8 +678,8 @@ moduleExports thisMod expMod dflags warnings gre _exports decls ifaceMap instIfa "documentation for exported module: " ++ pretty dflags expMod] return [] where - m = mkModule packageKey expMod - packageKey = modulePackageKey thisMod + m = mkModule packageId expMod + packageId = modulePackageId thisMod -- Note [1]: diff --git a/src/Haddock/InterfaceFile.hs b/src/Haddock/InterfaceFile.hs index c13125e9..bb997b9a 100644 --- a/src/Haddock/InterfaceFile.hs +++ b/src/Haddock/InterfaceFile.hs @@ -14,7 +14,7 @@ -- Reading and writing the .haddock interface file ----------------------------------------------------------------------------- module Haddock.InterfaceFile ( - InterfaceFile(..), ifPackageKey, + InterfaceFile(..), ifPackageId, readInterfaceFile, nameCacheFromGhc, freshNameCache, NameCacheAccessor, writeInterfaceFile, binaryInterfaceVersion, binaryInterfaceVersionCompatibility ) where @@ -52,11 +52,11 @@ data InterfaceFile = InterfaceFile { } -ifPackageKey :: InterfaceFile -> PackageKey -ifPackageKey if_ = +ifPackageId :: InterfaceFile -> PackageId +ifPackageId if_ = case ifInstalledIfaces if_ of [] -> error "empty InterfaceFile" - iface:_ -> modulePackageKey $ instMod iface + iface:_ -> modulePackageId $ instMod iface binaryInterfaceMagic :: Word32 @@ -310,7 +310,7 @@ getSymbolTable bh namecache = do return (namecache', arr) -type OnDiskName = (PackageKey, ModuleName, OccName) +type OnDiskName = (PackageId, ModuleName, OccName) fromOnDiskName @@ -340,7 +340,7 @@ fromOnDiskName _ nc (pid, mod_name, occ) = serialiseName :: BinHandle -> Name -> UniqFM (Int,Name) -> IO () serialiseName bh name _ = do let modu = nameModule name - put_ bh (modulePackageKey modu, moduleName modu, nameOccName name) + put_ bh (modulePackageId modu, moduleName modu, nameOccName name) ------------------------------------------------------------------------------- diff --git a/src/Haddock/ModuleTree.hs b/src/Haddock/ModuleTree.hs index 28c5c06d..2a7fbfcc 100644 --- a/src/Haddock/ModuleTree.hs +++ b/src/Haddock/ModuleTree.hs @@ -15,8 +15,8 @@ module Haddock.ModuleTree ( ModuleTree(..), mkModuleTree ) where import Haddock.Types ( Doc ) import GHC ( Name ) -import Module ( Module, moduleNameString, moduleName, modulePackageKey, - packageKeyString ) +import Module ( Module, moduleNameString, moduleName, modulePackageId, + packageIdString ) data ModuleTree = Node String Bool (Maybe String) (Maybe (Doc Name)) [ModuleTree] @@ -26,7 +26,7 @@ mkModuleTree :: Bool -> [(Module, Maybe (Doc Name))] -> [ModuleTree] mkModuleTree showPkgs mods = foldr fn [] [ (splitModule mdl, modPkg mdl, short) | (mdl, short) <- mods ] where - modPkg mod_ | showPkgs = Just (packageKeyString (modulePackageKey mod_)) + modPkg mod_ | showPkgs = Just (packageIdString (modulePackageId mod_)) | otherwise = Nothing fn (mod_,pkg,short) = addToTrees mod_ pkg short diff --git a/src/Haddock/Types.hs b/src/Haddock/Types.hs index 1f44fde4..85b3a592 100644 --- a/src/Haddock/Types.hs +++ b/src/Haddock/Types.hs @@ -50,7 +50,7 @@ type SubMap = Map Name [Name] type DeclMap = Map Name [LHsDecl Name] type InstMap = Map SrcSpan Name type FixMap = Map Name Fixity -type SrcMap = Map PackageKey FilePath +type SrcMap = Map PackageId FilePath type DocPaths = (FilePath, Maybe FilePath) -- paths to HTML and sources |