diff --git a/Cabal-syntax/src/Distribution/PackageDescription/Configuration.hs b/Cabal-syntax/src/Distribution/PackageDescription/Configuration.hs index d23ac5cbf51..295dfbd0470 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/Configuration.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/Configuration.hs @@ -28,7 +28,6 @@ module Distribution.PackageDescription.Configuration , mapCondTree , mapTreeData , mapTreeConds - , mapTreeConstrs , transformAllBuildInfos , transformAllBuildDepends , transformAllBuildDependsN @@ -39,6 +38,7 @@ import Distribution.Compat.Prelude import Prelude () -- lens +import qualified Distribution.Compat.Lens as L import qualified Distribution.Types.BuildInfo.Lens as L import qualified Distribution.Types.GenericPackageDescription.Lens as L import qualified Distribution.Types.PackageDescription.Lens as L @@ -64,6 +64,7 @@ import Distribution.Utils.Path (sameDirectory) import Distribution.Version import Data.Tree (Tree (Node)) +import Data.Tuple ------------------------------------------------------------------------------ @@ -192,7 +193,7 @@ resolveWithFlags -- ^ Compiler information -> [PackageVersionConstraint] -- ^ Additional constraints - -> [CondTree ConfVar [Dependency] PDTagged] + -> [CondTree ConfVar PDTagged] -> ([Dependency] -> DepTestRslt) -- ^ Dependency test function. -> Either [MissingDependency] (TargetSet PDTagged, FlagAssignment) @@ -203,10 +204,10 @@ resolveWithFlags dom enabled os arch impl constrs trees checkDeps = where -- simplify trees by (partially) evaluating all conditions and converting -- dependencies to dependency maps. - simplifiedTrees :: [CondTree FlagName DependencyMap PDTagged] + simplifiedTrees :: [CondTree FlagName (PDTagged, DependencyMap)] simplifiedTrees = map - ( mapTreeConstrs toDepMap -- convert to maps + ( mapTreeData (\x -> (x, toDepMap $ L.view L.targetBuildDepends x)) . addBuildableConditionPDTagged . mapTreeConds (fst . simplifyWithSysParams os arch impl) ) @@ -226,6 +227,7 @@ resolveWithFlags dom enabled os arch impl constrs trees checkDeps = flip map simplifiedTrees $ -- apply additional constraints to all dependencies first (`constrainBy` constrs) + . swap . simplifyCondTree (env flags) deps = overallDependencies enabled targetSet in case checkDeps (fromDepMap deps) of @@ -262,15 +264,15 @@ resolveWithFlags dom enabled os arch impl constrs trees checkDeps = -- can determine that Buildable is always True, it returns the input unchanged. -- If Buildable is always False, it returns the empty 'CondTree'. addBuildableCondition - :: (Eq v, Monoid a, Monoid c) + :: (Eq v, Monoid a) => (a -> BuildInfo) - -> CondTree v c a - -> CondTree v c a + -> CondTree v a + -> CondTree v a addBuildableCondition getInfo t = case extractCondition (buildable . getInfo) t of Lit True -> t - Lit False -> CondNode mempty mempty [] - c -> CondNode mempty mempty [condIfThen c t] + Lit False -> CondNode mempty [] + c -> CondNode mempty [condIfThen c t] -- | This is a special version of 'addBuildableCondition' for the 'PDTagged' -- type. @@ -282,16 +284,18 @@ addBuildableCondition getInfo t = -- -- See for more details. addBuildableConditionPDTagged - :: (Eq v, Monoid c) - => CondTree v c PDTagged - -> CondTree v c PDTagged + :: Eq v + => CondTree v PDTagged + -> CondTree v PDTagged addBuildableConditionPDTagged t = case extractCondition (buildable . getInfo) t of Lit True -> t - Lit False -> deleteConstraints t - c -> CondNode mempty mempty [condIfThenElse c t (deleteConstraints t)] + Lit False -> mapTreeData deleteConstraints t + c -> CondNode mempty [condIfThenElse c t (mapTreeData deleteConstraints t)] where - deleteConstraints = mapTreeConstrs (const mempty) + deleteConstraints (Lib lib) = Lib (L.set L.targetBuildDepends mempty lib) + deleteConstraints (SubComp unqualName comp) = SubComp unqualName (L.set L.targetBuildDepends mempty comp) + deleteConstraints PDNull = PDNull getInfo :: PDTagged -> BuildInfo getInfo (Lib l) = libBuildInfo l @@ -326,10 +330,10 @@ extractConditions f gpkg = , extractCondition (f . benchmarkBuildInfo) . snd <$> condBenchmarks gpkg ] -freeVars :: CondTree ConfVar c a -> [FlagName] +freeVars :: CondTree ConfVar a -> [FlagName] freeVars t = [f | PackageFlag f <- freeVars' t] where - freeVars' (CondNode _ _ ifs) = concatMap compfv ifs + freeVars' (CondNode _ ifs) = concatMap compfv ifs compfv (CondBranch c ct mct) = condfv c ++ freeVars' ct ++ maybe [] freeVars' mct condfv c = case c of Var v -> [v] @@ -406,6 +410,13 @@ instance Semigroup PDTagged where SubComp n x <> SubComp n' x' | n == n' = SubComp n (x <> x') _ <> _ = cabalBug "Cannot combine incompatible tags" +instance L.HasBuildInfo PDTagged where + buildInfo f x = case x of + Lib lib -> Lib <$> L.buildInfo f lib + SubComp name comp -> SubComp name <$> L.buildInfo f comp + -- TODO(leana8959): is there a better way to do this + PDNull -> PDNull <$ (f mempty) + -- | Create a package description with all configurations resolved. -- -- This function takes a `GenericPackageDescription` and several environment @@ -554,36 +565,47 @@ flattenPackageDescription where mlib = f <$> mlib0 where - f lib = (libFillInDefaults . fst . ignoreConditions $ lib){libName = LMainLibName} + f :: CondTree ConfVar Library -> Library + f lib = (libFillInDefaults . ignoreConditions $ lib){libName = LMainLibName} sub_libs = flattenLib <$> sub_libs0 flibs = flattenFLib <$> flibs0 exes = flattenExe <$> exes0 tests = flattenTst <$> tests0 bms = flattenBm <$> bms0 + + flattenLib :: (UnqualComponentName, CondTree ConfVar Library) -> Library flattenLib (n, t) = libFillInDefaults $ - (fst $ ignoreConditions t) + (ignoreConditions t) { libName = LSubLibName n , libExposed = False } + + flattenFLib :: (UnqualComponentName, CondTree ConfVar ForeignLib) -> ForeignLib flattenFLib (n, t) = flibFillInDefaults $ - (fst $ ignoreConditions t) + (ignoreConditions t) { foreignLibName = n } + + flattenExe :: (UnqualComponentName, CondTree ConfVar Executable) -> Executable flattenExe (n, t) = exeFillInDefaults $ - (fst $ ignoreConditions t) + (ignoreConditions t) { exeName = n } + + flattenTst :: (UnqualComponentName, CondTree ConfVar TestSuite) -> TestSuite flattenTst (n, t) = testFillInDefaults $ - (fst $ ignoreConditions t) + (ignoreConditions t) { testName = n } + + flattenBm :: (UnqualComponentName, CondTree ConfVar Benchmark) -> Benchmark flattenBm (n, t) = benchFillInDefaults $ - (fst $ ignoreConditions t) + (ignoreConditions t) { benchmarkName = n } @@ -640,8 +662,6 @@ transformAllBuildDepends transformAllBuildDepends f = over (L.traverseBuildInfos . L.targetBuildDepends . traverse) f . over (L.packageDescription . L.setupBuildInfo . traverse . L.setupDepends . traverse) f - -- cannot be point-free as normal because of higher rank - . over (\f' -> L.allCondTrees $ traverseCondTreeC f') (map f) -- | Walk a 'GenericPackageDescription' and apply @f@ to all nested -- @build-depends@ fields. @@ -652,5 +672,3 @@ transformAllBuildDependsN transformAllBuildDependsN f = over (L.traverseBuildInfos . L.targetBuildDepends) f . over (L.packageDescription . L.setupBuildInfo . traverse . L.setupDepends) f - -- cannot be point-free as normal because of higher rank - . over (\f' -> L.allCondTrees $ traverseCondTreeC f') f diff --git a/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs b/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs index e5f0e4f406b..f23bf0a8107 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs @@ -263,7 +263,7 @@ goSections specVer = traverse_ process -> Map String CondTreeBuildInfo -- \^ common stanzas -> [Field Position] - -> ParseResult src (CondTree ConfVar [Dependency] a) + -> ParseResult src (CondTree ConfVar a) parseCondTree' = parseCondTreeWithCommonStanzas specVer parseSection :: Name Position -> [SectionArg Position] -> [Field Position] -> SectionParser src () @@ -478,11 +478,9 @@ parseCondTree -- ^ common stanzas -> (BuildInfo -> a) -- ^ constructor from buildInfo - -> (a -> [Dependency]) - -- ^ condition extractor -> [Field Position] - -> ParseResult src (CondTree ConfVar [Dependency] a) -parseCondTree v hasElif grammar commonStanzas fromBuildInfo cond = go + -> ParseResult src (CondTree ConfVar a) +parseCondTree v hasElif grammar commonStanzas fromBuildInfo = go where go fields0 = do (fields, endo) <- @@ -493,9 +491,9 @@ parseCondTree v hasElif grammar commonStanzas fromBuildInfo cond = go let (fs, ss) = partitionFields fields x <- parseFieldGrammar v fs grammar branches <- concat <$> traverse parseIfs ss - return $ endo $ CondNode x (cond x) branches + return $ endo $ CondNode x branches - parseIfs :: [Section Position] -> ParseResult src [CondBranch ConfVar [Dependency] a] + parseIfs :: [Section Position] -> ParseResult src [CondBranch ConfVar a] parseIfs [] = return [] parseIfs (MkSection (Name pos name) test fields : sections) | name == "if" = do test' <- parseConditionConfVar (startOfSection (incPos 2 pos) test) test @@ -508,7 +506,7 @@ parseCondTree v hasElif grammar commonStanzas fromBuildInfo cond = go parseElseIfs :: [Section Position] - -> ParseResult src (Maybe (CondTree ConfVar [Dependency] a), [CondBranch ConfVar [Dependency] a]) + -> ParseResult src (Maybe (CondTree ConfVar a), [CondBranch ConfVar a]) parseElseIfs [] = return (Nothing, []) parseElseIfs (MkSection (Name pos name) args fields : sections) | name == "else" = do unless (null args) $ @@ -525,7 +523,7 @@ parseCondTree v hasElif grammar commonStanzas fromBuildInfo cond = go (elseFields, sections') <- parseElseIfs sections -- we parse an empty 'Fields', to get empty value for a node a <- parseFieldGrammar v mempty grammar - return (Just $ CondNode a (cond a) [CondBranch test' fields' elseFields], sections') + return (Just $ CondNode a [CondBranch test' fields' elseFields], sections') parseElseIfs (MkSection (Name pos name) _ _ : sections) | name == "elif" = do parseWarning pos PWTInvalidSubsection "invalid subsection \"elif\". You should set cabal-version: 2.2 or larger to use elif-conditionals." (,) Nothing <$> parseIfs sections @@ -593,7 +591,7 @@ with new AST, this all need to be rewritten. -- The approach is simple, and have good properties: -- -- * Common stanzas are parsed exactly once, even if not-used. Thus we report errors in them. -type CondTreeBuildInfo = CondTree ConfVar [Dependency] BuildInfo +type CondTreeBuildInfo = CondTree ConfVar BuildInfo -- | Create @a@ from 'BuildInfo'. -- This class is used to implement common stanza parsing. @@ -635,10 +633,10 @@ parseCondTreeWithCommonStanzas -> Map String CondTreeBuildInfo -- ^ common stanzas -> [Field Position] - -> ParseResult src (CondTree ConfVar [Dependency] a) + -> ParseResult src (CondTree ConfVar a) parseCondTreeWithCommonStanzas v grammar fromBuildInfo commonStanzas fields = do (fields', endo) <- processImports v fromBuildInfo commonStanzas fields - x <- parseCondTree v hasElif grammar commonStanzas fromBuildInfo (view L.targetBuildDepends) fields' + x <- parseCondTree v hasElif grammar commonStanzas fromBuildInfo fields' return (endo x) where hasElif = specHasElif v @@ -652,7 +650,7 @@ processImports -> Map String CondTreeBuildInfo -- ^ common stanzas -> [Field Position] - -> ParseResult src ([Field Position], CondTree ConfVar [Dependency] a -> CondTree ConfVar [Dependency] a) + -> ParseResult src ([Field Position], CondTree ConfVar a -> CondTree ConfVar a) processImports v fromBuildInfo commonStanzas = go [] where hasCommonStanzas = specHasCommonStanzas v @@ -695,11 +693,11 @@ warnImport _ f = pure (Just f) mergeCommonStanza :: L.HasBuildInfo a => (BuildInfo -> a) - -> CondTree ConfVar [Dependency] BuildInfo - -> CondTree ConfVar [Dependency] a - -> CondTree ConfVar [Dependency] a -mergeCommonStanza fromBuildInfo (CondNode bi _ bis) (CondNode x _ cs) = - CondNode x' (x' ^. L.targetBuildDepends) cs' + -> CondTree ConfVar BuildInfo + -> CondTree ConfVar a + -> CondTree ConfVar a +mergeCommonStanza fromBuildInfo (CondNode bi bis) (CondNode x cs) = + CondNode x' cs' where -- new value is old value with buildInfo field _prepended_. x' = x & L.buildInfo %~ (bi <>) @@ -712,7 +710,7 @@ mergeCommonStanza fromBuildInfo (CondNode bi _ bis) (CondNode x _ cs) = ------------------------------------------------------------------------------- -- Check that a property holds on all branches of a condition tree -onAllBranches :: forall v c a. Monoid a => (a -> Bool) -> CondTree v c a -> Bool +onAllBranches :: forall v a. Monoid a => (a -> Bool) -> CondTree v a -> Bool onAllBranches p = go mempty where -- If the current level of the tree satisfies the property, then we are @@ -720,13 +718,13 @@ onAllBranches p = go mempty -- must satisfy it. Each node may have multiple immediate children; we only -- one need one to satisfy the property because the configure step uses -- 'mappend' to join together the results of flag resolution. - go :: a -> CondTree v c a -> Bool + go :: a -> CondTree v a -> Bool go acc ct = let acc' = acc `mappend` condTreeData ct in p acc' || any (goBranch acc') (condTreeComponents ct) -- Both the 'true' and the 'false' block must satisfy the property. - goBranch :: a -> CondBranch v c a -> Bool + goBranch :: a -> CondBranch v a -> Bool goBranch _ (CondBranch _ _ Nothing) = False goBranch acc (CondBranch _ t (Just e)) = go acc t && go acc e @@ -750,7 +748,7 @@ checkForUndefinedFlags gpd = do "These flags are used without having been defined: " ++ intercalate ", " [unFlagName fn | fn <- Set.toList $ usedFlags `Set.difference` definedFlags] where - f :: CondTree ConfVar c a -> Const (Set.Set FlagName) (CondTree ConfVar c a) + f :: CondTree ConfVar a -> Const (Set.Set FlagName) (CondTree ConfVar a) f ct = Const (Set.fromList (freeVars ct)) -- | Since @cabal-version: 1.24@ one can specify @custom-setup@. diff --git a/Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs b/Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs index 47622b0c43c..dbd872d2823 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs @@ -121,11 +121,11 @@ ppFlag v flag@(MkPackageFlag name _ _ _) = PrettySection () "flag" [ppFlagName name] $ prettyFieldGrammar v (flagFieldGrammar name) flag -ppCondTree2 :: CabalSpecVersion -> PrettyFieldGrammar' s -> CondTree ConfVar [Dependency] s -> [PrettyField ()] +ppCondTree2 :: CabalSpecVersion -> PrettyFieldGrammar' s -> CondTree ConfVar s -> [PrettyField ()] ppCondTree2 v grammar = go where -- TODO: recognise elif opportunities - go (CondNode it _ ifs) = + go (CondNode it ifs) = prettyFieldGrammar v grammar it ++ concatMap ppIf ifs @@ -140,42 +140,42 @@ ppCondTree2 v grammar = go , PrettySection () "else" [] (go elseTree) ] -ppCondLibrary :: CabalSpecVersion -> Maybe (CondTree ConfVar [Dependency] Library) -> [PrettyField ()] +ppCondLibrary :: CabalSpecVersion -> Maybe (CondTree ConfVar Library) -> [PrettyField ()] ppCondLibrary _ Nothing = mempty ppCondLibrary v (Just condTree) = pure $ PrettySection () "library" [] $ ppCondTree2 v (libraryFieldGrammar LMainLibName) condTree -ppCondSubLibraries :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar [Dependency] Library)] -> [PrettyField ()] +ppCondSubLibraries :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar Library)] -> [PrettyField ()] ppCondSubLibraries v libs = [ PrettySection () "library" [pretty n] $ ppCondTree2 v (libraryFieldGrammar $ LSubLibName n) condTree | (n, condTree) <- libs ] -ppCondForeignLibs :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)] -> [PrettyField ()] +ppCondForeignLibs :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar ForeignLib)] -> [PrettyField ()] ppCondForeignLibs v flibs = [ PrettySection () "foreign-library" [pretty n] $ ppCondTree2 v (foreignLibFieldGrammar n) condTree | (n, condTree) <- flibs ] -ppCondExecutables :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar [Dependency] Executable)] -> [PrettyField ()] +ppCondExecutables :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar Executable)] -> [PrettyField ()] ppCondExecutables v exes = [ PrettySection () "executable" [pretty n] $ ppCondTree2 v (executableFieldGrammar n) condTree | (n, condTree) <- exes ] -ppCondTestSuites :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)] -> [PrettyField ()] +ppCondTestSuites :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar TestSuite)] -> [PrettyField ()] ppCondTestSuites v suites = [ PrettySection () "test-suite" [pretty n] $ ppCondTree2 v testSuiteFieldGrammar (fmap FG.unvalidateTestSuite condTree) | (n, condTree) <- suites ] -ppCondBenchmarks :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)] -> [PrettyField ()] +ppCondBenchmarks :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar Benchmark)] -> [PrettyField ()] ppCondBenchmarks v suites = [ PrettySection () "benchmark" [pretty n] $ ppCondTree2 v benchmarkFieldGrammar (fmap FG.unvalidateBenchmark condTree) @@ -241,14 +241,14 @@ pdToGpd pd = where -- We set CondTree's [Dependency] to an empty list, as it -- is not pretty printed anyway. - mkCondTree x = CondNode x [] [] - mkCondTreeL l = (fromMaybe (mkUnqualComponentName "") (libraryNameString (libName l)), CondNode l [] []) + mkCondTree x = CondNode x [] + mkCondTreeL l = (fromMaybe (mkUnqualComponentName "") (libraryNameString (libName l)), CondNode l []) mkCondTree' :: (a -> UnqualComponentName) -> a - -> (UnqualComponentName, CondTree ConfVar [Dependency] a) - mkCondTree' f x = (f x, CondNode x [] []) + -> (UnqualComponentName, CondTree ConfVar a) + mkCondTree' f x = (f x, CondNode x []) ------------------------------------------------------------------------------- -- Internal libs diff --git a/Cabal-syntax/src/Distribution/Types/CondTree.hs b/Cabal-syntax/src/Distribution/Types/CondTree.hs index c74ffdf6395..a187c3bdd48 100644 --- a/Cabal-syntax/src/Distribution/Types/CondTree.hs +++ b/Cabal-syntax/src/Distribution/Types/CondTree.hs @@ -10,13 +10,12 @@ module Distribution.Types.CondTree , condIfThenElse , foldCondTree , mapCondTree - , mapTreeConstrs , mapTreeConds , mapTreeData + , traverseCondTreeA , traverseCondTreeV + , traverseCondBranchA , traverseCondBranchV - , traverseCondTreeC - , traverseCondBranchC , extractCondition , simplifyCondTree , simplifyCondBranch @@ -54,109 +53,110 @@ import qualified Distribution.Compat.Lens as L -- derived off of 'targetBuildInfo' (perhaps a good refactoring -- would be to convert this into an opaque type, with a smart -- constructor that pre-computes the dependencies.) -data CondTree v c a = CondNode +data CondTree v a = CondNode { condTreeData :: a - , condTreeConstraints :: c - , condTreeComponents :: [CondBranch v c a] + , condTreeComponents :: [CondBranch v a] } deriving (Show, Eq, Data, Generic, Functor, Foldable, Traversable) -instance (Binary v, Binary c, Binary a) => Binary (CondTree v c a) -instance (Structured v, Structured c, Structured a) => Structured (CondTree v c a) -instance (NFData v, NFData c, NFData a) => NFData (CondTree v c a) where rnf = genericRnf +instance (Binary v, Binary a) => Binary (CondTree v a) +instance (Structured v, Structured a) => Structured (CondTree v a) +instance (NFData v, NFData a) => NFData (CondTree v a) where rnf = genericRnf -instance (Semigroup a, Semigroup c) => Semigroup (CondTree v c a) where - (CondNode a c bs) <> (CondNode a' c' bs') = CondNode (a <> a') (c <> c') (bs <> bs') +instance Semigroup a => Semigroup (CondTree v a) where + (CondNode a bs) <> (CondNode a' bs') = CondNode (a <> a') (bs <> bs') -instance (Semigroup a, Semigroup c, Monoid a, Monoid c) => Monoid (CondTree v c a) where +instance (Semigroup a, Monoid a) => Monoid (CondTree v a) where mappend = (<>) - mempty = CondNode mempty mempty mempty + mempty = CondNode mempty mempty -- | A 'CondBranch' represents a conditional branch, e.g., @if -- flag(foo)@ on some syntax @a@. It also has an optional false -- branch. -data CondBranch v c a = CondBranch +data CondBranch v a = CondBranch { condBranchCondition :: Condition v - , condBranchIfTrue :: CondTree v c a - , condBranchIfFalse :: Maybe (CondTree v c a) + , condBranchIfTrue :: CondTree v a + , condBranchIfFalse :: Maybe (CondTree v a) } deriving (Show, Eq, Data, Generic, Functor, Traversable) -- This instance is written by hand because GHC 8.0.1/8.0.2 infinite -- loops when trying to derive it with optimizations. See -- https://gitlab.haskell.org/ghc/ghc/-/issues/13056 -instance Foldable (CondBranch v c) where +instance Foldable (CondBranch v) where foldMap f (CondBranch _ c Nothing) = foldMap f c foldMap f (CondBranch _ c (Just a)) = foldMap f c `mappend` foldMap f a -instance (Binary v, Binary c, Binary a) => Binary (CondBranch v c a) -instance (Structured v, Structured c, Structured a) => Structured (CondBranch v c a) -instance (NFData v, NFData c, NFData a) => NFData (CondBranch v c a) where rnf = genericRnf +instance (Binary v, Binary a) => Binary (CondBranch v a) +instance (Structured v, Structured a) => Structured (CondBranch v a) +instance (NFData v, NFData a) => NFData (CondBranch v a) where rnf = genericRnf -condIfThen :: Condition v -> CondTree v c a -> CondBranch v c a +condIfThen :: Condition v -> CondTree v a -> CondBranch v a condIfThen c t = CondBranch c t Nothing -condIfThenElse :: Condition v -> CondTree v c a -> CondTree v c a -> CondBranch v c a +condIfThenElse :: Condition v -> CondTree v a -> CondTree v a -> CondBranch v a condIfThenElse c t e = CondBranch c t (Just e) mapCondTree :: (a -> b) - -> (c -> d) -> (Condition v -> Condition w) - -> CondTree v c a - -> CondTree w d b -mapCondTree fa fc fcnd (CondNode a c ifs) = - CondNode (fa a) (fc c) (map g ifs) + -> CondTree v a + -> CondTree w b +mapCondTree fa fcnd (CondNode a ifs) = + CondNode (fa a) (map g ifs) where g (CondBranch cnd t me) = CondBranch (fcnd cnd) - (mapCondTree fa fc fcnd t) - (fmap (mapCondTree fa fc fcnd) me) + (mapCondTree fa fcnd t) + (fmap (mapCondTree fa fcnd) me) -mapTreeConstrs :: (c -> d) -> CondTree v c a -> CondTree v d a -mapTreeConstrs f = mapCondTree id f id +-- mapTreeConstrs :: (c -> d) -> CondTree v c a -> CondTree v d a +-- mapTreeConstrs f = mapCondTree id f id -mapTreeConds :: (Condition v -> Condition w) -> CondTree v c a -> CondTree w c a -mapTreeConds f = mapCondTree id id f +mapTreeConds :: (Condition v -> Condition w) -> CondTree v a -> CondTree w a +mapTreeConds f = mapCondTree id f -mapTreeData :: (a -> b) -> CondTree v c a -> CondTree v c b -mapTreeData f = mapCondTree f id id +mapTreeData :: (a -> b) -> CondTree v a -> CondTree v b +mapTreeData f = mapCondTree f id + +-- | @@Traversal@@ for the data +traverseCondTreeA :: L.Traversal (CondTree v a) (CondTree v b) a b +traverseCondTreeA f (CondNode a ifs) = + CondNode + <$> f a + <*> traverse (traverseCondBranchA f) ifs -- | @@Traversal@@ for the variables -traverseCondTreeV :: L.Traversal (CondTree v c a) (CondTree w c a) v w -traverseCondTreeV f (CondNode a c ifs) = - CondNode a c <$> traverse (traverseCondBranchV f) ifs +traverseCondTreeV :: L.Traversal (CondTree v a) (CondTree w a) v w +traverseCondTreeV f (CondNode a ifs) = + CondNode a <$> traverse (traverseCondBranchV f) ifs + +-- | @@Traversal@@ for the data +traverseCondBranchA :: L.Traversal (CondBranch v a) (CondBranch v b) a b +traverseCondBranchA f (CondBranch cnd t me) = + CondBranch + <$> pure cnd + <*> traverseCondTreeA f t + <*> traverse (traverseCondTreeA f) me -- | @@Traversal@@ for the variables -traverseCondBranchV :: L.Traversal (CondBranch v c a) (CondBranch w c a) v w +traverseCondBranchV :: L.Traversal (CondBranch v a) (CondBranch w a) v w traverseCondBranchV f (CondBranch cnd t me) = CondBranch <$> traverse f cnd <*> traverseCondTreeV f t <*> traverse (traverseCondTreeV f) me --- | @@Traversal@@ for the aggregated constraints -traverseCondTreeC :: L.Traversal (CondTree v c a) (CondTree v d a) c d -traverseCondTreeC f (CondNode a c ifs) = - CondNode a <$> f c <*> traverse (traverseCondBranchC f) ifs - --- | @@Traversal@@ for the aggregated constraints -traverseCondBranchC :: L.Traversal (CondBranch v c a) (CondBranch v d a) c d -traverseCondBranchC f (CondBranch cnd t me) = - CondBranch cnd - <$> traverseCondTreeC f t - <*> traverse (traverseCondTreeC f) me - -- | Extract the condition matched by the given predicate from a cond tree. -- -- We use this mainly for extracting buildable conditions (see the Note in -- Distribution.PackageDescription.Configuration), but the function is in fact -- more general. -extractCondition :: Eq v => (a -> Bool) -> CondTree v c a -> Condition v +extractCondition :: Eq v => (a -> Bool) -> CondTree v a -> Condition v extractCondition p = go where - go (CondNode x _ cs) + go (CondNode x cs) | not (p x) = Lit False | otherwise = goList cs @@ -171,20 +171,20 @@ extractCondition p = go -- | Flattens a CondTree using a partial flag assignment. When a condition -- cannot be evaluated, both branches are ignored. simplifyCondTree - :: (Semigroup a, Semigroup d) + :: Semigroup a => (v -> Either v Bool) - -> CondTree v d a - -> (d, a) -simplifyCondTree env (CondNode a d ifs) = - foldl (<>) (d, a) $ mapMaybe (simplifyCondBranch env) ifs + -> CondTree v a + -> a +simplifyCondTree env (CondNode a ifs) = + foldl (<>) a $ mapMaybe (simplifyCondBranch env) ifs -- | Realizes a 'CondBranch' using partial flag assignment. When a condition -- cannot be evaluated, returns 'Nothing'. simplifyCondBranch - :: (Semigroup a, Semigroup d) + :: Semigroup a => (v -> Either v Bool) - -> CondBranch v d a - -> Maybe (d, a) + -> CondBranch v a + -> Maybe a simplifyCondBranch env (CondBranch cnd t me) = case simplifyCondition cnd env of (Lit True, _) -> Just $ simplifyCondTree env t @@ -194,8 +194,8 @@ simplifyCondBranch env (CondBranch cnd t me) = -- | Flatten a CondTree. This will resolve the CondTree by taking all -- possible paths into account. Note that since branches represent exclusive -- choices this may not result in a \"sane\" result. -ignoreConditions :: (Semigroup a, Semigroup c) => CondTree v c a -> (a, c) -ignoreConditions (CondNode a c ifs) = foldl (<>) (a, c) $ concatMap f ifs +ignoreConditions :: Semigroup a => CondTree v a -> a +ignoreConditions (CondNode a ifs) = foldl (<>) a $ concatMap f ifs where f (CondBranch _ t me) = ignoreConditions t @@ -204,10 +204,10 @@ ignoreConditions (CondNode a c ifs) = foldl (<>) (a, c) $ concatMap f ifs -- | Flatten a CondTree. This will traverse the CondTree by taking all -- possible paths into account, but merging inclusive when two paths -- may co-exist, and exclusively when the paths are an if/else -foldCondTree :: forall b c a v. b -> ((c, a) -> b) -> (b -> b -> b) -> (b -> b -> b) -> CondTree v c a -> b +foldCondTree :: forall b a v. b -> (a -> b) -> (b -> b -> b) -> (b -> b -> b) -> CondTree v a -> b foldCondTree e u mergeInclusive mergeExclusive = goTree where - goTree :: CondTree v c a -> b - goTree (CondNode a c ifs) = u (c, a) `mergeInclusive` foldl goBranch e ifs - goBranch :: b -> CondBranch v c a -> b + goTree :: CondTree v a -> b + goTree (CondNode a ifs) = u a `mergeInclusive` foldl goBranch e ifs + goBranch :: b -> CondBranch v a -> b goBranch acc (CondBranch _ t mt) = mergeInclusive acc (maybe (goTree t) (mergeExclusive (goTree t) . goTree) mt) diff --git a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs index 97f4ed8cccb..67c39879614 100644 --- a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs +++ b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs @@ -44,30 +44,30 @@ data GenericPackageDescription = GenericPackageDescription -- Perfectly, PackageIndex should have sum type, so we don't need to -- have dummy GPDs. , genPackageFlags :: [PackageFlag] - , condLibrary :: Maybe (CondTree ConfVar [Dependency] Library) + , condLibrary :: Maybe (CondTree ConfVar Library) , condSubLibraries :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] Library + , CondTree ConfVar Library ) ] , condForeignLibs :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] ForeignLib + , CondTree ConfVar ForeignLib ) ] , condExecutables :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] Executable + , CondTree ConfVar Executable ) ] , condTestSuites :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] TestSuite + , CondTree ConfVar TestSuite ) ] , condBenchmarks :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] Benchmark + , CondTree ConfVar Benchmark ) ] } @@ -92,29 +92,9 @@ instance L.HasBuildInfos GenericPackageDescription where <$> L.traverseBuildInfos f p <*> pure v <*> pure a1 - <*> (traverse . traverseCondTreeBuildInfo) f x1 - <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x2 - <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x3 - <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x4 - <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x5 - <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x6 - --- We use this traversal to keep [Dependency] field in CondTree up to date. -traverseCondTreeBuildInfo - :: forall f comp v - . (Applicative f, L.HasBuildInfo comp) - => LensLike' f (CondTree v [Dependency] comp) L.BuildInfo -traverseCondTreeBuildInfo g = node - where - mkCondNode :: comp -> [CondBranch v [Dependency] comp] -> CondTree v [Dependency] comp - mkCondNode comp = CondNode comp (view L.targetBuildDepends comp) - - node (CondNode comp _ branches) = - mkCondNode - <$> L.buildInfo g comp - <*> traverse branch branches - - branch (CondBranch v x y) = - CondBranch v - <$> node x - <*> traverse node y + <*> (traverse . traverse . L.buildInfo) f x1 + <*> (traverse . L._2 . traverse . L.buildInfo) f x2 + <*> (traverse . L._2 . traverse . L.buildInfo) f x3 + <*> (traverse . L._2 . traverse . L.buildInfo) f x4 + <*> (traverse . L._2 . traverse . L.buildInfo) f x5 + <*> (traverse . L._2 . traverse . L.buildInfo) f x6 diff --git a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs index 213c97128f9..f194ddda9c9 100644 --- a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs +++ b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs @@ -22,7 +22,6 @@ import Distribution.System (Arch, OS) import Distribution.Types.Benchmark (Benchmark) import Distribution.Types.CondTree (CondTree) import Distribution.Types.ConfVar (ConfVar (..)) -import Distribution.Types.Dependency (Dependency) import Distribution.Types.Executable (Executable) import Distribution.Types.Flag (FlagName, PackageFlag (MkPackageFlag)) import Distribution.Types.ForeignLib (ForeignLib) @@ -49,35 +48,35 @@ genPackageFlags :: Lens' GenericPackageDescription [PackageFlag] genPackageFlags f s = fmap (\x -> s{T.genPackageFlags = x}) (f (T.genPackageFlags s)) {-# INLINE genPackageFlags #-} -condLibrary :: Lens' GenericPackageDescription (Maybe (CondTree ConfVar [Dependency] Library)) +condLibrary :: Lens' GenericPackageDescription (Maybe (CondTree ConfVar Library)) condLibrary f s = fmap (\x -> s{T.condLibrary = x}) (f (T.condLibrary s)) {-# INLINE condLibrary #-} -condSubLibraries :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] Library))] +condSubLibraries :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar Library))] condSubLibraries f s = fmap (\x -> s{T.condSubLibraries = x}) (f (T.condSubLibraries s)) {-# INLINE condSubLibraries #-} -condForeignLibs :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] ForeignLib))] +condForeignLibs :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar ForeignLib))] condForeignLibs f s = fmap (\x -> s{T.condForeignLibs = x}) (f (T.condForeignLibs s)) {-# INLINE condForeignLibs #-} -condExecutables :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] Executable))] +condExecutables :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar Executable))] condExecutables f s = fmap (\x -> s{T.condExecutables = x}) (f (T.condExecutables s)) {-# INLINE condExecutables #-} -condTestSuites :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] TestSuite))] +condTestSuites :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar TestSuite))] condTestSuites f s = fmap (\x -> s{T.condTestSuites = x}) (f (T.condTestSuites s)) {-# INLINE condTestSuites #-} -condBenchmarks :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] Benchmark))] +condBenchmarks :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar Benchmark))] condBenchmarks f s = fmap (\x -> s{T.condBenchmarks = x}) (f (T.condBenchmarks s)) {-# INLINE condBenchmarks #-} allCondTrees :: Applicative f => ( forall a - . CondTree ConfVar [Dependency] a - -> f (CondTree ConfVar [Dependency] a) + . CondTree ConfVar a + -> f (CondTree ConfVar a) ) -> GenericPackageDescription -> f GenericPackageDescription diff --git a/Cabal-tests/tests/NoThunks.hs b/Cabal-tests/tests/NoThunks.hs index a53d404dd1e..323597eea82 100644 --- a/Cabal-tests/tests/NoThunks.hs +++ b/Cabal-tests/tests/NoThunks.hs @@ -129,8 +129,8 @@ deriving via (OnlyCheckWhnf LicenseId) instance NoThunks LicenseId deriving via (OnlyCheckWhnf LicenseExceptionId) instance NoThunks LicenseExceptionId deriving via (CheckFoldableNamed NonEmptySet a) instance NoThunks a => NoThunks (NonEmptySet a) -instance (NoThunks v, NoThunks c, NoThunks a) => NoThunks (CondTree v c a) -instance (NoThunks v, NoThunks c, NoThunks a) => NoThunks (CondBranch v c a) +instance (NoThunks v, NoThunks a) => NoThunks (CondTree v a) +instance (NoThunks v, NoThunks a) => NoThunks (CondBranch v a) instance (NoThunks c) => NoThunks (Condition c) ------------------------------------------------------------------------------- diff --git a/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr b/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr index 3ddf33fb1df..56506e4be74 100644 --- a/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr +++ b/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr @@ -159,25 +159,6 @@ GenericPackageDescription { (mkVersion [2, 4, 0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 0])) - (EarlierVersion - (mkVersion [4, 7]))) - mainLibSet, - Dependency - (PackageName "AC-Vector") - (OrLaterVersion - (mkVersion [2, 3, 0])) - mainLibSet, - Dependency - (PackageName "QuickCheck") - (OrLaterVersion - (mkVersion [2, 4, 0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], @@ -269,25 +250,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 0])) - (EarlierVersion - (mkVersion [4, 7]))) - mainLibSet, - Dependency - (PackageName "AC-Vector") - (OrLaterVersion - (mkVersion [2, 3, 0])) - mainLibSet, - Dependency - (PackageName "QuickCheck") - (OrLaterVersion - (mkVersion [2, 4, 0])) - mainLibSet], condTreeComponents = []}, _×_ (UnqualComponentName "readme") @@ -377,28 +339,5 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 0])) - (EarlierVersion - (mkVersion [4, 7]))) - mainLibSet, - Dependency - (PackageName "AC-Vector") - (OrLaterVersion - (mkVersion [2, 3, 0])) - mainLibSet, - Dependency - (PackageName "QuickCheck") - (OrLaterVersion - (mkVersion [2, 4, 0])) - mainLibSet, - Dependency - (PackageName "markdown-unlit") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/anynone.expr b/Cabal-tests/tests/ParserTests/regressions/anynone.expr index e2504a9be74..633b942dc98 100644 --- a/Cabal-tests/tests/ParserTests/regressions/anynone.expr +++ b/Cabal-tests/tests/ParserTests/regressions/anynone.expr @@ -108,11 +108,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/big-version.expr b/Cabal-tests/tests/ParserTests/regressions/big-version.expr index 4764da0d35e..76cd8efbab2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/big-version.expr +++ b/Cabal-tests/tests/ParserTests/regressions/big-version.expr @@ -105,7 +105,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr b/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr index 6e1c25f7c66..c18e87f3951 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr @@ -125,11 +125,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "ghc-prim") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -211,19 +206,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 10])) - (EarlierVersion - (mkVersion [4, 11]))) - mainLibSet, - Dependency - (PackageName "containers") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -297,11 +279,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Nothing}]}, @@ -379,11 +356,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "HUnit") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -454,7 +426,6 @@ GenericPackageDescription { targetBuildDepends = [], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -538,19 +509,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 10])) - (EarlierVersion - (mkVersion [4, 11]))) - mainLibSet, - Dependency - (PackageName "containers") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -625,11 +583,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -705,11 +658,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Nothing}]}], diff --git a/Cabal-tests/tests/ParserTests/regressions/common.expr b/Cabal-tests/tests/ParserTests/regressions/common.expr index 67e4584eb12..eccc70ea5f2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common.expr @@ -123,11 +123,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "ghc-prim") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], @@ -203,10 +198,5 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "HUnit") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/common2.expr b/Cabal-tests/tests/ParserTests/regressions/common2.expr index 3305120e552..3f967bd20fb 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common2.expr @@ -131,23 +131,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 10])) - (EarlierVersion - (mkVersion [4, 11]))) - mainLibSet, - Dependency - (PackageName "containers") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "ghc-prim") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -221,11 +204,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condSubLibraries = [ @@ -316,23 +294,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 10])) - (EarlierVersion - (mkVersion [4, 11]))) - mainLibSet, - Dependency - (PackageName "containers") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "ghc-prim") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -408,11 +369,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}], condForeignLibs = [], @@ -500,23 +456,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 10])) - (EarlierVersion - (mkVersion [4, 11]))) - mainLibSet, - Dependency - (PackageName "containers") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "HUnit") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -591,11 +530,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -671,11 +605,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -747,7 +676,6 @@ GenericPackageDescription { targetBuildDepends = [], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/common3.expr b/Cabal-tests/tests/ParserTests/regressions/common3.expr index e8fb48890f2..e7c5119b1c3 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common3.expr @@ -123,11 +123,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "ghc-prim") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], @@ -215,22 +210,5 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 10])) - (EarlierVersion - (mkVersion [4, 11]))) - mainLibSet, - Dependency - (PackageName "containers") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "HUnit") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/elif.expr b/Cabal-tests/tests/ParserTests/regressions/elif.expr index 66ce6c0177d..12949a0debd 100644 --- a/Cabal-tests/tests/ParserTests/regressions/elif.expr +++ b/Cabal-tests/tests/ParserTests/regressions/elif.expr @@ -114,7 +114,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -188,11 +187,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condSubLibraries = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/elif2.expr b/Cabal-tests/tests/ParserTests/regressions/elif2.expr index 8e3adc55f10..ac961710014 100644 --- a/Cabal-tests/tests/ParserTests/regressions/elif2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/elif2.expr @@ -114,7 +114,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -188,11 +187,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Just CondNode { @@ -260,7 +254,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -334,11 +327,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Just CondNode { @@ -406,7 +394,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}}]}}]}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr b/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr index ac6faddb538..0a43104f5d6 100644 --- a/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr +++ b/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr @@ -131,15 +131,6 @@ GenericPackageDescription { (mkVersion [4, 4]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (UnionVersionRanges - (LaterVersion - (mkVersion [4, 4])) - (ThisVersion - (mkVersion [4, 4]))) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr b/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr index 83123587f31..7b7997d78e9 100644 --- a/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr +++ b/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr @@ -283,39 +283,6 @@ GenericPackageDescription { (mkVersion [1, 5]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 7])) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "template-haskell") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [2, 8])) - (EarlierVersion - (mkVersion [2, 13]))) - mainLibSet, - Dependency - (PackageName "ghc-prim") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 3])) - (EarlierVersion - (mkVersion [0, 6]))) - mainLibSet, - Dependency - (PackageName "deepseq") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [1, 3])) - (EarlierVersion - (mkVersion [1, 5]))) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -393,15 +360,6 @@ GenericPackageDescription { (mkVersion [0, 9]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "tagged") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 7])) - (EarlierVersion - (mkVersion [0, 9]))) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -489,24 +447,6 @@ GenericPackageDescription { (mkVersion [0, 6]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName - "transformers-compat") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 3])) - (EarlierVersion - (mkVersion [0, 6]))) - mainLibSet, - Dependency - (PackageName "transformers") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 3])) - (EarlierVersion - (mkVersion [0, 6]))) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -579,7 +519,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -652,7 +591,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condSubLibraries = [], @@ -742,19 +680,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "doctest") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 13])) - (EarlierVersion - (mkVersion [0, 14]))) - mainLibSet], condTreeComponents = []}, _×_ (UnqualComponentName @@ -838,18 +763,5 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 6])) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "generics-sop") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr b/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr index 80c5927a1a1..46e1638fcdf 100644 --- a/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr +++ b/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr @@ -403,79 +403,6 @@ GenericPackageDescription { (mkVersion [0, 0, 2]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "dimensions") - (UnionVersionRanges - (ThisVersion (mkVersion [1, 0])) - (LaterVersion - (mkVersion [1, 0]))) - mainLibSet, - Dependency - (PackageName "safe-exceptions") - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 1, 0])) - (LaterVersion - (mkVersion [0, 1, 0]))) - mainLibSet, - Dependency - (PackageName "singletons") - (UnionVersionRanges - (ThisVersion (mkVersion [2, 2])) - (LaterVersion - (mkVersion [2, 2]))) - mainLibSet, - Dependency - (PackageName "text") - (UnionVersionRanges - (ThisVersion - (mkVersion [1, 2, 2])) - (LaterVersion - (mkVersion [1, 2, 2]))) - mainLibSet, - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-cpu")])), - Dependency - (PackageName "hasktorch-ffi-th") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName - "hasktorch-types-th") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -654,7 +581,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -908,16 +834,6 @@ GenericPackageDescription { (UnqualComponentName "hasktorch-gpu")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-gpu")]))], condTreeComponents = [ CondBranch { condBranchCondition = @@ -1102,7 +1018,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Nothing}]}, @@ -2598,100 +2513,6 @@ GenericPackageDescription { "Torch.Sig.Tensor.Random.THC") (ModuleName "Torch.Undefined.Double.Tensor.Random.THC")]}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName - "hasktorch-types-th") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName "dimensions") - (UnionVersionRanges - (ThisVersion (mkVersion [1, 0])) - (LaterVersion - (mkVersion [1, 0]))) - mainLibSet, - Dependency - (PackageName "hasktorch-ffi-th") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName - "hasktorch-types-th") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName "safe-exceptions") - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 1, 0])) - (LaterVersion - (mkVersion [0, 1, 0]))) - mainLibSet, - Dependency - (PackageName "singletons") - (UnionVersionRanges - (ThisVersion (mkVersion [2, 2])) - (LaterVersion - (mkVersion [2, 2]))) - mainLibSet, - Dependency - (PackageName "text") - (UnionVersionRanges - (ThisVersion - (mkVersion [1, 2, 2])) - (LaterVersion - (mkVersion [1, 2, 2]))) - mainLibSet, - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-indef-floating")])), - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-indef-signed")]))], condTreeComponents = [ CondBranch { @@ -2764,7 +2585,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just @@ -4862,16 +4682,6 @@ GenericPackageDescription { "Torch.Sig.Tensor.Random.THC") (ModuleName "Torch.Undefined.Float.Tensor.Random.THC")]}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-indef-unsigned")]))], condTreeComponents = []}}]}, _×_ (UnqualComponentName @@ -6267,124 +6077,6 @@ GenericPackageDescription { "Torch.Sig.Tensor.Random.THC") (ModuleName "Torch.FFI.THC.Double.TensorRandom")]}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName - "hasktorch-types-th") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName "dimensions") - (UnionVersionRanges - (ThisVersion (mkVersion [1, 0])) - (LaterVersion - (mkVersion [1, 0]))) - mainLibSet, - Dependency - (PackageName "hasktorch-ffi-th") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName - "hasktorch-types-th") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName "safe-exceptions") - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 1, 0])) - (LaterVersion - (mkVersion [0, 1, 0]))) - mainLibSet, - Dependency - (PackageName "singletons") - (UnionVersionRanges - (ThisVersion (mkVersion [2, 2])) - (LaterVersion - (mkVersion [2, 2]))) - mainLibSet, - Dependency - (PackageName "text") - (UnionVersionRanges - (ThisVersion - (mkVersion [1, 2, 2])) - (LaterVersion - (mkVersion [1, 2, 2]))) - mainLibSet, - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-indef-floating")])), - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-indef-signed")])), - Dependency - (PackageName - "hasktorch-ffi-thc") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName - "hasktorch-types-thc") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet], condTreeComponents = [ CondBranch { @@ -6457,7 +6149,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just @@ -7854,16 +7545,6 @@ GenericPackageDescription { "Torch.Sig.Tensor.Math.Pointwise.Signed") (ModuleName "Torch.FFI.THC.Int.TensorMathPointwise")]}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-indef-unsigned")]))], condTreeComponents = []}}]}, _×_ (UnqualComponentName @@ -8312,33 +7993,6 @@ GenericPackageDescription { "Torch.Sig.Tensor.Random.THC") (ModuleName "Torch.Undefined.Tensor.Random.THC")]}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName - "hasktorch-signatures-partial") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName "hasktorch-indef") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, _×_ (UnqualComponentName @@ -8798,33 +8452,6 @@ GenericPackageDescription { "Torch.Sig.Tensor.Random.THC") (ModuleName "Torch.Undefined.Tensor.Random.THC")]}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName - "hasktorch-signatures-partial") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet, - Dependency - (PackageName "hasktorch-indef") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, _×_ (UnqualComponentName @@ -9504,33 +9131,6 @@ GenericPackageDescription { (mkVersion [0, 0, 2]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "hasktorch-indef") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName - "hasktorch-signatures-partial") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 0, 1])) - (LaterVersion - (mkVersion [0, 0, 1]))) - (EarlierVersion - (mkVersion [0, 0, 2]))) - mainLibSet], condTreeComponents = []}], condForeignLibs = [], condExecutables = [ @@ -9621,26 +9221,6 @@ GenericPackageDescription { (UnqualComponentName "hasktorch-cpu")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-cpu")]))], condTreeComponents = []}, _×_ (UnqualComponentName @@ -9729,26 +9309,6 @@ GenericPackageDescription { (UnqualComponentName "hasktorch-gpu")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "hasktorch-gpu")]))], condTreeComponents = []}, _×_ (UnqualComponentName @@ -9832,21 +9392,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, _×_ (UnqualComponentName "memcheck") @@ -9929,21 +9474,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condTestSuites = [ _×_ @@ -10141,108 +9671,5 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "QuickCheck") - (UnionVersionRanges - (ThisVersion - (mkVersion [2, 11])) - (LaterVersion - (mkVersion [2, 11]))) - mainLibSet, - Dependency - (PackageName "backprop") - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 2, 5])) - (LaterVersion - (mkVersion [0, 2, 5]))) - mainLibSet, - Dependency - (PackageName "base") - (IntersectVersionRanges - (UnionVersionRanges - (ThisVersion (mkVersion [4, 7])) - (LaterVersion - (mkVersion [4, 7]))) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "dimensions") - (UnionVersionRanges - (ThisVersion (mkVersion [1, 0])) - (LaterVersion - (mkVersion [1, 0]))) - mainLibSet, - Dependency - (PackageName - "ghc-typelits-natnormalise") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "hasktorch") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "hspec") - (UnionVersionRanges - (ThisVersion - (mkVersion [2, 4, 4])) - (LaterVersion - (mkVersion [2, 4, 4]))) - mainLibSet, - Dependency - (PackageName "singletons") - (UnionVersionRanges - (ThisVersion (mkVersion [2, 2])) - (LaterVersion - (mkVersion [2, 2]))) - mainLibSet, - Dependency - (PackageName "mtl") - (UnionVersionRanges - (ThisVersion - (mkVersion [2, 2, 2])) - (LaterVersion - (mkVersion [2, 2, 2]))) - mainLibSet, - Dependency - (PackageName - "microlens-platform") - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 3, 10])) - (LaterVersion - (mkVersion [0, 3, 10]))) - mainLibSet, - Dependency - (PackageName "monad-loops") - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 4, 3])) - (LaterVersion - (mkVersion [0, 4, 3]))) - mainLibSet, - Dependency - (PackageName "time") - (UnionVersionRanges - (ThisVersion - (mkVersion [1, 8, 0])) - (LaterVersion - (mkVersion [1, 8, 0]))) - mainLibSet, - Dependency - (PackageName "transformers") - (UnionVersionRanges - (ThisVersion - (mkVersion [0, 5, 5])) - (LaterVersion - (mkVersion [0, 5, 5]))) - mainLibSet, - Dependency - (PackageName "generic-lens") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr b/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr index 47647f9b9cf..c9c82f12a98 100644 --- a/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr +++ b/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr @@ -110,11 +110,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation.expr b/Cabal-tests/tests/ParserTests/regressions/indentation.expr index 9164dace33a..4e52f7ffa7e 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation.expr @@ -115,7 +115,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation2.expr b/Cabal-tests/tests/ParserTests/regressions/indentation2.expr index 3f7612ef50f..28bc91409bd 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation2.expr @@ -108,7 +108,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation3.expr b/Cabal-tests/tests/ParserTests/regressions/indentation3.expr index 87d3376c648..d6cd560152e 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation3.expr @@ -110,7 +110,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr b/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr index 5fcae0b709b..42d2a3d45df 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr @@ -117,15 +117,6 @@ GenericPackageDescription { (mkVersion [5]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 8])) - (EarlierVersion - (mkVersion [5]))) - mainLibSet], condTreeComponents = []}], condTestSuites = [ _×_ @@ -204,15 +195,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 8])) - (EarlierVersion - (mkVersion [5]))) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -283,7 +265,6 @@ GenericPackageDescription { targetBuildDepends = [], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr b/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr index 44d61d1d795..33462aac3f4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr @@ -139,43 +139,6 @@ GenericPackageDescription { LSubLibName (UnqualComponentName "b")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "lib1") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName "a"), - LSubLibName - (UnqualComponentName "b")])), - Dependency - (PackageName "lib2") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName "c")])), - Dependency - (PackageName "lib3") - (OrLaterVersion (mkVersion [1])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName "d")])), - Dependency - (PackageName "lib4") - (OrLaterVersion (mkVersion [1])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName "a"), - LSubLibName - (UnqualComponentName "b")]))], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr index 876c944b620..404d455c918 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr @@ -116,20 +116,6 @@ GenericPackageDescription { (UnqualComponentName "sublib")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "sublib")]))], condTreeComponents = []}, condSubLibraries = [ _×_ @@ -201,7 +187,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}], condForeignLibs = [], condExecutables = [ @@ -278,15 +263,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "sublib") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, _×_ (UnqualComponentName "demo-b") @@ -366,20 +342,6 @@ GenericPackageDescription { (UnqualComponentName "sublib")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "sublib")]))], condTreeComponents = []}], condTestSuites = [], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr index 14eb64397df..72a8e6cbfc3 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr @@ -116,20 +116,6 @@ GenericPackageDescription { (UnqualComponentName "sublib")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "sublib")]))], condTreeComponents = []}, condSubLibraries = [ _×_ @@ -201,7 +187,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}], condForeignLibs = [], condExecutables = [ @@ -283,20 +268,6 @@ GenericPackageDescription { (UnqualComponentName "sublib")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "sublib")]))], condTreeComponents = []}, _×_ (UnqualComponentName "demo-b") @@ -376,20 +347,6 @@ GenericPackageDescription { (UnqualComponentName "sublib")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "sublib")]))], condTreeComponents = []}], condTestSuites = [], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr index 4d4450a78cb..9f419d98afd 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr @@ -116,20 +116,6 @@ GenericPackageDescription { (UnqualComponentName "sublib")]))], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "issue") - (OrLaterVersion (mkVersion [0])) - (NonEmptySet.fromNonEmpty - (NE.fromList - [ - LSubLibName - (UnqualComponentName - "sublib")]))], condTreeComponents = []}, condSubLibraries = [ _×_ @@ -201,7 +187,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}], condForeignLibs = [], condExecutables = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr index c38bd51f941..514a56d9323 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr @@ -111,15 +111,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "freetype") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "freetype") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-774.expr b/Cabal-tests/tests/ParserTests/regressions/issue-774.expr index 31ea274249e..84baff7b936 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-774.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-774.expr @@ -117,7 +117,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr b/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr index bf3803b9417..96095055228 100644 --- a/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr +++ b/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr @@ -161,20 +161,6 @@ GenericPackageDescription { (mkVersion [2, 12, 6, 1])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (UnionVersionRanges - (MajorBoundVersion - (mkVersion [4, 11, 1, 0])) - (MajorBoundVersion - (mkVersion [4, 12, 0, 0]))) - mainLibSet, - Dependency - (PackageName "QuickCheck") - (MajorBoundVersion - (mkVersion [2, 12, 6, 1])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], @@ -294,51 +280,6 @@ GenericPackageDescription { (mkVersion [1, 2, 3, 1])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (UnionVersionRanges - (MajorBoundVersion - (mkVersion [4, 11, 1, 0])) - (MajorBoundVersion - (mkVersion [4, 12, 0, 0]))) - mainLibSet, - Dependency - (PackageName - "jaeger-flamegraph") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "bytestring") - (MajorBoundVersion - (mkVersion [0, 10, 8, 2])) - mainLibSet, - Dependency - (PackageName "containers") - (MajorBoundVersion - (mkVersion [0, 6, 0, 1])) - mainLibSet, - Dependency - (PackageName "extra") - (MajorBoundVersion - (mkVersion [1, 6, 13])) - mainLibSet, - Dependency - (PackageName "aeson") - (MajorBoundVersion - (mkVersion [1, 4, 1, 0])) - mainLibSet, - Dependency - (PackageName - "optparse-applicative") - (MajorBoundVersion - (mkVersion [0, 14, 3, 0])) - mainLibSet, - Dependency - (PackageName "text") - (MajorBoundVersion - (mkVersion [1, 2, 3, 1])) - mainLibSet], condTreeComponents = []}], condTestSuites = [ _×_ @@ -447,34 +388,5 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (UnionVersionRanges - (MajorBoundVersion - (mkVersion [4, 11, 1, 0])) - (MajorBoundVersion - (mkVersion [4, 12, 0, 0]))) - mainLibSet, - Dependency - (PackageName - "jaeger-flamegraph") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "tasty") - (MajorBoundVersion - (mkVersion [1, 1, 0, 4])) - mainLibSet, - Dependency - (PackageName "tasty-hspec") - (MajorBoundVersion - (mkVersion [1, 1, 5])) - mainLibSet, - Dependency - (PackageName "tasty-quickcheck") - (MajorBoundVersion - (mkVersion [0, 10])) - mainLibSet], condTreeComponents = []}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr b/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr index e8d07f99d94..8179e0b4c5c 100644 --- a/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr @@ -137,31 +137,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "containers") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "deepseq") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "transformers") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "filepath") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "directory") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr b/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr index 15d01d4703d..917f0061cd8 100644 --- a/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr +++ b/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr @@ -130,31 +130,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "containers") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "deepseq") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "transformers") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "filepath") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "directory") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/libpq1.expr b/Cabal-tests/tests/ParserTests/regressions/libpq1.expr index e3f93b194a4..ca27062bbbf 100644 --- a/Cabal-tests/tests/ParserTests/regressions/libpq1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/libpq1.expr @@ -215,23 +215,6 @@ GenericPackageDescription { (mkVersion [0, 11]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 3])) - (EarlierVersion - (mkVersion [4, 13]))) - mainLibSet, - Dependency - (PackageName "bytestring") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 9, 1, 0])) - (EarlierVersion - (mkVersion [0, 11]))) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -309,15 +292,6 @@ GenericPackageDescription { (mkVersion [2, 8]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [2, 4, 2, 0])) - (EarlierVersion - (mkVersion [2, 8]))) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -396,15 +370,6 @@ GenericPackageDescription { (mkVersion [2, 7]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [2, 2, 0, 2])) - (EarlierVersion - (mkVersion [2, 7]))) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -482,7 +447,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just CondNode { @@ -550,7 +514,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -620,7 +583,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just CondNode { @@ -688,7 +650,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -758,7 +719,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}}]}}]}, diff --git a/Cabal-tests/tests/ParserTests/regressions/libpq2.expr b/Cabal-tests/tests/ParserTests/regressions/libpq2.expr index 0e0403dd8c0..22622665664 100644 --- a/Cabal-tests/tests/ParserTests/regressions/libpq2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/libpq2.expr @@ -220,23 +220,6 @@ GenericPackageDescription { (mkVersion [0, 11]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 3])) - (EarlierVersion - (mkVersion [4, 13]))) - mainLibSet, - Dependency - (PackageName "bytestring") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 9, 1, 0])) - (EarlierVersion - (mkVersion [0, 11]))) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -314,15 +297,6 @@ GenericPackageDescription { (mkVersion [2, 8]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [2, 4, 2, 0])) - (EarlierVersion - (mkVersion [2, 8]))) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -401,15 +375,6 @@ GenericPackageDescription { (mkVersion [2, 7]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "Win32") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [2, 2, 0, 2])) - (EarlierVersion - (mkVersion [2, 7]))) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -484,7 +449,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just CondNode { @@ -552,7 +516,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -622,7 +585,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Just CondNode { @@ -690,7 +652,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -760,7 +721,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}}]}}]}, diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr index 1b9640c92a5..2266f128631 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr @@ -147,19 +147,6 @@ GenericPackageDescription { (ModuleName "Str.ByteString")], includeRequiresRn = DefaultRenaming}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "str-string") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "str-bytestring") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condTestSuites = [], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr index decc098f78f..f025e7b6d40 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr @@ -147,19 +147,6 @@ GenericPackageDescription { (ModuleName "Str.ByteString")], includeRequiresRn = DefaultRenaming}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "str-string") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "str-bytestring") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condTestSuites = [], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr index e5278af9017..98e1eac5016 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr @@ -130,19 +130,6 @@ GenericPackageDescription { [ModuleName "Foo"], includeRequiresRn = DefaultRenaming}}]}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "str-string") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "str-bytestring") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condTestSuites = [], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/monad-param.expr b/Cabal-tests/tests/ParserTests/regressions/monad-param.expr index 8ab441164a5..5193599b8ec 100644 --- a/Cabal-tests/tests/ParserTests/regressions/monad-param.expr +++ b/Cabal-tests/tests/ParserTests/regressions/monad-param.expr @@ -141,19 +141,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "mtl") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "stm") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr b/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr index d9b82eb2aec..c7a7bc8c2e6 100644 --- a/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr @@ -110,11 +110,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [ _×_ @@ -191,11 +186,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condForeignLibs = [], condExecutables = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/noVersion.expr b/Cabal-tests/tests/ParserTests/regressions/noVersion.expr index 1384c3eef4a..caebbbd39d1 100644 --- a/Cabal-tests/tests/ParserTests/regressions/noVersion.expr +++ b/Cabal-tests/tests/ParserTests/regressions/noVersion.expr @@ -110,11 +110,6 @@ GenericPackageDescription { (EarlierVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "bad-package") - (EarlierVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr b/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr index 0bbfcbbbbac..da94a75b495 100644 --- a/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr +++ b/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr @@ -121,7 +121,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -191,7 +190,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condSubLibraries = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/shake.expr b/Cabal-tests/tests/ParserTests/regressions/shake.expr index 46b3bfa2729..1ba7e9a569f 100644 --- a/Cabal-tests/tests/ParserTests/regressions/shake.expr +++ b/Cabal-tests/tests/ParserTests/regressions/shake.expr @@ -388,80 +388,6 @@ GenericPackageDescription { (mkVersion [1, 1])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion - (mkVersion [4, 5])) - mainLibSet, - Dependency - (PackageName "directory") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "hashable") - (OrLaterVersion - (mkVersion [1, 1, 2, 3])) - mainLibSet, - Dependency - (PackageName "binary") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "filepath") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "process") - (OrLaterVersion - (mkVersion [1, 1])) - mainLibSet, - Dependency - (PackageName - "unordered-containers") - (OrLaterVersion - (mkVersion [0, 2, 1])) - mainLibSet, - Dependency - (PackageName "bytestring") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "utf8-string") - (OrLaterVersion - (mkVersion [0, 3])) - mainLibSet, - Dependency - (PackageName "time") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "random") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "js-jquery") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "js-flot") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "transformers") - (OrLaterVersion - (mkVersion [0, 2])) - mainLibSet, - Dependency - (PackageName "extra") - (OrLaterVersion - (mkVersion [1, 4, 8])) - mainLibSet, - Dependency - (PackageName "deepseq") - (OrLaterVersion - (mkVersion [1, 1])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -531,7 +457,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -605,11 +530,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "old-time") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Just @@ -678,7 +598,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -753,12 +672,6 @@ GenericPackageDescription { (mkVersion [2, 5, 1])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (OrLaterVersion - (mkVersion [2, 5, 1])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}}, CondBranch { @@ -833,11 +746,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condSubLibraries = [], @@ -1088,86 +996,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion (mkVersion [4])) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "directory") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "hashable") - (OrLaterVersion - (mkVersion [1, 1, 2, 3])) - mainLibSet, - Dependency - (PackageName "binary") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "filepath") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "process") - (OrLaterVersion - (mkVersion [1, 1])) - mainLibSet, - Dependency - (PackageName - "unordered-containers") - (OrLaterVersion - (mkVersion [0, 2, 1])) - mainLibSet, - Dependency - (PackageName "bytestring") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "utf8-string") - (OrLaterVersion - (mkVersion [0, 3])) - mainLibSet, - Dependency - (PackageName "time") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "random") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "js-jquery") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "js-flot") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "transformers") - (OrLaterVersion - (mkVersion [0, 2])) - mainLibSet, - Dependency - (PackageName "extra") - (OrLaterVersion - (mkVersion [1, 4, 8])) - mainLibSet, - Dependency - (PackageName "deepseq") - (OrLaterVersion - (mkVersion [1, 1])) - mainLibSet, - Dependency - (PackageName "primitive") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -1236,7 +1064,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -1304,7 +1131,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -1375,11 +1201,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "old-time") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Just @@ -1445,7 +1266,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -1517,12 +1337,6 @@ GenericPackageDescription { (mkVersion [2, 5, 1])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (OrLaterVersion - (mkVersion [2, 5, 1])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}}, CondBranch { @@ -1594,11 +1408,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}], condTestSuites = [ @@ -1893,87 +1702,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion (mkVersion [4])) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "directory") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "hashable") - (OrLaterVersion - (mkVersion [1, 1, 2, 3])) - mainLibSet, - Dependency - (PackageName "binary") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "filepath") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "process") - (OrLaterVersion - (mkVersion [1, 1])) - mainLibSet, - Dependency - (PackageName - "unordered-containers") - (OrLaterVersion - (mkVersion [0, 2, 1])) - mainLibSet, - Dependency - (PackageName "bytestring") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "utf8-string") - (OrLaterVersion - (mkVersion [0, 3])) - mainLibSet, - Dependency - (PackageName "time") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "random") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "js-jquery") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "js-flot") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "transformers") - (OrLaterVersion - (mkVersion [0, 2])) - mainLibSet, - Dependency - (PackageName "deepseq") - (OrLaterVersion - (mkVersion [1, 1])) - mainLibSet, - Dependency - (PackageName "extra") - (OrLaterVersion - (mkVersion [1, 4, 8])) - mainLibSet, - Dependency - (PackageName "QuickCheck") - (OrLaterVersion - (mkVersion [2, 0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -2044,7 +1772,6 @@ GenericPackageDescription { targetBuildDepends = [], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -2116,7 +1843,6 @@ GenericPackageDescription { targetBuildDepends = [], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}, CondBranch { @@ -2188,7 +1914,6 @@ GenericPackageDescription { targetBuildDepends = [], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -2263,11 +1988,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "old-time") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}, condBranchIfFalse = Just @@ -2337,7 +2057,6 @@ GenericPackageDescription { targetBuildDepends = [], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [], condTreeComponents = [ CondBranch { condBranchCondition = @@ -2413,12 +2132,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (OrLaterVersion - (mkVersion [2, 5, 1])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}}, CondBranch { @@ -2494,11 +2207,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "unix") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}, condBranchIfFalse = Nothing}]}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr index d3a3797c1c9..0b673488e8c 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr @@ -104,7 +104,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr index a9c2370712b..909ef7280b2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr @@ -108,7 +108,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr index 83d37fc29d5..22e97da23a1 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr @@ -108,7 +108,6 @@ GenericPackageDescription { customFieldsBI = [], targetBuildDepends = [], mixins = []}}, - condTreeConstraints = [], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr b/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr index 5cd098d5a94..4c9d8cc8467 100644 --- a/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr +++ b/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr @@ -185,56 +185,6 @@ GenericPackageDescription { (mkVersion [0, 11]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [4, 4])) - (EarlierVersion - (mkVersion [5]))) - mainLibSet, - Dependency - (PackageName "template-haskell") - (EarlierVersion - (mkVersion [2, 10])) - mainLibSet, - Dependency - (PackageName "th-lift") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "containers") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 4])) - (EarlierVersion - (mkVersion [0, 6]))) - mainLibSet, - Dependency - (PackageName "vector") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 9])) - (EarlierVersion - (mkVersion [0, 11]))) - mainLibSet, - Dependency - (PackageName "text") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 11])) - (EarlierVersion - (mkVersion [1, 3]))) - mainLibSet, - Dependency - (PackageName "bytestring") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 9])) - (EarlierVersion - (mkVersion [0, 11]))) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], @@ -365,61 +315,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "template-haskell") - (EarlierVersion - (mkVersion [2, 10])) - mainLibSet, - Dependency - (PackageName "containers") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 4])) - (EarlierVersion - (mkVersion [0, 6]))) - mainLibSet, - Dependency - (PackageName "vector") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 9])) - (EarlierVersion - (mkVersion [0, 11]))) - mainLibSet, - Dependency - (PackageName "text") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 11])) - (EarlierVersion - (mkVersion [1, 2]))) - mainLibSet, - Dependency - (PackageName "bytestring") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [0, 9])) - (EarlierVersion - (mkVersion [0, 11]))) - mainLibSet, - Dependency - (PackageName - "th-lift-instances") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "QuickCheck") - (IntersectVersionRanges - (OrLaterVersion - (mkVersion [2, 6])) - (EarlierVersion - (mkVersion [2, 8]))) - mainLibSet], condTreeComponents = []}, _×_ (UnqualComponentName "doctests") @@ -507,25 +402,6 @@ GenericPackageDescription { mainLibSet], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (OrLaterVersion (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "directory") - (OrLaterVersion - (mkVersion [1, 0])) - mainLibSet, - Dependency - (PackageName "doctest") - (OrLaterVersion - (mkVersion [0, 9, 1])) - mainLibSet, - Dependency - (PackageName "filepath") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = [ CondBranch { condBranchCondition = @@ -596,7 +472,6 @@ GenericPackageDescription { targetBuildDepends = [], mixins = []}, testCodeGenerators = []}, - condTreeConstraints = [], condTreeComponents = []}, condBranchIfFalse = Nothing}]}], condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/version-sets.expr b/Cabal-tests/tests/ParserTests/regressions/version-sets.expr index 6242af7cb32..5c4248a9530 100644 --- a/Cabal-tests/tests/ParserTests/regressions/version-sets.expr +++ b/Cabal-tests/tests/ParserTests/regressions/version-sets.expr @@ -194,71 +194,6 @@ GenericPackageDescription { (mkVersion [2, 2, 0, 0]))) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "network") - (MajorBoundVersion - (mkVersion [0])) - mainLibSet, - Dependency - (PackageName "base") - (ThisVersion (mkVersion [1])) - mainLibSet, - Dependency - (PackageName "base") - (ThisVersion (mkVersion [1])) - mainLibSet, - Dependency - (PackageName "base") - (UnionVersionRanges - (ThisVersion (mkVersion [1])) - (ThisVersion (mkVersion [2]))) - mainLibSet, - Dependency - (PackageName "base") - (ThisVersion (mkVersion [1, 2])) - mainLibSet, - Dependency - (PackageName "base") - (UnionVersionRanges - (ThisVersion (mkVersion [1, 2])) - (ThisVersion - (mkVersion [3, 4]))) - mainLibSet, - Dependency - (PackageName "ghc") - (UnionVersionRanges - (ThisVersion - (mkVersion [8, 6, 3])) - (UnionVersionRanges - (ThisVersion - (mkVersion [8, 4, 4])) - (UnionVersionRanges - (ThisVersion - (mkVersion [8, 2, 2])) - (UnionVersionRanges - (ThisVersion - (mkVersion [8, 0, 2])) - (UnionVersionRanges - (ThisVersion - (mkVersion [7, 10, 3])) - (UnionVersionRanges - (ThisVersion - (mkVersion [7, 8, 4])) - (UnionVersionRanges - (ThisVersion - (mkVersion [7, 6, 3])) - (ThisVersion - (mkVersion [7, 4, 2]))))))))) - mainLibSet, - Dependency - (PackageName "Cabal") - (UnionVersionRanges - (MajorBoundVersion - (mkVersion [2, 4, 1, 1])) - (MajorBoundVersion - (mkVersion [2, 2, 0, 0]))) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr b/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr index 3c9821a1185..f80e366dd84 100644 --- a/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr +++ b/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr @@ -132,16 +132,6 @@ GenericPackageDescription { (mkVersion [0, 1, 0, 0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (EarlierVersion (mkVersion [5])) - mainLibSet, - Dependency - (PackageName "str-sig") - (OrLaterVersion - (mkVersion [0, 1, 0, 0])) - mainLibSet], condTreeComponents = []}, condSubLibraries = [], condForeignLibs = [], @@ -227,20 +217,6 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0])) mainLibSet], mixins = []}}, - condTreeConstraints = [ - Dependency - (PackageName "base") - (EarlierVersion (mkVersion [5])) - mainLibSet, - Dependency - (PackageName "str-string") - (OrLaterVersion - (mkVersion [0, 1, 0, 0])) - mainLibSet, - Dependency - (PackageName "wl-pprint-indef") - (OrLaterVersion (mkVersion [0])) - mainLibSet], condTreeComponents = []}], condTestSuites = [], condBenchmarks = []} diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs index f8cb6cd3651..8f4ea0d21dc 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs @@ -29,7 +29,7 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion md5CheckGenericPackageDescription proxy = md5Check proxy - 0xc039c6741dead5203ad2b33bd3bf4dc8 + 0x45c1433a985995ea240b1dd558a04eb1 md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion md5CheckLocalBuildInfo proxy = md5Check proxy diff --git a/Cabal-tree-diff/src/Data/TreeDiff/Instances/Cabal.hs b/Cabal-tree-diff/src/Data/TreeDiff/Instances/Cabal.hs index 3f2f2aca9b0..83b0073cf7d 100644 --- a/Cabal-tree-diff/src/Data/TreeDiff/Instances/Cabal.hs +++ b/Cabal-tree-diff/src/Data/TreeDiff/Instances/Cabal.hs @@ -41,8 +41,8 @@ import qualified Distribution.Compat.NonEmptySet as NES ------------------------------------------------------------------------------- instance (Eq a, Show a) => ToExpr (Condition a) where toExpr = defaultExprViaShow -instance (Show a, ToExpr b, ToExpr c, Show b, Show c, Eq a, Eq c, Eq b) => ToExpr (CondTree a b c) -instance (Show a, ToExpr b, ToExpr c, Show b, Show c, Eq a, Eq c, Eq b) => ToExpr (CondBranch a b c) +instance (Show a, ToExpr c, Show c, Eq a, Eq c) => ToExpr (CondTree a c) +instance (Show a, ToExpr c, Show c, Eq a, Eq c) => ToExpr (CondBranch a c) instance (ToExpr a) => ToExpr (NubList a) instance ToExpr a => ToExpr (NES.NonEmptySet a) where toExpr xs = App "NonEmptySet.fromNonEmpty" [toExpr $ NES.toNonEmpty xs] diff --git a/Cabal/src/Distribution/PackageDescription/Check.hs b/Cabal/src/Distribution/PackageDescription/Check.hs index f9fb9ec4a3d..2cafe6d50c3 100644 --- a/Cabal/src/Distribution/PackageDescription/Check.hs +++ b/Cabal/src/Distribution/PackageDescription/Check.hs @@ -86,6 +86,8 @@ import qualified System.FilePath.Windows as FilePath.Windows (isValid) import qualified Data.Set as Set import qualified Distribution.Utils.ShortText as ShortText +import qualified Distribution.Compat.Lens as L +import qualified Distribution.Types.BuildInfo.Lens as L import qualified Distribution.Types.GenericPackageDescription.Lens as L import Control.Monad @@ -355,11 +357,11 @@ checkGenericPackageDescription -- once, rather than re-checking in every conditional branch. let allModuleNames = Set.fromList $ - maybe [] (explicitLibModules . fst . ignoreConditions) condLibrary_ - ++ concatMap (explicitLibModules . fst . ignoreConditions . snd) condSubLibraries_ - ++ concatMap (exeModules . fst . ignoreConditions . snd) condExecutables_ - ++ concatMap (testModules . fst . ignoreConditions . snd) condTestSuites_ - ++ concatMap (benchmarkModules . fst . ignoreConditions . snd) condBenchmarks_ + maybe [] (explicitLibModules . ignoreConditions) condLibrary_ + ++ concatMap (explicitLibModules . ignoreConditions . snd) condSubLibraries_ + ++ concatMap (exeModules . ignoreConditions . snd) condExecutables_ + ++ concatMap (testModules . ignoreConditions . snd) condTestSuites_ + ++ concatMap (benchmarkModules . ignoreConditions . snd) condBenchmarks_ mapM_ (\m -> checkPackageFileNamesWithGlob PathKindFile (toFilePath m)) allModuleNames where -- todo is this caught at parse time? @@ -950,14 +952,14 @@ wrapParseWarning fp pw = PackageDistSuspicious (ParseWarning fp pw) -- each of those branch will be checked one by one. extractAssocDeps :: UnqualComponentName -- Name of the target library - -> CondTree ConfVar [Dependency] Library + -> CondTree ConfVar Library -> AssocDep extractAssocDeps n ct = let a = ignoreConditions ct in -- Merging is fine here, remember the specific -- library dependencies will be checked branch -- by branch. - (n, snd a) + (n, L.view L.targetBuildDepends a) -- | August 2022: this function is an oddity due to the historical -- GenericPackageDescription/PackageDescription split (check @@ -993,8 +995,8 @@ pd2gpd pd = gpd } -- From target to simple, unconditional CondTree. - t2c :: a -> CondTree ConfVar [Dependency] a - t2c a = CondNode a [] [] + t2c :: a -> CondTree ConfVar a + t2c a = CondNode a [] -- From named target to unconditional CondTree. Notice we have -- a function to extract the name *and* a function to modify @@ -1004,7 +1006,7 @@ pd2gpd pd = gpd :: (a -> UnqualComponentName) -> (a -> a) -> a - -> (UnqualComponentName, CondTree ConfVar [Dependency] a) + -> (UnqualComponentName, CondTree ConfVar a) t2cName nf mf a = (nf a, t2c . mf $ a) ln :: Library -> UnqualComponentName diff --git a/Cabal/src/Distribution/PackageDescription/Check/Conditional.hs b/Cabal/src/Distribution/PackageDescription/Check/Conditional.hs index 540874c685c..5a18e39c4ee 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Conditional.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Conditional.hs @@ -23,7 +23,6 @@ import Prelude () import Distribution.Compiler import Distribution.ModuleName (ModuleName) -import Distribution.Package import Distribution.PackageDescription import Distribution.PackageDescription.Check.Monad import Distribution.System @@ -63,21 +62,18 @@ annotateCondTree . (Eq a, Monoid a) => [PackageFlag] -- User flags. -> TargetAnnotation a - -> CondTree ConfVar [Dependency] a - -> CondTree ConfVar [Dependency] (TargetAnnotation a) -annotateCondTree fs ta (CondNode a c bs) = + -> CondTree ConfVar a + -> CondTree ConfVar (TargetAnnotation a) +annotateCondTree fs ta (CondNode a bs) = let ta' = updateTargetAnnotation a ta bs' = map (annotateBranch ta') bs bs'' = crossAnnotateBranches defTrueFlags bs' - in CondNode ta' c bs'' + in CondNode ta' bs'' where annotateBranch :: TargetAnnotation a - -> CondBranch ConfVar [Dependency] a - -> CondBranch - ConfVar - [Dependency] - (TargetAnnotation a) + -> CondBranch ConfVar a + -> CondBranch ConfVar (TargetAnnotation a) annotateBranch wta (CondBranch k t mf) = let uf = isPkgFlagCond k wta' = wta{taPackageFlag = taPackageFlag wta || uf} @@ -119,13 +115,13 @@ crossAnnotateBranches :: forall a . (Eq a, Monoid a) => [PackageFlag] -- `default: true` flags. - -> [CondBranch ConfVar [Dependency] (TargetAnnotation a)] - -> [CondBranch ConfVar [Dependency] (TargetAnnotation a)] + -> [CondBranch ConfVar (TargetAnnotation a)] + -> [CondBranch ConfVar (TargetAnnotation a)] crossAnnotateBranches fs bs = map crossAnnBranch bs where crossAnnBranch - :: CondBranch ConfVar [Dependency] (TargetAnnotation a) - -> CondBranch ConfVar [Dependency] (TargetAnnotation a) + :: CondBranch ConfVar (TargetAnnotation a) + -> CondBranch ConfVar (TargetAnnotation a) crossAnnBranch wr = let rs = filter (/= wr) bs @@ -133,24 +129,23 @@ crossAnnotateBranches fs bs = map crossAnnBranch bs in updateTargetAnnBranch (mconcat ts) wr - realiseBranch :: CondBranch ConfVar [Dependency] (TargetAnnotation a) -> Maybe a + realiseBranch :: CondBranch ConfVar (TargetAnnotation a) -> Maybe a realiseBranch b = let -- We are only interested in True by default package flags. realiseBranchFunction :: ConfVar -> Either ConfVar Bool realiseBranchFunction (PackageFlag n) | elem n (map flagName fs) = Right True realiseBranchFunction _ = Right False - ms = simplifyCondBranch realiseBranchFunction (fmap taTarget b) in - fmap snd ms + simplifyCondBranch realiseBranchFunction (fmap taTarget b) updateTargetAnnBranch :: a - -> CondBranch ConfVar [Dependency] (TargetAnnotation a) - -> CondBranch ConfVar [Dependency] (TargetAnnotation a) + -> CondBranch ConfVar (TargetAnnotation a) + -> CondBranch ConfVar (TargetAnnotation a) updateTargetAnnBranch a (CondBranch k t mt) = - let updateTargetAnnTree (CondNode ka c wbs) = - (CondNode (updateTargetAnnotation a ka) c wbs) + let updateTargetAnnTree (CondNode ka wbs) = + (CondNode (updateTargetAnnotation a ka) wbs) in CondBranch k (updateTargetAnnTree t) (updateTargetAnnTree <$> mt) -- | A conditional target is a library, exe, benchmark etc., destructured @@ -165,7 +160,7 @@ checkCondTarget -- Naming function (some targets -- need to have their name -- spoonfed to them. - -> (UnqualComponentName, CondTree ConfVar [Dependency] a) + -> (UnqualComponentName, CondTree ConfVar a) -- Target name/condtree. -> CheckM m () checkCondTarget fs cf nf (unqualName, ct) = @@ -174,9 +169,9 @@ checkCondTarget fs cf nf (unqualName, ct) = -- Walking the tree. Remember that CondTree is not a binary -- tree but a /rose/tree. wTree - :: CondTree ConfVar [Dependency] (TargetAnnotation a) + :: CondTree ConfVar (TargetAnnotation a) -> CheckM m () - wTree (CondNode ta _ bs) + wTree (CondNode ta bs) -- There are no branches ([] == True) *or* every branch -- is “simple” (i.e. missing a 'condBranchIfFalse' part). -- This is convenient but not necessarily correct in all @@ -192,13 +187,13 @@ checkCondTarget fs cf nf (unqualName, ct) = mapM_ wBranch bs isSimple - :: CondBranch ConfVar [Dependency] (TargetAnnotation a) + :: CondBranch ConfVar (TargetAnnotation a) -> Bool isSimple (CondBranch _ _ Nothing) = True isSimple (CondBranch _ _ (Just _)) = False wBranch - :: CondBranch ConfVar [Dependency] (TargetAnnotation a) + :: CondBranch ConfVar (TargetAnnotation a) -> CheckM m () wBranch (CondBranch k t mf) = do checkCondVars k @@ -239,15 +234,16 @@ checkDuplicateModules pkg = checkExe = checkDups "executable" exeModules checkTest = checkDups "test suite" testModules checkBench = checkDups "benchmark" benchmarkModules - checkDups :: String -> (a -> [ModuleName]) -> CondTree v c a -> [PackageCheck] + checkDups :: String -> (a -> [ModuleName]) -> CondTree v a -> [PackageCheck] checkDups s getModules t = let sumPair (x, x') (y, y') = (x + x' :: Int, y + y' :: Int) mergePair (x, x') (y, y') = (x + x', max y y') maxPair (x, x') (y, y') = (max x x', max y y') + libMap :: Map ModuleName (Int, Int) libMap = foldCondTree Map.empty - (\(_, v) -> Map.fromListWith sumPair . map (,(1, 1)) $ getModules v) + (\v -> Map.fromListWith sumPair . map (,(1, 1)) $ getModules v) (Map.unionWith mergePair) -- if a module may occur in nonexclusive branches count it twice strictly and once loosely. (Map.unionWith maxPair) -- a module occurs the max of times it might appear in exclusive branches t diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs b/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs index 72d0b8193e3..f150235631f 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs @@ -42,6 +42,9 @@ import Distribution.Solver.Modular.Package import Distribution.Solver.Modular.Tree import Distribution.Solver.Modular.Version +import qualified Distribution.Compat.Lens as L +import qualified Distribution.Types.BuildInfo.Lens as L + -- | Convert both the installed package index and the source package -- index into one uniform solver index. -- @@ -182,7 +185,7 @@ convGPD os arch cinfo constraints strfl solveExes pn conv :: Monoid a => Component -> (a -> BuildInfo) -> DependencyReason PN -> - CondTree ConfVar [Dependency] a -> FlaggedDeps PN + CondTree ConfVar a -> FlaggedDeps PN conv comp getInfo dr = convCondTree M.empty dr pkg os arch cinfo pn fds comp getInfo solveExes . addBuildableCondition getInfo @@ -251,7 +254,7 @@ testConditionForComponent :: OS -> CompilerInfo -> [LabeledPackageConstraint] -> (a -> Bool) - -> CondTree ConfVar [Dependency] a + -> CondTree ConfVar a -> Maybe Bool testConditionForComponent os arch cinfo constraints p tree = case go $ extractCondition p tree of @@ -329,8 +332,8 @@ convCondTree :: Map FlagName Bool -> DependencyReason PN -> PackageDescription - Component -> (a -> BuildInfo) -> SolveExecutables -> - CondTree ConfVar [Dependency] a -> FlaggedDeps PN -convCondTree flags dr pkg os arch cinfo pn fds comp getInfo solveExes@(SolveExecutables solveExes') (CondNode info ds branches) = + CondTree ConfVar a -> FlaggedDeps PN +convCondTree flags dr pkg os arch cinfo pn fds comp getInfo solveExes@(SolveExecutables solveExes') (CondNode info branches) = -- Merge all library and build-tool dependencies at every level in -- the tree of flagged dependencies. Otherwise 'extractCommon' -- could create duplicate dependencies, and the number of @@ -338,7 +341,7 @@ convCondTree flags dr pkg os arch cinfo pn fds comp getInfo solveExes@(SolveExec -- of the tree. mergeSimpleDeps $ [ D.Simple singleDep comp - | dep <- ds + | dep <- L.view (L.targetBuildDepends) (getInfo info) , singleDep <- convLibDeps dr dep ] -- unconditional package dependencies ++ L.map (\e -> D.Simple (LDep dr (Ext e)) comp) (allExtensions bi) -- unconditional extension dependencies @@ -461,7 +464,7 @@ convBranch :: Map FlagName Bool -> Component -> (a -> BuildInfo) -> SolveExecutables - -> CondBranch ConfVar [Dependency] a + -> CondBranch ConfVar a -> FlaggedDeps PN convBranch flags dr pkg os arch cinfo pn fds comp getInfo solveExes (CondBranch c' t' mf') = go c' diff --git a/cabal-install/parser-tests/Tests/ParserTests.hs b/cabal-install/parser-tests/Tests/ParserTests.hs index df144f3d1f9..78d864ef744 100644 --- a/cabal-install/parser-tests/Tests/ParserTests.hs +++ b/cabal-install/parser-tests/Tests/ParserTests.hs @@ -99,18 +99,18 @@ testPackages :: Assertion testPackages = do let expected = [".", "packages/packages.cabal"] (config, legacy) <- readConfigDefault "packages" - assertConfigEquals expected config legacy (projectPackages . condTreeData) + assertConfigEquals expected config legacy (projectPackages . snd . condTreeData) testOptionalPackages :: Assertion testOptionalPackages = do let expected = [".", "packages/packages.cabal"] (config, legacy) <- readConfigDefault "optional-packages" - assertConfigEquals expected config legacy (projectPackagesOptional . condTreeData) + assertConfigEquals expected config legacy (projectPackagesOptional . snd . condTreeData) testSourceRepoList :: Assertion testSourceRepoList = do (config, legacy) <- readConfigDefault "source-repository-packages" - assertConfigEquals expected config legacy (projectPackagesRepo . condTreeData) + assertConfigEquals expected config legacy (projectPackagesRepo . snd . condTreeData) where expected = [ SourceRepositoryPackage @@ -134,7 +134,7 @@ testSourceRepoList = do testExtraPackages :: Assertion testExtraPackages = do (config, legacy) <- readConfigDefault "extra-packages" - assertConfigEquals expected config legacy (projectPackagesNamed . condTreeData) + assertConfigEquals expected config legacy (projectPackagesNamed . snd . condTreeData) where expected = [ PackageVersionConstraint (mkPackageName "a") (OrLaterVersion (mkVersion [0])) @@ -144,7 +144,7 @@ testExtraPackages = do testProjectConfigBuildOnly :: Assertion testProjectConfigBuildOnly = do (config, legacy) <- readConfigDefault "project-config-build-only" - assertConfigEquals expected config legacy (projectConfigBuildOnly . condTreeData) + assertConfigEquals expected config legacy (projectConfigBuildOnly . snd . condTreeData) where expected = ProjectConfigBuildOnly{..} projectConfigVerbosity = toFlag (mkVerbosityFlags Verbose) @@ -177,7 +177,7 @@ testProjectConfigBuildOnly = do testProjectConfigShared :: Assertion testProjectConfigShared = do (config, legacy) <- readConfigDefault "project-config-shared" - assertConfigEquals expected config legacy (projectConfigShared . condTreeData) + assertConfigEquals expected config legacy (projectConfigShared . snd . condTreeData) where expected = ProjectConfigShared{..} projectConfigDistDir = toFlag "something" @@ -234,7 +234,7 @@ testProjectConfigShared = do testInstallDirs :: Assertion testInstallDirs = do (config, legacy) <- readConfigDefault "install-dirs" - assertConfigEquals expected config legacy (projectConfigInstallDirs . projectConfigShared . condTreeData) + assertConfigEquals expected config legacy (projectConfigInstallDirs . projectConfigShared . snd . condTreeData) where expected = InstallDirs @@ -259,9 +259,9 @@ testInstallDirs = do testRemoteRepos :: Assertion testRemoteRepos = do (config, legacy) <- readConfigDefault "remote-repos" - let actualRemoteRepos = (fromNubList . projectConfigRemoteRepos . projectConfigShared . condTreeData) config + let actualRemoteRepos = (fromNubList . projectConfigRemoteRepos . projectConfigShared . snd . condTreeData) config assertBool "Expected RemoteRepos do not match parsed values" $ compareLists expected actualRemoteRepos compareRemoteRepos - assertConfigEquals mempty config legacy (projectConfigLocalNoIndexRepos . projectConfigShared . condTreeData) + assertConfigEquals mempty config legacy (projectConfigLocalNoIndexRepos . projectConfigShared . snd . condTreeData) where expected = [packagesRepository, morePackagesRepository, secureLocalRepository] packagesRepository = @@ -295,9 +295,9 @@ testRemoteRepos = do testLocalNoIndexRepos :: Assertion testLocalNoIndexRepos = do (config, legacy) <- readConfigDefault "local-no-index-repos" - let actualLocalRepos = (fromNubList . projectConfigLocalNoIndexRepos . projectConfigShared . condTreeData) config + let actualLocalRepos = (fromNubList . projectConfigLocalNoIndexRepos . projectConfigShared . snd . condTreeData) config assertBool "Expected LocalNoIndexRepos do not match parsed values" $ compareLists expected actualLocalRepos compareLocalRepos - assertConfigEquals mempty config legacy (projectConfigRemoteRepos . projectConfigShared . condTreeData) + assertConfigEquals mempty config legacy (projectConfigRemoteRepos . projectConfigShared . snd . condTreeData) where expected = [myRepository, mySecureRepository] myRepository = @@ -320,12 +320,12 @@ testProjectConfigProvenance :: Assertion testProjectConfigProvenance = do let expected = Set.singleton (Explicit (ProjectConfigPath $ "cabal.project" :| [])) (config, legacy) <- readConfigDefault "empty" - assertConfigEquals expected config legacy (projectConfigProvenance . condTreeData) + assertConfigEquals expected config legacy (projectConfigProvenance . snd . condTreeData) testProjectConfigLocalPackages :: Assertion testProjectConfigLocalPackages = do (config, legacy) <- readConfigDefault "project-config-local-packages" - assertConfigEquals expected config legacy (projectConfigLocalPackages . condTreeData) + assertConfigEquals expected config legacy (projectConfigLocalPackages . snd . condTreeData) where expected = PackageConfig{..} packageConfigProgramPaths = MapLast $ Map.fromList [("ghc", "/tmp/bin/ghc"), ("gcc", "/tmp/bin/gcc")] @@ -396,7 +396,7 @@ testProjectConfigLocalPackages = do testProjectConfigAllPackages :: Assertion testProjectConfigAllPackages = do (config, legacy) <- readConfigDefault "project-config-all-packages" - assertConfigEquals expected config legacy (projectConfigAllPackages . condTreeData) + assertConfigEquals expected config legacy (projectConfigAllPackages . snd . condTreeData) where expected :: PackageConfig expected = @@ -408,7 +408,7 @@ testProjectConfigAllPackages = do testProjectConfigSpecificPackages :: Assertion testProjectConfigSpecificPackages = do (config, legacy) <- readConfigDefault "project-config-specific-packages" - assertConfigEquals expected config legacy (projectConfigSpecificPackage . condTreeData) + assertConfigEquals expected config legacy (projectConfigSpecificPackage . snd . condTreeData) where expected = MapMappend $ Map.fromList [("foo", expectedFoo), ("bar", expectedBar), ("baz", expectedBaz)] expectedFoo :: PackageConfig @@ -434,7 +434,7 @@ testProjectConfigSpecificPackages = do testAllPackagesConcat :: Assertion testAllPackagesConcat = do (config, legacy) <- readConfigDefault "all-packages-concat" - assertConfigEquals expected config legacy (projectConfigAllPackages . condTreeData) + assertConfigEquals expected config legacy (projectConfigAllPackages . snd . condTreeData) where expected :: PackageConfig expected = @@ -451,7 +451,7 @@ testAllPackagesConcat = do testSpecificPackagesConcat :: Assertion testSpecificPackagesConcat = do (config, legacy) <- readConfigDefault "specific-packages-concat" - assertConfigEquals expected config legacy (projectConfigSpecificPackage . condTreeData) + assertConfigEquals expected config legacy (projectConfigSpecificPackage . snd . condTreeData) where expected = MapMappend $ Map.fromList [("foo", expectedFoo)] expectedFoo :: PackageConfig @@ -465,7 +465,7 @@ testSpecificPackagesConcat = do testProgramLocationsConcat :: Assertion testProgramLocationsConcat = do (config, legacy) <- readConfigDefault "program-locations-concat" - assertConfigEquals expected config legacy (projectConfigLocalPackages . condTreeData) + assertConfigEquals expected config legacy (projectConfigLocalPackages . snd . condTreeData) where expected :: PackageConfig expected = @@ -476,7 +476,7 @@ testProgramLocationsConcat = do testProgramOptionsConcat :: Assertion testProgramOptionsConcat = do (config, legacy) <- readConfigDefault "program-options-concat" - assertConfigEquals expected config legacy (projectConfigLocalPackages . condTreeData) + assertConfigEquals expected config legacy (projectConfigLocalPackages . snd . condTreeData) where expected :: PackageConfig expected = @@ -494,8 +494,8 @@ testProgramOptionsConcat = do testRelaxDepsConcat :: Assertion testRelaxDepsConcat = do (config, legacy) <- readConfigDefault "relax-deps-concat" - assertConfigEquals expectedAllowNewer config legacy (projectConfigAllowNewer . projectConfigShared . condTreeData) - assertConfigEquals expectedAllowOlder config legacy (projectConfigAllowOlder . projectConfigShared . condTreeData) + assertConfigEquals expectedAllowNewer config legacy (projectConfigAllowNewer . projectConfigShared . snd . condTreeData) + assertConfigEquals expectedAllowOlder config legacy (projectConfigAllowOlder . projectConfigShared . snd . condTreeData) where expectedAllowNewer :: Maybe AllowNewer expectedAllowNewer = @@ -520,32 +520,32 @@ testRelaxDepsConcat = do testLibraryCoverage :: Assertion testLibraryCoverage = do (config, legacy) <- readConfigDefault "library-coverage" - assertConfigEquals (Flag False) config legacy (packageConfigCoverage . projectConfigLocalPackages . condTreeData) + assertConfigEquals (Flag False) config legacy (packageConfigCoverage . projectConfigLocalPackages . snd . condTreeData) testHaddockAll :: Assertion testHaddockAll = do (config, legacy) <- readConfigDefault "haddock-all" - assertConfigEquals (Flag True) config legacy (packageConfigHaddockExecutables . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag True) config legacy (packageConfigHaddockTestSuites . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag True) config legacy (packageConfigHaddockBenchmarks . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag True) config legacy (packageConfigHaddockForeignLibs . projectConfigLocalPackages . condTreeData) + assertConfigEquals (Flag True) config legacy (packageConfigHaddockExecutables . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag True) config legacy (packageConfigHaddockTestSuites . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag True) config legacy (packageConfigHaddockBenchmarks . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag True) config legacy (packageConfigHaddockForeignLibs . projectConfigLocalPackages . snd . condTreeData) -- | Tests that an explicitly set field can override a value inherited from haddock-all. testHaddockAllOverwriteTrue :: Assertion testHaddockAllOverwriteTrue = do (config, legacy) <- readConfigDefault "haddock-all-overwrite-true" - assertConfigEquals (Flag True) config legacy (packageConfigHaddockExecutables . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag True) config legacy (packageConfigHaddockTestSuites . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag True) config legacy (packageConfigHaddockBenchmarks . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag False) config legacy (packageConfigHaddockForeignLibs . projectConfigLocalPackages . condTreeData) + assertConfigEquals (Flag True) config legacy (packageConfigHaddockExecutables . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag True) config legacy (packageConfigHaddockTestSuites . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag True) config legacy (packageConfigHaddockBenchmarks . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag False) config legacy (packageConfigHaddockForeignLibs . projectConfigLocalPackages . snd . condTreeData) testHaddockAllOverwriteFalse :: Assertion testHaddockAllOverwriteFalse = do (config, legacy) <- readConfigDefault "haddock-all-overwrite-false" - assertConfigEquals (Flag True) config legacy (packageConfigHaddockExecutables . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag False) config legacy (packageConfigHaddockTestSuites . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag False) config legacy (packageConfigHaddockBenchmarks . projectConfigLocalPackages . condTreeData) - assertConfigEquals (Flag False) config legacy (packageConfigHaddockForeignLibs . projectConfigLocalPackages . condTreeData) + assertConfigEquals (Flag True) config legacy (packageConfigHaddockExecutables . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag False) config legacy (packageConfigHaddockTestSuites . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag False) config legacy (packageConfigHaddockBenchmarks . projectConfigLocalPackages . snd . condTreeData) + assertConfigEquals (Flag False) config legacy (packageConfigHaddockForeignLibs . projectConfigLocalPackages . snd . condTreeData) ------------------------------------------------------------------------------- -- Test Utilities diff --git a/cabal-install/src/Distribution/Client/CmdConfigure.hs b/cabal-install/src/Distribution/Client/CmdConfigure.hs index dbaec030520..e3c69ae9d19 100644 --- a/cabal-install/src/Distribution/Client/CmdConfigure.hs +++ b/cabal-install/src/Distribution/Client/CmdConfigure.hs @@ -157,7 +157,7 @@ configureAction' flags@NixStyleFlags{..} _extraArgs globalFlags = do v (fromNubList . projectConfigProgPathExtra $ projectConfigShared cliConfig) (flagToMaybe . projectConfigHttpTransport $ projectConfigBuildOnly cliConfig) - (CondNode conf imps bs) <- + (CondNode (imps, conf) bs) <- runRebuild (distProjectRootDirectory . distDirLayout $ baseCtx) $ readProjectLocalExtraConfig v diff --git a/cabal-install/src/Distribution/Client/CmdRepl.hs b/cabal-install/src/Distribution/Client/CmdRepl.hs index e27a4d18642..b9f361271cf 100644 --- a/cabal-install/src/Distribution/Client/CmdRepl.hs +++ b/cabal-install/src/Distribution/Client/CmdRepl.hs @@ -360,7 +360,7 @@ resolveGlobalTarget flags@NixStyleFlags{extraFlags = ReplFlags{..}} targetString sourcePackage = fakeProjectSourcePackage projectRoot & ( (lSrcpkgDescription . L.condLibrary) - ?~ (CondNode library [baseDep] []) + ?~ (CondNode library []) ) library = emptyLibrary{libBuildInfo = lBuildInfo} lBuildInfo = diff --git a/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs b/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs index a6bc06d018c..957894d9a6a 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs @@ -140,7 +140,8 @@ import Distribution.Types.CondTree , CondTree (..) , ignoreConditions , mapTreeConds - , traverseCondTreeC + , mapTreeData + , traverseCondTreeA , traverseCondTreeV ) import Distribution.Types.SourceRepo (RepoType) @@ -216,14 +217,15 @@ import qualified Text.PrettyPrint as Disp -- | ProjectConfigSkeleton is a tree of conditional blocks and imports wrapping a config. It can be finalized by providing the conditional resolution info -- and then resolving and downloading the imports -type ProjectConfigSkeleton = CondTree ConfVar [ProjectConfigPath] ProjectConfig +-- TODO(leana8959): maybe move [ProjectConfigPath] into ProjectConfig +type ProjectConfigSkeleton = CondTree ConfVar ([ProjectConfigPath], ProjectConfig) singletonProjectConfigSkeleton :: ProjectConfig -> ProjectConfigSkeleton -singletonProjectConfigSkeleton x = CondNode x mempty mempty +singletonProjectConfigSkeleton x = CondNode (mempty, x) mempty instantiateProjectConfigSkeletonFetchingCompiler :: Monad m => m (OS, Arch, Compiler) -> FlagAssignment -> ProjectConfigSkeleton -> m (ProjectConfig, Maybe Compiler) instantiateProjectConfigSkeletonFetchingCompiler fetch flags skel - | null (toListOf traverseCondTreeV skel) = pure (fst (ignoreConditions skel), Nothing) + | null (toListOf traverseCondTreeV skel) = pure (ignoreConditions $ mapTreeData snd skel, Nothing) | otherwise = do (os, arch, comp) <- fetch let conf = instantiateProjectConfigSkeletonWithCompiler os arch (compilerInfo comp) flags skel @@ -232,13 +234,8 @@ instantiateProjectConfigSkeletonFetchingCompiler fetch flags skel instantiateProjectConfigSkeletonWithCompiler :: OS -> Arch -> CompilerInfo -> FlagAssignment -> ProjectConfigSkeleton -> ProjectConfig instantiateProjectConfigSkeletonWithCompiler os arch impl _flags skel = go $ mapTreeConds (fst . simplifyWithSysParams os arch impl) skel where - go - :: CondTree - FlagName - [ProjectConfigPath] - ProjectConfig - -> ProjectConfig - go (CondNode l _imps ts) = + go :: CondTree FlagName ([ProjectConfigPath], ProjectConfig) -> ProjectConfig + go (CondNode (_, l) ts) = let branches = concatMap processBranch ts in l <> mconcat branches processBranch (CondBranch cnd t mf) = case cnd of @@ -247,7 +244,7 @@ instantiateProjectConfigSkeletonWithCompiler os arch impl _flags skel = go $ map _ -> error $ "unable to process condition: " ++ show cnd -- TODO it would be nice if there were a pretty printer projectSkeletonImports :: ProjectConfigSkeleton -> [ProjectConfigPath] -projectSkeletonImports = view traverseCondTreeC +projectSkeletonImports = fst . view traverseCondTreeA -- | Parses a project from its root config file, typically cabal.project. parseProject @@ -298,7 +295,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project when (isUntrimmedUriConfigPath importLocPath) (noticeDoc verbosity $ untrimmedUriImportMsg (Disp.text "Warning:") importLocPath) - let fs = (\z -> CondNode z [normLocPath] mempty) <$> fieldsToConfig normSource (reverse acc) + let fs = (\z -> CondNode ([normLocPath], z) mempty) <$> fieldsToConfig normSource (reverse acc) res <- parseProjectSkeleton cacheDir httpTransport verbosity projectDir importLocPath . ProjectConfigToParse =<< fetchImportConfig normLocPath rest <- go [] xs pure . fmap mconcat . sequence $ [projectParse Nothing normSource fs, res, rest] @@ -308,7 +305,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project let fs = singletonProjectConfigSkeleton <$> fieldsToConfig source (reverse acc) (elseClauses, rest) <- parseElseClauses xs let condNode = - (\c pcs e -> CondNode mempty mempty [CondBranch c pcs e]) + (\c pcs e -> CondNode mempty [CondBranch c pcs e]) <$> -- we rewrap as as a section so the readFields lexer of the conditional parser doesn't get confused ( let s = "if(" <> p <> ")" @@ -333,7 +330,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project subpcs <- go [] xs' (elseClauses, rest) <- parseElseClauses xs let condNode = - (\c pcs e -> CondNode mempty mempty [CondBranch c pcs e]) + (\c pcs e -> CondNode mempty [CondBranch c pcs e]) <$> ( let s = "elif(" <> p <> ")" in projectParse (Just s) normSource (adaptParseError l (parseConditionConfVarFromClause $ BS.pack s)) ) @@ -388,13 +385,13 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project isSet f = f (projectConfigShared pc) /= NoFlag sanityWalkPCS :: Bool -> ProjectConfigSkeleton -> ProjectParseResult ProjectConfigSkeleton - sanityWalkPCS underConditional t@(CondNode d (listToMaybe -> c) comps) + sanityWalkPCS underConditional t@(CondNode (listToMaybe -> c, d) comps) | underConditional && modifiesCompiler d = projectParseFail Nothing c $ ParseUtils.FromString "Cannot set compiler in a conditional clause of a cabal project file" Nothing | otherwise = mapM_ sanityWalkBranch comps >> pure t - sanityWalkBranch :: CondBranch ConfVar [ProjectConfigPath] ProjectConfig -> ProjectParseResult () + sanityWalkBranch :: CondBranch ConfVar ([ProjectConfigPath], ProjectConfig) -> ProjectParseResult () sanityWalkBranch (CondBranch _c t f) = traverse_ (sanityWalkPCS True) f >> sanityWalkPCS True t >> pure () ------------------------------------------------------------------ diff --git a/cabal-install/src/Distribution/Client/ProjectConfig/Parsec.hs b/cabal-install/src/Distribution/Client/ProjectConfig/Parsec.hs index 06d9631e5f3..90740fc7a93 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig/Parsec.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig/Parsec.hs @@ -66,7 +66,7 @@ import Text.PrettyPrint (render) import qualified Text.PrettyPrint as Disp singletonProjectConfigSkeleton :: ProjectConfig -> ProjectConfigSkeleton -singletonProjectConfigSkeleton x = CondNode x mempty mempty +singletonProjectConfigSkeleton x = CondNode (mempty, x) mempty readPreprocessFields :: BS.ByteString -> ParseResult src [Field Position] readPreprocessFields bs = do @@ -136,7 +136,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project when (isUntrimmedUriConfigPath importLocPath) (noticeDoc verbosity $ untrimmedUriImportMsg (Disp.text "Warning:") importLocPath) - let fs = (\z -> CondNode z [normLocPath] mempty) <$> fieldsToConfig normSource (reverse acc) + let fs = (\z -> CondNode ([normLocPath], z) mempty) <$> fieldsToConfig normSource (reverse acc) importParseResult <- parseProjectSkeleton cacheDir httpTransport verbosity projectDir importLocPath . ProjectConfigToParse =<< fetchImportConfig normLocPath rest <- go [] xs @@ -148,7 +148,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project let fs = fmap singletonProjectConfigSkeleton $ fieldsToConfig source (reverse acc) (elseClauses, rest) <- parseElseClauses xs let condNode = - (\c pcs e -> CondNode mempty mempty [CondBranch c pcs e]) + (\c pcs e -> CondNode mempty [CondBranch c pcs e]) <$> parseConditionConfVar (startOfSection (incPos 2 pos) args) args <*> subpcs <*> elseClauses @@ -168,7 +168,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project subpcs <- go [] xs' (elseClauses, rest) <- parseElseClauses xs let condNode = - (\c pcs e -> CondNode mempty mempty [CondBranch c pcs e]) + (\c pcs e -> CondNode mempty [CondBranch c pcs e]) <$> parseConditionConfVar (startOfSection (incPos 4 pos) args) args <*> subpcs <*> elseClauses @@ -213,11 +213,11 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project isSet f = f (projectConfigShared pc) /= NoFlag sanityWalkPCS :: Bool -> ProjectConfigSkeleton -> ParseResult ProjectFileSource ProjectConfigSkeleton - sanityWalkPCS underConditional t@(CondNode d _c comps) + sanityWalkPCS underConditional t@(CondNode (_c, d) comps) | underConditional && modifiesCompiler d = parseFatalFailure zeroPos "Cannot set compiler in a conditional clause of a cabal project file" | otherwise = mapM_ sanityWalkBranch comps >> pure t - sanityWalkBranch :: CondBranch ConfVar [ProjectConfigPath] ProjectConfig -> ParseResult ProjectFileSource () + sanityWalkBranch :: CondBranch ConfVar ([ProjectConfigPath], ProjectConfig) -> ParseResult ProjectFileSource () sanityWalkBranch (CondBranch _c t f) = traverse_ (sanityWalkPCS True) f >> sanityWalkPCS True t >> pure () programDb = defaultProgramDb diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning.hs b/cabal-install/src/Distribution/Client/ProjectPlanning.hs index 8064231194c..83008470263 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning.hs @@ -400,7 +400,7 @@ rebuildProjectConfig let fetchCompiler = do -- have to create the cache directory before configuring the compiler liftIO $ createDirectoryIfMissingVerbose verbosity True distProjectCacheDirectory - (compiler, Platform arch os, _) <- configureCompiler verbosity distDirLayout (fst (PD.ignoreConditions projectConfigSkeleton) <> cliConfig) + (compiler, Platform arch os, _) <- configureCompiler verbosity distDirLayout (snd (PD.ignoreConditions projectConfigSkeleton) <> cliConfig) pure (os, arch, compiler) (projectConfig, compiler) <- instantiateProjectConfigSkeletonFetchingCompiler fetchCompiler mempty projectConfigSkeleton diff --git a/cabal-install/src/Distribution/Client/ScriptUtils.hs b/cabal-install/src/Distribution/Client/ScriptUtils.hs index e04707d825b..292f5708a34 100644 --- a/cabal-install/src/Distribution/Client/ScriptUtils.hs +++ b/cabal-install/src/Distribution/Client/ScriptUtils.hs @@ -377,7 +377,7 @@ withContextAndSelectors verbosity noTargets kind flags@NixStyleFlags{..} targetS projectCfgSkeleton <- readProjectBlockFromScript verbosity httpTransport (distDirLayout ctx) (takeFileName script) scriptContents createDirectoryIfMissingVerbose verbosity True (distProjectCacheDirectory $ distDirLayout ctx) - (compiler, platform@(Platform arch os), _) <- runRebuild projectRoot $ configureCompiler verbosity (distDirLayout ctx) (fst (ignoreConditions projectCfgSkeleton) <> projectConfig ctx) + (compiler, platform@(Platform arch os), _) <- runRebuild projectRoot $ configureCompiler verbosity (distDirLayout ctx) (snd (ignoreConditions projectCfgSkeleton) <> projectConfig ctx) (projectCfg, _) <- instantiateProjectConfigSkeletonFetchingCompiler (pure (os, arch, compiler)) mempty projectCfgSkeleton @@ -473,7 +473,7 @@ updateContextAndWriteProjectFile ctx scriptPath scriptExecutable = do sourcePackage = fakeProjectSourcePackage projectRoot & lSrcpkgDescription . L.condExecutables - .~ [(scriptComponentName scriptPath, CondNode executable (targetBuildDepends $ buildInfo executable) [])] + .~ [(scriptComponentName scriptPath, CondNode executable [])] executable = scriptExecutable & L.modulePath .~ absScript diff --git a/cabal-install/tests/IntegrationTests2.hs b/cabal-install/tests/IntegrationTests2.hs index 1b3eb4e7f95..1d9093a1624 100644 --- a/cabal-install/tests/IntegrationTests2.hs +++ b/cabal-install/tests/IntegrationTests2.hs @@ -667,7 +667,7 @@ testTargetSelectorAmbiguous reportSubCase = do , condSubLibraries = [] , condForeignLibs = [] , condExecutables = - [ (exeName exe, CondNode exe [] []) + [ (exeName exe, CondNode exe []) | exe <- exes ] , condTestSuites = [] diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs index 1cfee249147..47f72de74e0 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs @@ -78,6 +78,9 @@ import qualified Distribution.Verbosity as C import qualified Distribution.Version as C import Language.Haskell.Extension (Extension (..), Language (..)) +import qualified Distribution.Compat.Lens as L +import qualified Distribution.Types.BuildInfo.Lens as L + -- cabal-install import Distribution.Client.Dependency import qualified Distribution.Client.SolverInstallPlan as CI.SolverInstallPlan @@ -392,9 +395,9 @@ exInst pn v hash deps = ExInst pn v hash (map exInstHash deps) -- these packages. type ExampleDb = [Either ExampleInstalled ExampleAvailable] -type DependencyTree a = C.CondTree C.ConfVar [C.Dependency] a +type DependencyTree a = C.CondTree C.ConfVar a -type DependencyComponent a = C.CondBranch C.ConfVar [C.Dependency] a +type DependencyComponent a = C.CondBranch C.ConfVar a exDbPkgs :: ExampleDb -> [ExamplePkgName] exDbPkgs = map (either exInstName exAvName) @@ -610,18 +613,19 @@ exAvSrcPkg ex = -- any level. mkTopLevelCondTree :: forall a - . Semigroup a + . (Semigroup a, L.HasBuildInfo a) => a -> (C.LibraryVisibility -> C.BuildInfo -> a) -> Dependencies -> DependencyTree a mkTopLevelCondTree defaultTopLevel mkComponent deps = - let condNode = mkCondTree mkComponent deps + let condNode :: DependencyTree a + condNode = mkCondTree mkComponent deps in condNode{C.condTreeData = defaultTopLevel <> C.condTreeData condNode} -- Convert 'Dependencies' into a tree of a specific component type, using -- the given function to generate each component. - mkCondTree :: (C.LibraryVisibility -> C.BuildInfo -> a) -> Dependencies -> DependencyTree a + mkCondTree :: forall a. L.HasBuildInfo a => (C.LibraryVisibility -> C.BuildInfo -> a) -> Dependencies -> DependencyTree a mkCondTree mkComponent deps = let (libraryDeps, exts, mlang, pcpkgs, buildTools, legacyBuildTools) = splitTopLevel (depsExampleDependencies deps) (directDeps, flaggedDeps) = splitDeps libraryDeps @@ -647,11 +651,7 @@ exAvSrcPkg ex = , C.buildable = depsIsBuildable deps } in C.CondNode - { C.condTreeData = component - , -- TODO: Arguably, build-tools dependencies should also - -- effect constraints on conditional tree. But no way to - -- distinguish between them - C.condTreeConstraints = map mkDirect directDeps + { C.condTreeData = L.set L.targetBuildDepends (map mkDirect directDeps) component , C.condTreeComponents = map (mkFlagged mkComponent) flaggedDeps } @@ -659,7 +659,9 @@ exAvSrcPkg ex = mkDirect (dep, name, vr) = C.Dependency (C.mkPackageName dep) vr (NonEmptySet.singleton name) mkFlagged - :: (C.LibraryVisibility -> C.BuildInfo -> a) + :: forall a + . L.HasBuildInfo a + => (C.LibraryVisibility -> C.BuildInfo -> a) -> (ExampleFlagName, Dependencies, Dependencies) -> DependencyComponent a mkFlagged mkComponent (f, a, b) = @@ -719,7 +721,7 @@ exAvSrcPkg ex = _ -> False mkSimpleVersion :: ExamplePkgVersion -> C.Version -mkSimpleVersion n = C.mkVersion [n, 0, 0] +mkSimpleVersion n = C.mkVersion [n] mkSimplePkgconfigVersion :: ExamplePkgVersion -> C.PkgconfigVersion mkSimplePkgconfigVersion = C.versionToPkgconfigVersion . mkSimpleVersion diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs index 3fe0eb6a339..757aff758db 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs @@ -34,6 +34,7 @@ import Distribution.Solver.Compat.Prelude import Prelude () import Data.List (elemIndex) +import GHC.Stack (withFrozenCallStack) -- test-framework import Test.Tasty as TF @@ -252,7 +253,7 @@ mkTestExtLangPC exts langs mPkgConfigDb db label targets result = } runTest :: SolverTest -> TF.TestTree -runTest SolverTest{..} = askOption $ \(OptionShowSolverLog showSolverLog) -> +runTest SolverTest{..} = withFrozenCallStack $ askOption $ \(OptionShowSolverLog showSolverLog) -> testCase testLabel $ do let progress = exResolve diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs index 10e1511d3be..6a7a866071a 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs @@ -1424,11 +1424,11 @@ dbTH = exAv "template-haskell" 1 - [ExAny "ghc-prim", ExAny "ghc-internal", ExAny "ghc-boot-th", ExAny "pretty", ExAny "base"] + [ExAny "ghc-prim", ExAny "ghc-internal", ExAny "ghc-boot-th", ExAny "pretty", ExRange "base" 1 1] , Right $ exAv "ghc-prim" 1 [] , Left $ exInst "ghc-internal" 1 "ghc-internal-1" [] , Left $ exInst "ghc-boot-th" 1 "ghc-boot-th-1" [] - , Right $ exAv "pretty" 1 [ExAny "base"] + , Right $ exAv "pretty" 1 [ExRange "base" 1 1] , Right $ exAv "base" 1 [ExAny "ghc-prim", ExAny "ghc-internal"] ]