Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/7fb50d23f88e5fac0e84e1b0695bbed86c07b334 >--------------------------------------------------------------- commit 7fb50d23f88e5fac0e84e1b0695bbed86c07b334 Author: Andres Loeh <[email protected]> Date: Thu Jun 30 12:10:18 2011 +0000 Refactoring: moving goals to Dependency module >--------------------------------------------------------------- .../Client/Dependency/Modular/Dependency.hs | 23 ++++++++++++++++++++ .../Distribution/Client/Dependency/Modular/Tree.hs | 21 ------------------ 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/cabal-install/Distribution/Client/Dependency/Modular/Dependency.hs b/cabal-install/Distribution/Client/Dependency/Modular/Dependency.hs index 91aaf20..a8ac8b6 100644 --- a/cabal-install/Distribution/Client/Dependency/Modular/Dependency.hs +++ b/cabal-install/Distribution/Client/Dependency/Modular/Dependency.hs @@ -119,3 +119,26 @@ instance ResetVar Dep where -- | A map containing reverse dependencies between qualified -- package names. type RevDepMap = Map QPN [QPN] + +-- | Goals are qualified flagged dependencies, together with a reason for +-- their presence. +data Goal = Goal (FlaggedDep QPN) GoalReasons + deriving (Eq, Show) + +-- | Reasons why a goal can be added to a goal set. +data GoalReason = UserGoal | PDependency (PI QPN) | FDependency QFN Bool + deriving (Eq, Show) + +-- | The first element is the immediate reason. The rest are the reasons +-- for the reasons ... +type GoalReasons = [GoalReason] + +goalReasonToVars :: GoalReason -> ConflictSet QPN +goalReasonToVars UserGoal = S.empty +goalReasonToVars (PDependency (PI qpn _)) = S.singleton (P qpn) +goalReasonToVars (FDependency qfn _) = S.singleton (F qfn) + +goalReasonsToVars :: GoalReasons -> ConflictSet QPN +goalReasonsToVars = S.unions . L.map goalReasonToVars + + diff --git a/cabal-install/Distribution/Client/Dependency/Modular/Tree.hs b/cabal-install/Distribution/Client/Dependency/Modular/Tree.hs index 96a57c9..0cf9635 100644 --- a/cabal-install/Distribution/Client/Dependency/Modular/Tree.hs +++ b/cabal-install/Distribution/Client/Dependency/Modular/Tree.hs @@ -14,27 +14,6 @@ import Distribution.Client.Dependency.Modular.Package import Distribution.Client.Dependency.Modular.PSQ as P import Distribution.Client.Dependency.Modular.Version --- | Goals are qualified flagged dependencies, together with a reason for --- their presence. -data Goal = Goal (FlaggedDep QPN) GoalReasons - deriving (Eq, Show) - --- | Reasons why a goal can be added to a goal set. -data GoalReason = UserGoal | PDependency (PI QPN) | FDependency QFN Bool - deriving (Eq, Show) - --- | The first element is the immediate reason. The rest are the reasons --- for the reasons ... -type GoalReasons = [GoalReason] - -goalReasonToVars :: GoalReason -> ConflictSet QPN -goalReasonToVars UserGoal = S.empty -goalReasonToVars (PDependency (PI qpn _)) = S.singleton (P qpn) -goalReasonToVars (FDependency qfn _) = S.singleton (F qfn) - -goalReasonsToVars :: GoalReasons -> ConflictSet QPN -goalReasonsToVars = S.unions . L.map goalReasonToVars - -- | Type of the search tree. Inlining the choice nodes for now. data Tree a = PChoice QPN a (PSQ I (Tree a)) _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
