Commit cf7e3313 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Add a dedicated indefinite field to InstalledPackageInfo.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 2f93432d
......@@ -31,7 +31,6 @@ module Distribution.InstalledPackageInfo (
InstalledPackageInfo(..),
installedComponentId,
installedPackageId,
indefinite,
requiredSignatures,
installedOpenUnitId,
ExposedModule(..),
......@@ -61,7 +60,6 @@ import Distribution.Compat.Graph
import Text.PrettyPrint as Disp
import qualified Data.Char as Char
import qualified Data.Map as Map
import qualified Data.Set as Set
import Data.Set (Set)
-- -----------------------------------------------------------------------------
......@@ -92,6 +90,7 @@ data InstalledPackageInfo
category :: String,
-- these parts are required by an installed package only:
abiHash :: AbiHash,
indefinite :: Bool,
exposed :: Bool,
-- INVARIANT: if the package is definite, OpenModule's
-- OpenUnitId directly records UnitId.
......@@ -119,13 +118,6 @@ data InstalledPackageInfo
}
deriving (Eq, Generic, Read, Show)
-- | Returns 'True' if this is an interface-file only indefinite
-- package which has not been instantiated.
indefinite :: InstalledPackageInfo -> Bool
indefinite ipi =
-- TODO: optimize a little
Set.null (openModuleSubstFreeHoles (Map.fromList (instantiatedWith ipi)))
-- | Get the indefinite unit identity representing this package.
-- This IS NOT guaranteed to give you a substitution; for
-- instantiated packages you will get @DefiniteUnitId (installedUnitId ipi)@.
......@@ -185,6 +177,7 @@ emptyInstalledPackageInfo
description = "",
category = "",
abiHash = mkAbiHash "",
indefinite = False,
exposed = False,
exposedModules = [],
hiddenModules = [],
......@@ -336,6 +329,8 @@ installedFieldDescrs :: [FieldDescr InstalledPackageInfo]
installedFieldDescrs = [
boolField "exposed"
exposed (\val pkg -> pkg{exposed=val})
, boolField "indefinite"
indefinite (\val pkg -> pkg{indefinite=val})
, simpleField "exposed-modules"
showExposedModules parseExposedModules
exposedModules (\xs pkg -> pkg{exposedModules=xs})
......
......@@ -82,6 +82,7 @@ toCurrent ipi@InstalledPackageInfo{} =
Current.synopsis = "",
Current.description = description ipi,
Current.category = category ipi,
Current.indefinite = False,
Current.exposed = exposed ipi,
Current.exposedModules = map (mkExposedModule . convertModuleName) (exposedModules ipi),
Current.hiddenModules = map convertModuleName (hiddenModules ipi),
......
......@@ -51,6 +51,7 @@ import Distribution.Compat.Prelude
import Distribution.Types.TargetInfo
import Distribution.Types.LocalBuildInfo
import Distribution.Types.ComponentLocalBuildInfo
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.BuildPaths
......@@ -401,6 +402,7 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
IPI.description = description pkg,
IPI.category = category pkg,
IPI.abiHash = abi_hash,
IPI.indefinite = componentIsIndefinite clbi,
IPI.exposed = libExposed lib,
IPI.exposedModules = componentExposedModules clbi,
IPI.hiddenModules = otherModules bi,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment