X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fmain%2FPackageConfig.hs;h=50c1e7105aeea53f25f0044271e49a375fc13b57;hp=f3cede68dabff7f9cd754eacb14136078bbaa3ad;hb=4da7b4ae7d6344d5ab6a1eafe39d04d850183a4a;hpb=36dfa35139e359e51f4062b165ee5823f4f2b2a7 diff --git a/compiler/main/PackageConfig.hs b/compiler/main/PackageConfig.hs index f3cede6..50c1e71 100644 --- a/compiler/main/PackageConfig.hs +++ b/compiler/main/PackageConfig.hs @@ -7,7 +7,7 @@ module PackageConfig ( -- $package_naming -- * PackageId - mkPackageId, packageConfigId, unpackPackageId, + mkPackageId, packageConfigId, -- * The PackageConfig type: information about a package PackageConfig, @@ -28,7 +28,6 @@ import Distribution.ModuleName import Distribution.Package hiding (PackageId) import Distribution.Text import Distribution.Version -import Distribution.Compat.ReadP -- ----------------------------------------------------------------------------- -- Our PackageConfig type is just InstalledPackageInfo from Cabal. Later we @@ -60,16 +59,7 @@ mkPackageId = stringToPackageId . display -- | Get the GHC 'PackageId' right out of a Cabalish 'PackageConfig' packageConfigId :: PackageConfig -> PackageId -packageConfigId = mkPackageId . package - --- | Try and interpret a GHC 'PackageId' as a cabal 'PackageIdentifer'. Returns @Nothing@ if --- we could not parse it as such an object. -unpackPackageId :: PackageId -> Maybe PackageIdentifier -unpackPackageId p - = case [ pid | (pid,"") <- readP_to_S parse str ] of - [] -> Nothing - (pid:_) -> Just pid - where str = packageIdString p +packageConfigId = mkPackageId . sourcePackageId -- | Turn a 'PackageConfig', which contains GHC 'Module.ModuleName's into a Cabal specific -- 'InstalledPackageInfo' which contains Cabal 'Distribution.ModuleName.ModuleName's @@ -84,11 +74,9 @@ packageConfigToInstalledPackageInfo -- | Turn an 'InstalledPackageInfo', which contains Cabal 'Distribution.ModuleName.ModuleName's -- into a GHC specific 'PackageConfig' which contains GHC 'Module.ModuleName's -installedPackageInfoToPackageConfig :: InstalledPackageInfo -> PackageConfig +installedPackageInfoToPackageConfig :: InstalledPackageInfo_ String -> PackageConfig installedPackageInfoToPackageConfig (pkgconf@(InstalledPackageInfo { exposedModules = e, hiddenModules = h })) = - pkgconf{ exposedModules = map convert e, - hiddenModules = map convert h } - where convert :: Distribution.ModuleName.ModuleName -> Module.ModuleName - convert = mkModuleName . display + pkgconf{ exposedModules = map mkModuleName e, + hiddenModules = map mkModuleName h }