-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | The command-line interface for Cabal and Hackage.
--   
--   The solver component used in cabal-install command-line program
@package cabal-install-solver
@version 3.12.1.0

module Distribution.Client.Utils.Assertion

-- | Like <tt>assert</tt>, but only enabled with
--   -fdebug-expensive-assertions. This function can be used for expensive
--   assertions that should only be turned on during testing or debugging.
expensiveAssert :: Bool -> a -> a


-- | This module does two things:
--   
--   <ul>
--   <li>Acts as a compatibility layer, like <tt>base-compat</tt>.</li>
--   <li>Provides commonly used imports.</li>
--   </ul>
--   
--   This module is a superset of <a>Distribution.Compat.Prelude</a> (which
--   this module re-exports)
module Distribution.Solver.Compat.Prelude
deepseq :: NFData a => a -> b -> b
data Bool
False :: Bool
True :: Bool
id :: a -> a
(.) :: (b -> c) -> (a -> b) -> a -> c
class Num a
(+) :: Num a => a -> a -> a
(-) :: Num a => a -> a -> a
(*) :: Num a => a -> a -> a
negate :: Num a => a -> a
abs :: Num a => a -> a
signum :: Num a => a -> a
fromInteger :: Num a => Integer -> a
class Typeable a => Data a
data Map k a
data Set a
class Fractional a => Floating a
pi :: Floating a => a
exp :: Floating a => a -> a
log :: Floating a => a -> a
sqrt :: Floating a => a -> a
(**) :: Floating a => a -> a -> a
logBase :: Floating a => a -> a -> a
sin :: Floating a => a -> a
cos :: Floating a => a -> a
tan :: Floating a => a -> a
asin :: Floating a => a -> a
acos :: Floating a => a -> a
atan :: Floating a => a -> a
sinh :: Floating a => a -> a
cosh :: Floating a => a -> a
tanh :: Floating a => a -> a
asinh :: Floating a => a -> a
acosh :: Floating a => a -> a
atanh :: Floating a => a -> a
data Maybe a
Nothing :: Maybe a
Just :: a -> Maybe a
partitionEithers :: [Either a b] -> ([a], [b])
data Either a b
Left :: a -> Either a b
Right :: b -> Either a b
class Foldable (t :: Type -> Type)
foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
toList :: Foldable t => t a -> [a]
null :: Foldable t => t a -> Bool
length :: Foldable t => t a -> Int
elem :: (Foldable t, Eq a) => a -> t a -> Bool
maximum :: (Foldable t, Ord a) => t a -> a
minimum :: (Foldable t, Ord a) => t a -> a
sum :: (Foldable t, Num a) => t a -> a
product :: (Foldable t, Num a) => t a -> a
class Applicative f => Alternative (f :: Type -> Type)
empty :: Alternative f => f a
(<|>) :: Alternative f => f a -> f a -> f a
some :: Alternative f => f a -> f [a]
many :: Alternative f => f a -> f [a]
lookup :: Eq a => a -> [(a, b)] -> Maybe b
filter :: (a -> Bool) -> [a] -> [a]
intercalate :: [a] -> [[a]] -> [a]
sortBy :: (a -> a -> Ordering) -> [a] -> [a]
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
cycle :: HasCallStack => [a] -> [a]
data NonEmptySet a
class Binary t
put :: Binary t => t -> Put
get :: Binary t => Get t
putList :: Binary t => [t] -> Put
class (Typeable e, Show e) => Exception e
toException :: Exception e => e -> SomeException
fromException :: Exception e => SomeException -> Maybe e
displayException :: Exception e => e -> String
backtraceDesired :: Exception e => e -> Bool
class Applicative m => Monad (m :: Type -> Type)
(>>=) :: Monad m => m a -> (a -> m b) -> m b
(>>) :: Monad m => m a -> m b -> m b
return :: Monad m => a -> m a
class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
catMaybes :: [Maybe a] -> [a]
mapMaybe :: (a -> Maybe b) -> [a] -> [b]
isJust :: Maybe a -> Bool
comparing :: Ord a => (b -> a) -> b -> b -> Ordering
class Eq a => Ord a
compare :: Ord a => a -> a -> Ordering
(<) :: Ord a => a -> a -> Bool
(<=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
max :: Ord a => a -> a -> a
min :: Ord a => a -> a -> a
map :: (a -> b) -> [a] -> [b]
first :: Arrow a => a b c -> a (b, d) (c, d)
class Monad m => MonadFail (m :: Type -> Type)
fail :: MonadFail m => String -> m a
foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type)
mzero :: MonadPlus m => m a
mplus :: MonadPlus m => m a -> m a -> m a
liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
zip :: [a] -> [b] -> [(a, b)]
class Eq a
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool
class Show a
showsPrec :: Show a => Int -> a -> ShowS
show :: Show a => a -> String
showList :: Show a => [a] -> ShowS
class Typeable a => Structured a
data NonEmpty a
(:|) :: a -> [a] -> NonEmpty a
foldr1 :: (a -> a -> a) -> NonEmpty a -> a
type FilePath = String
class Semigroup a
(<>) :: Semigroup a => a -> a -> a
($!) :: (a -> b) -> a -> b
(=<<) :: Monad m => (a -> m b) -> m a -> m b
asTypeOf :: a -> a -> a
const :: a -> b -> a
flip :: (a -> b -> c) -> b -> a -> c
until :: (a -> Bool) -> (a -> a) -> a -> a
either :: (a -> c) -> (b -> c) -> Either a b -> c
all :: Foldable t => (a -> Bool) -> t a -> Bool
and :: Foldable t => t Bool -> Bool
any :: Foldable t => (a -> Bool) -> t a -> Bool
concat :: Foldable t => t [a] -> [a]
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
or :: Foldable t => t Bool -> Bool
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
(<$>) :: Functor f => (a -> b) -> f a -> f b
maybe :: b -> (a -> b) -> Maybe a -> b
lines :: String -> [String]
unlines :: [String] -> String
unwords :: [String] -> String
words :: String -> [String]
curry :: ((a, b) -> c) -> a -> b -> c
fst :: (a, b) -> a
snd :: (a, b) -> b
uncurry :: (a -> b -> c) -> (a, b) -> c
error :: HasCallStack => [Char] -> a
errorWithoutStackTrace :: [Char] -> a
undefined :: HasCallStack => a
ioError :: IOError -> IO a
userError :: String -> IOError
(!!) :: HasCallStack => [a] -> Int -> a
break :: (a -> Bool) -> [a] -> ([a], [a])
drop :: Int -> [a] -> [a]
dropWhile :: (a -> Bool) -> [a] -> [a]
head :: NonEmpty a -> a
init :: NonEmpty a -> [a]
iterate :: (a -> a) -> a -> [a]
last :: NonEmpty a -> a
repeat :: a -> [a]
replicate :: Int -> a -> [a]
reverse :: [a] -> [a]
scanl :: (b -> a -> b) -> b -> [a] -> [b]
scanl1 :: (a -> a -> a) -> [a] -> [a]
scanr :: (a -> b -> b) -> b -> [a] -> [b]
scanr1 :: (a -> a -> a) -> [a] -> [a]
span :: (a -> Bool) -> [a] -> ([a], [a])
splitAt :: Int -> [a] -> ([a], [a])
tail :: NonEmpty a -> [a]
take :: Int -> [a] -> [a]
takeWhile :: (a -> Bool) -> [a] -> [a]
unzip :: [(a, b)] -> ([a], [b])
unzip3 :: [(a, b, c)] -> ([a], [b], [c])
zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
subtract :: Num a => a -> a -> a
lex :: ReadS String
readParen :: Bool -> ReadS a -> ReadS a
(^) :: (Num a, Integral b) => a -> b -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
even :: Integral a => a -> Bool
gcd :: Integral a => a -> a -> a
lcm :: Integral a => a -> a -> a
odd :: Integral a => a -> Bool
showChar :: Char -> ShowS
showParen :: Bool -> ShowS -> ShowS
showString :: String -> ShowS
shows :: Show a => a -> ShowS
appendFile :: FilePath -> String -> IO ()
getChar :: IO Char
getContents :: IO String
getLine :: IO String
interact :: (String -> String) -> IO ()
putChar :: Char -> IO ()
putStr :: String -> IO ()
putStrLn :: String -> IO ()
readFile :: FilePath -> IO String
readIO :: Read a => String -> IO a
readLn :: Read a => IO a
writeFile :: FilePath -> String -> IO ()
reads :: Read a => ReadS a
(&&) :: Bool -> Bool -> Bool
not :: Bool -> Bool
(||) :: Bool -> Bool -> Bool
class Functor f => Applicative (f :: Type -> Type)
pure :: Applicative f => a -> f a
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
(*>) :: Applicative f => f a -> f b -> f b
(<*) :: Applicative f => f a -> f b -> f a
class Functor (f :: Type -> Type)
fmap :: Functor f => (a -> b) -> f a -> f b
(<$) :: Functor f => a -> f b -> f a
foldl1 :: (a -> a -> a) -> NonEmpty a -> a
class Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a
class Enum a
succ :: Enum a => a -> a
pred :: Enum a => a -> a
toEnum :: Enum a => Int -> a
fromEnum :: Enum a => a -> Int
enumFrom :: Enum a => a -> [a]
enumFromThen :: Enum a => a -> a -> [a]
enumFromTo :: Enum a => a -> a -> [a]
enumFromThenTo :: Enum a => a -> a -> a -> [a]
class (RealFrac a, Floating a) => RealFloat a
floatRadix :: RealFloat a => a -> Integer
floatDigits :: RealFloat a => a -> Int
floatRange :: RealFloat a => a -> (Int, Int)
decodeFloat :: RealFloat a => a -> (Integer, Int)
encodeFloat :: RealFloat a => Integer -> Int -> a
exponent :: RealFloat a => a -> Int
significand :: RealFloat a => a -> a
scaleFloat :: RealFloat a => Int -> a -> a
isNaN :: RealFloat a => a -> Bool
isInfinite :: RealFloat a => a -> Bool
isDenormalized :: RealFloat a => a -> Bool
isNegativeZero :: RealFloat a => a -> Bool
isIEEE :: RealFloat a => a -> Bool
atan2 :: RealFloat a => a -> a -> a
type IOError = IOException
class Read a
readsPrec :: Read a => Int -> ReadS a
readList :: Read a => ReadS [a]
class Num a => Fractional a
(/) :: Fractional a => a -> a -> a
recip :: Fractional a => a -> a
fromRational :: Fractional a => Rational -> a
class (Real a, Enum a) => Integral a
quot :: Integral a => a -> a -> a
rem :: Integral a => a -> a -> a
div :: Integral a => a -> a -> a
mod :: Integral a => a -> a -> a
quotRem :: Integral a => a -> a -> (a, a)
divMod :: Integral a => a -> a -> (a, a)
toInteger :: Integral a => a -> Integer
class (Real a, Fractional a) => RealFrac a
properFraction :: (RealFrac a, Integral b) => a -> (b, a)
truncate :: (RealFrac a, Integral b) => a -> b
round :: (RealFrac a, Integral b) => a -> b
ceiling :: (RealFrac a, Integral b) => a -> b
floor :: (RealFrac a, Integral b) => a -> b
type ShowS = String -> String
type ReadS a = String -> [(a, String)]
data Char
data Double
data Float
data Int
data Word
data Ordering
LT :: Ordering
EQ :: Ordering
GT :: Ordering
class a ~# b => (a :: k) ~ (b :: k)
data Integer
data Void
($) :: (a -> b) -> a -> b
otherwise :: Bool
(++) :: [a] -> [a] -> [a]
join :: Monad m => m (m a) -> m a
class Semigroup a => Monoid a
mempty :: Monoid a => a
mappend :: Monoid a => a -> a -> a
mconcat :: Monoid a => [a] -> a
type String = [Char]
realToFrac :: (Real a, Fractional b) => a -> b
fromIntegral :: (Integral a, Num b) => a -> b
class (Num a, Ord a) => Real a
toRational :: Real a => a -> Rational
type Rational = Ratio Integer
print :: Show a => a -> IO ()
seq :: a -> b -> b
ap :: Monad m => m (a -> b) -> m a -> m b
liftM :: Monad m => (a1 -> r) -> m a1 -> m r
when :: Applicative f => Bool -> f () -> f ()
absurd :: Void -> a
ord :: Char -> Int
vacuous :: Functor f => f Void -> f a
data SomeException
SomeException :: e -> SomeException
data Word32
data Word64
data Word16
data Word8
catchExit :: IO a -> (ExitCode -> IO a) -> IO a
catchIO :: IO a -> (IOException -> IO a) -> IO a
tryIO :: IO a -> IO (Either IOException a)
(<<>>) :: Doc -> Doc -> Doc
genericRnf :: (Generic a, GNFData (Rep a)) => a -> ()
trace :: String -> a -> a
traceM :: Applicative f => String -> f ()
traceShow :: Show a => a -> b -> b
traceShowId :: Show a => a -> a
traceShowM :: (Show a, Applicative f) => a -> f ()
gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmempty :: (Generic a, GMonoid (Rep a)) => a
nonEmpty :: [a] -> Maybe (NonEmpty a)
force :: NFData a => a -> a
chr :: Int -> Char
filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]
unless :: Applicative f => Bool -> f () -> f ()
find :: Foldable t => (a -> Bool) -> t a -> Maybe a
for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
void :: Functor f => f a -> f ()
fromMaybe :: a -> Maybe a -> a
isNothing :: Maybe a -> Bool
listToMaybe :: [a] -> Maybe a
maybeToList :: Maybe a -> [a]
dropWhileEnd :: (a -> Bool) -> [a] -> [a]
intersperse :: a -> [a] -> [a]
isPrefixOf :: Eq a => [a] -> [a] -> Bool
isSuffixOf :: Eq a => [a] -> [a] -> Bool
nub :: Eq a => [a] -> [a]
nubBy :: (a -> a -> Bool) -> [a] -> [a]
partition :: (a -> Bool) -> [a] -> ([a], [a])
sort :: Ord a => [a] -> [a]
unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
typeRep :: forall {k} proxy (a :: k). Typeable a => proxy a -> TypeRep
catch :: Exception e => IO a -> (e -> IO a) -> IO a
evaluate :: a -> IO a
throwIO :: (HasCallStack, Exception e) => e -> IO a
exitFailure :: IO a
exitSuccess :: IO a
exitWith :: ExitCode -> IO a
readMaybe :: Read a => String -> Maybe a
isAlpha :: Char -> Bool
isAlphaNum :: Char -> Bool
isDigit :: Char -> Bool
isSpace :: Char -> Bool
isUpper :: Char -> Bool
toLower :: Char -> Char
toUpper :: Char -> Char
(<+>) :: Doc -> Doc -> Doc
class NFData a
rnf :: NFData a => a -> ()
newtype Const a (b :: k)
Const :: a -> Const a (b :: k)
[getConst] :: Const a (b :: k) -> a
newtype Identity a
Identity :: a -> Identity a
[runIdentity] :: Identity a -> a
data Proxy (t :: k)
Proxy :: Proxy (t :: k)
type TypeRep = SomeTypeRep
data ExitCode
ExitSuccess :: ExitCode
ExitFailure :: Int -> ExitCode
data IOException
guard :: Alternative f => Bool -> f ()
class IsString a
fromString :: IsString a => String -> a
class Typeable (a :: k)
class Generic a
data Int16
data Int32
data Int64
data Int8
data IO a


-- | Wrapper around Data.Graph with support for edge labels
module Distribution.Solver.Modular.LabeledGraph
type Graph e = Array Vertex [(e, Vertex)]
type Vertex = Int

-- | Construct an edge-labeled graph
--   
--   This is a simple adaptation of the definition in Data.Graph
graphFromEdges :: Ord key => [(node, key, [(edge, key)])] -> (Graph edge, Vertex -> (node, key, [(edge, key)]), key -> Maybe Vertex)
graphFromEdges' :: Ord key => [(node, key, [(edge, key)])] -> (Graph edge, Vertex -> (node, key, [(edge, key)]))
buildG :: Bounds -> [Edge e] -> Graph e
transposeG :: Graph e -> Graph e
vertices :: Graph e -> [Vertex]
edges :: Graph e -> [Edge e]
forgetLabels :: Graph e -> Graph
topSort :: Graph e -> [Vertex]


-- | Utility functions providing extra context to cabal error messages
module Distribution.Solver.Modular.MessageUtils
allKnownExtensions :: [String]
cutoffRange :: Int
mostSimilarElement :: String -> [String] -> String
showUnsupportedExtension :: Extension -> String
showUnsupportedLanguage :: Language -> String
withinRange :: Int -> String -> String -> Bool

module Distribution.Solver.Modular.PSQ
newtype PSQ k v
PSQ :: [(k, v)] -> PSQ k v
casePSQ :: PSQ k a -> r -> (k -> a -> PSQ k a -> r) -> r
cons :: k -> a -> PSQ k a -> PSQ k a
length :: PSQ k a -> Int
lookup :: Eq k => k -> PSQ k v -> Maybe v
filter :: (a -> Bool) -> PSQ k a -> PSQ k a

-- | Will partition the list according to the predicate. If there is any
--   element that satisfies the predicate, then only the elements
--   satisfying the predicate are returned. Otherwise, the rest is
--   returned.
filterIfAny :: (a -> Bool) -> PSQ k a -> PSQ k a

-- | Variant of <a>filterIfAny</a> that takes a predicate on the keys
--   rather than on the values.
filterIfAnyByKeys :: (k -> Bool) -> PSQ k a -> PSQ k a
filterKeys :: (k -> Bool) -> PSQ k a -> PSQ k a
firstOnly :: PSQ k a -> PSQ k a
fromList :: [(k, a)] -> PSQ k a
isZeroOrOne :: PSQ k a -> Bool
keys :: PSQ k v -> [k]
map :: (v1 -> v2) -> PSQ k v1 -> PSQ k v2
mapKeys :: (k1 -> k2) -> PSQ k1 v -> PSQ k2 v
mapWithKey :: (k -> a -> b) -> PSQ k a -> PSQ k b
maximumBy :: (k -> Int) -> PSQ k a -> (k, a)
minimumBy :: (a -> Int) -> PSQ k a -> PSQ k a
null :: PSQ k a -> Bool

-- | Sort the list so that values satisfying the predicate are first.
prefer :: (a -> Bool) -> PSQ k a -> PSQ k a

-- | Sort the list so that keys satisfying the predicate are first.
preferByKeys :: (k -> Bool) -> PSQ k a -> PSQ k a
snoc :: PSQ k a -> k -> a -> PSQ k a
sortBy :: (a -> a -> Ordering) -> PSQ k a -> PSQ k a
sortByKeys :: (k -> k -> Ordering) -> PSQ k a -> PSQ k a
toList :: PSQ k a -> [(k, a)]
union :: PSQ k a -> PSQ k a -> PSQ k a
instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Distribution.Solver.Modular.PSQ.PSQ k v)
instance GHC.Internal.Data.Foldable.Foldable (Distribution.Solver.Modular.PSQ.PSQ k)
instance GHC.Internal.Base.Functor (Distribution.Solver.Modular.PSQ.PSQ k)
instance (GHC.Internal.Show.Show k, GHC.Internal.Show.Show v) => GHC.Internal.Show.Show (Distribution.Solver.Modular.PSQ.PSQ k v)
instance GHC.Internal.Data.Traversable.Traversable (Distribution.Solver.Modular.PSQ.PSQ k)

module Distribution.Solver.Modular.Version

-- | Preliminary type for versions.
type Ver = Version

-- | Version range. Consists of a lower and upper bound.
type VR = VersionRange

-- | Unconstrained version range.
anyVR :: VR

-- | Checking a version against a version range.
checkVR :: VR -> Ver -> Bool

-- | Version range fixing a single version.
eqVR :: Ver -> VR

-- | String representation of a version.
showVer :: Ver -> String

-- | String representation of a version range.
showVR :: VR -> String

-- | Simplify a version range.
simplifyVR :: VR -> VR

-- | Intersect two version ranges.
(.&&.) :: VR -> VR -> VR

-- | Union of two version ranges.
(.||.) :: VR -> VR -> VR

module Distribution.Solver.Modular.WeightedPSQ

-- | An association list that is sorted by weight.
--   
--   Each element has a key (<tt>k</tt>), value (<tt>v</tt>), and weight
--   (<tt>w</tt>). All operations that add elements or modify weights
--   stably sort the elements by weight.
data WeightedPSQ w k v

-- | <i>O(N log N)</i>.
fromList :: Ord w => [(w, k, v)] -> WeightedPSQ w k v

-- | <i>O(1)</i>. Return the elements in order.
toList :: WeightedPSQ w k v -> [(w, k, v)]

-- | <i>O(N)</i>. Return the keys in order.
keys :: WeightedPSQ w k v -> [k]

-- | <i>O(N)</i>. Return the weights in order.
weights :: WeightedPSQ w k v -> [w]

-- | <i>O(1)</i>. Return <tt>True</tt> if the <tt>WeightedPSQ</tt> contains
--   zero or one elements.
isZeroOrOne :: WeightedPSQ w k v -> Bool

-- | <i>O(N)</i>.
filter :: (v -> Bool) -> WeightedPSQ k w v -> WeightedPSQ k w v

-- | <i>O(N)</i>. Return the value associated with the first occurrence of
--   the give key, if it exists.
lookup :: Eq k => k -> WeightedPSQ w k v -> Maybe v

-- | <i>O(N)</i>. Update the values.
mapWithKey :: (k -> v1 -> v2) -> WeightedPSQ w k v1 -> WeightedPSQ w k v2

-- | <i>O(N log N)</i>. Update the weights.
mapWeightsWithKey :: Ord w2 => (k -> w1 -> w2) -> WeightedPSQ w1 k v -> WeightedPSQ w2 k v

-- | <i>O(N)</i>. Traverse and update values in some applicative functor.
traverseWithKey :: Applicative f => (k -> v -> f v') -> WeightedPSQ w k v -> f (WeightedPSQ w k v')

-- | <i>O((N + M) log (N + M))</i>. Combine two <tt>WeightedPSQ</tt>s,
--   preserving all elements. Elements from the first <tt>WeightedPSQ</tt>
--   come before elements in the second when they have the same weight.
union :: Ord w => WeightedPSQ w k v -> WeightedPSQ w k v -> WeightedPSQ w k v

-- | <i>O(N)</i>. Return the prefix of values ending with the first element
--   that satisfies p, or all elements if none satisfy p.
takeUntil :: forall w k v. (v -> Bool) -> WeightedPSQ w k v -> WeightedPSQ w k v
instance (GHC.Classes.Eq w, GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Distribution.Solver.Modular.WeightedPSQ.WeightedPSQ w k v)
instance GHC.Internal.Data.Foldable.Foldable (Distribution.Solver.Modular.WeightedPSQ.WeightedPSQ w k)
instance GHC.Internal.Base.Functor (Distribution.Solver.Modular.WeightedPSQ.WeightedPSQ w k)
instance (GHC.Internal.Show.Show w, GHC.Internal.Show.Show k, GHC.Internal.Show.Show v) => GHC.Internal.Show.Show (Distribution.Solver.Modular.WeightedPSQ.WeightedPSQ w k v)
instance GHC.Internal.Data.Traversable.Traversable (Distribution.Solver.Modular.WeightedPSQ.WeightedPSQ w k)


-- | Fine-grained package dependencies
--   
--   Like many others, this module is meant to be "double-imported":
--   
--   <pre>
--   import Distribution.Solver.Types.ComponentDeps (
--       Component
--     , ComponentDep
--     , ComponentDeps
--     )
--   import qualified Distribution.Solver.Types.ComponentDeps as CD
--   </pre>
module Distribution.Solver.Types.ComponentDeps

-- | Component of a package.
data Component
ComponentLib :: Component
ComponentSubLib :: UnqualComponentName -> Component
ComponentFLib :: UnqualComponentName -> Component
ComponentExe :: UnqualComponentName -> Component
ComponentTest :: UnqualComponentName -> Component
ComponentBench :: UnqualComponentName -> Component
ComponentSetup :: Component
componentNameToComponent :: ComponentName -> Component

-- | Dependency for a single component.
type ComponentDep a = (Component, a)

-- | Fine-grained dependencies for a package.
--   
--   Typically used as <tt>ComponentDeps [Dependency]</tt>, to represent
--   the list of dependencies for each named component within a package.
data ComponentDeps a
empty :: ComponentDeps a
fromList :: Monoid a => [ComponentDep a] -> ComponentDeps a
singleton :: Component -> a -> ComponentDeps a
insert :: Monoid a => Component -> a -> ComponentDeps a -> ComponentDeps a

-- | Zip two <a>ComponentDeps</a> together by <a>Component</a>, using
--   <a>mempty</a> as the neutral element when a <a>Component</a> is
--   present only in one.
zip :: (Monoid a, Monoid b) => ComponentDeps a -> ComponentDeps b -> ComponentDeps (a, b)

-- | Keep only selected components (and their associated deps info).
filterDeps :: (Component -> a -> Bool) -> ComponentDeps a -> ComponentDeps a

-- | Keep only selected components (and their associated deps info).
mapDeps :: (Component -> a -> b) -> ComponentDeps a -> ComponentDeps b

-- | ComponentDeps containing library dependencies only
fromLibraryDeps :: a -> ComponentDeps a

-- | ComponentDeps containing setup dependencies only.
fromSetupDeps :: a -> ComponentDeps a

-- | ComponentDeps for installed packages.
--   
--   We assume that installed packages only record their library
--   dependencies.
fromInstalled :: a -> ComponentDeps a
toList :: ComponentDeps a -> [ComponentDep a]

-- | All dependencies of a package.
--   
--   This is just a synonym for <a>fold</a>, but perhaps a use of
--   <a>flatDeps</a> is more obvious than a use of <a>fold</a>, and
--   moreover this avoids introducing lots of <tt>#ifdef</tt>s for 7.10
--   just for the use of <a>fold</a>.
flatDeps :: Monoid a => ComponentDeps a -> a

-- | All dependencies except the setup dependencies.
--   
--   Prior to the introduction of setup dependencies in version 1.24 this
--   would have been _all_ dependencies.
nonSetupDeps :: Monoid a => ComponentDeps a -> a

-- | Library dependencies proper only. (Includes dependencies of internal
--   libraries.)
libraryDeps :: Monoid a => ComponentDeps a -> a

-- | Setup dependencies.
setupDeps :: Monoid a => ComponentDeps a -> a

-- | Select dependencies satisfying a given predicate.
select :: Monoid a => (Component -> Bool) -> ComponentDeps a -> a

-- | List components
components :: ComponentDeps a -> Set Component
instance Data.Binary.Class.Binary Distribution.Solver.Types.ComponentDeps.Component
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Distribution.Solver.Types.ComponentDeps.ComponentDeps a)
instance GHC.Classes.Eq Distribution.Solver.Types.ComponentDeps.Component
instance GHC.Classes.Eq a => GHC.Classes.Eq (Distribution.Solver.Types.ComponentDeps.ComponentDeps a)
instance GHC.Internal.Data.Foldable.Foldable Distribution.Solver.Types.ComponentDeps.ComponentDeps
instance GHC.Internal.Base.Functor Distribution.Solver.Types.ComponentDeps.ComponentDeps
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.ComponentDeps.Component
instance GHC.Internal.Generics.Generic (Distribution.Solver.Types.ComponentDeps.ComponentDeps a)
instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Monoid (Distribution.Solver.Types.ComponentDeps.ComponentDeps a)
instance GHC.Classes.Ord Distribution.Solver.Types.ComponentDeps.Component
instance GHC.Classes.Ord a => GHC.Classes.Ord (Distribution.Solver.Types.ComponentDeps.ComponentDeps a)
instance Distribution.Pretty.Pretty Distribution.Solver.Types.ComponentDeps.Component
instance GHC.Internal.Base.Semigroup a => GHC.Internal.Base.Semigroup (Distribution.Solver.Types.ComponentDeps.ComponentDeps a)
instance GHC.Internal.Show.Show Distribution.Solver.Types.ComponentDeps.Component
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Distribution.Solver.Types.ComponentDeps.ComponentDeps a)
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.ComponentDeps.Component
instance Distribution.Utils.Structured.Structured a => Distribution.Utils.Structured.Structured (Distribution.Solver.Types.ComponentDeps.ComponentDeps a)
instance GHC.Internal.Data.Traversable.Traversable Distribution.Solver.Types.ComponentDeps.ComponentDeps

module Distribution.Solver.Types.Flag
data FlagType
Manual :: FlagType
Automatic :: FlagType
instance GHC.Classes.Eq Distribution.Solver.Types.Flag.FlagType
instance GHC.Internal.Show.Show Distribution.Solver.Types.Flag.FlagType

module Distribution.Solver.Types.InstalledPreference

-- | Whether we prefer an installed version of a package or simply the
--   latest version.
data InstalledPreference
PreferInstalled :: InstalledPreference
PreferLatest :: InstalledPreference
PreferOldest :: InstalledPreference
instance GHC.Internal.Show.Show Distribution.Solver.Types.InstalledPreference.InstalledPreference

module Distribution.Solver.Types.OptionalStanza
data OptionalStanza
TestStanzas :: OptionalStanza
BenchStanzas :: OptionalStanza

-- | String representation of an OptionalStanza.
showStanza :: OptionalStanza -> String
showStanzas :: OptionalStanzaSet -> String

-- | Convert a list of <a>OptionalStanza</a> into the corresponding Cabal's
--   <a>ComponentRequestedSpec</a> which records what components are
--   enabled.
enableStanzas :: OptionalStanzaSet -> ComponentRequestedSpec
data OptionalStanzaSet
optStanzaSetFromList :: [OptionalStanza] -> OptionalStanzaSet
optStanzaSetToList :: OptionalStanzaSet -> [OptionalStanza]
optStanzaSetMember :: OptionalStanza -> OptionalStanzaSet -> Bool
optStanzaSetInsert :: OptionalStanza -> OptionalStanzaSet -> OptionalStanzaSet
optStanzaSetSingleton :: OptionalStanza -> OptionalStanzaSet
optStanzaSetIntersection :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
optStanzaSetNull :: OptionalStanzaSet -> Bool
optStanzaSetIsSubset :: OptionalStanzaSet -> OptionalStanzaSet -> Bool

-- | Note: this is total map.
data OptionalStanzaMap a
optStanzaTabulate :: (OptionalStanza -> a) -> OptionalStanzaMap a
optStanzaIndex :: OptionalStanzaMap a -> OptionalStanza -> a
optStanzaLookup :: OptionalStanza -> OptionalStanzaMap a -> a
optStanzaKeysFilteredByValue :: (a -> Bool) -> OptionalStanzaMap a -> OptionalStanzaSet
instance Data.Binary.Class.Binary Distribution.Solver.Types.OptionalStanza.OptionalStanza
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Distribution.Solver.Types.OptionalStanza.OptionalStanzaMap a)
instance Data.Binary.Class.Binary Distribution.Solver.Types.OptionalStanza.OptionalStanzaSet
instance GHC.Internal.Enum.Bounded Distribution.Solver.Types.OptionalStanza.OptionalStanza
instance GHC.Internal.Enum.Enum Distribution.Solver.Types.OptionalStanza.OptionalStanza
instance GHC.Classes.Eq Distribution.Solver.Types.OptionalStanza.OptionalStanza
instance GHC.Classes.Eq a => GHC.Classes.Eq (Distribution.Solver.Types.OptionalStanza.OptionalStanzaMap a)
instance GHC.Classes.Eq Distribution.Solver.Types.OptionalStanza.OptionalStanzaSet
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.OptionalStanza.OptionalStanza
instance GHC.Internal.Generics.Generic (Distribution.Solver.Types.OptionalStanza.OptionalStanzaMap a)
instance GHC.Internal.Base.Monoid Distribution.Solver.Types.OptionalStanza.OptionalStanzaSet
instance GHC.Classes.Ord Distribution.Solver.Types.OptionalStanza.OptionalStanza
instance GHC.Classes.Ord a => GHC.Classes.Ord (Distribution.Solver.Types.OptionalStanza.OptionalStanzaMap a)
instance GHC.Classes.Ord Distribution.Solver.Types.OptionalStanza.OptionalStanzaSet
instance GHC.Internal.Base.Semigroup Distribution.Solver.Types.OptionalStanza.OptionalStanzaSet
instance GHC.Internal.Show.Show Distribution.Solver.Types.OptionalStanza.OptionalStanza
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Distribution.Solver.Types.OptionalStanza.OptionalStanzaMap a)
instance GHC.Internal.Show.Show Distribution.Solver.Types.OptionalStanza.OptionalStanzaSet
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.OptionalStanza.OptionalStanza
instance Distribution.Utils.Structured.Structured a => Distribution.Utils.Structured.Structured (Distribution.Solver.Types.OptionalStanza.OptionalStanzaMap a)
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.OptionalStanza.OptionalStanzaSet

module Distribution.Solver.Types.PackageFixedDeps

-- | Subclass of packages that have specific versioned dependencies.
--   
--   So for example a not-yet-configured package has dependencies on
--   version ranges, not specific versions. A configured or an already
--   installed package depends on exact versions. Some operations or data
--   structures (like dependency graphs) only make sense on this subclass
--   of package types.
class Package pkg => PackageFixedDeps pkg
depends :: PackageFixedDeps pkg => pkg -> ComponentDeps [UnitId]
instance Distribution.Solver.Types.PackageFixedDeps.PackageFixedDeps Distribution.Types.InstalledPackageInfo.InstalledPackageInfo


-- | An index of packages.
module Distribution.Solver.Types.PackageIndex

-- | The collection of information about packages from one or more
--   <tt>PackageDB</tt>s.
--   
--   It can be searched efficiently by package name and version.
data PackageIndex pkg

-- | Build an index out of a bunch of packages.
--   
--   If there are duplicates, later ones mask earlier ones.
fromList :: Package pkg => [pkg] -> PackageIndex pkg

-- | Merge two indexes.
--   
--   Packages from the second mask packages of the same exact name
--   (case-sensitively) from the first.
merge :: Package pkg => PackageIndex pkg -> PackageIndex pkg -> PackageIndex pkg

-- | Override-merge of two indexes.
--   
--   Packages from the second mask packages of the same exact name
--   (case-sensitively) from the first.
override :: Package pkg => PackageIndex pkg -> PackageIndex pkg -> PackageIndex pkg

-- | Inserts a single package into the index.
--   
--   This is equivalent to (but slightly quicker than) using <a>mappend</a>
--   or <a>merge</a> with a singleton index.
insert :: Package pkg => pkg -> PackageIndex pkg -> PackageIndex pkg

-- | Removes all packages with this (case-sensitive) name from the index.
deletePackageName :: Package pkg => PackageName -> PackageIndex pkg -> PackageIndex pkg

-- | Removes a single package from the index.
deletePackageId :: Package pkg => PackageIdentifier -> PackageIndex pkg -> PackageIndex pkg

-- | Removes all packages satisfying this dependency from the index.
deleteDependency :: Package pkg => PackageName -> VersionRange -> PackageIndex pkg -> PackageIndex pkg
elemByPackageId :: Package pkg => PackageIndex pkg -> PackageIdentifier -> Bool
elemByPackageName :: Package pkg => PackageIndex pkg -> PackageName -> Bool

-- | Does a case-sensitive search by package name.
lookupPackageName :: Package pkg => PackageIndex pkg -> PackageName -> [pkg]

-- | Does a lookup by package id (name &amp; version).
--   
--   Since multiple package DBs mask each other case-sensitively by package
--   name, then we get back at most one package.
lookupPackageId :: Package pkg => PackageIndex pkg -> PackageIdentifier -> Maybe pkg

-- | Does a case-sensitive search by package name and a range of versions.
--   
--   We get back any number of versions of the specified package name, all
--   satisfying the version range constraint.
lookupDependency :: Package pkg => PackageIndex pkg -> PackageName -> VersionRange -> [pkg]

-- | Does a case-insensitive search by package name.
--   
--   If there is only one package that compares case-insensitively to this
--   name then the search is unambiguous and we get back all versions of
--   that package. If several match case-insensitively but one matches
--   exactly then it is also unambiguous.
--   
--   If however several match case-insensitively and none match exactly
--   then we have an ambiguous result, and we get back all the versions of
--   all the packages. The list of ambiguous results is split by exact
--   package name. So it is a non-empty list of non-empty lists.
searchByName :: PackageIndex pkg -> String -> [(PackageName, [pkg])]
data SearchResult a
None :: SearchResult a
Unambiguous :: a -> SearchResult a
Ambiguous :: [a] -> SearchResult a

-- | Does a case-insensitive substring search by package name.
--   
--   That is, all packages that contain the given string in their name.
searchByNameSubstring :: PackageIndex pkg -> String -> [(PackageName, [pkg])]
searchWithPredicate :: PackageIndex pkg -> (String -> Bool) -> [(PackageName, [pkg])]

-- | Get all the packages from the index.
allPackages :: PackageIndex pkg -> [pkg]

-- | Get all the packages from the index.
--   
--   They are grouped by package name, case-sensitively.
allPackagesByName :: PackageIndex pkg -> [[pkg]]
instance Data.Binary.Class.Binary pkg => Data.Binary.Class.Binary (Distribution.Solver.Types.PackageIndex.PackageIndex pkg)
instance GHC.Classes.Eq pkg => GHC.Classes.Eq (Distribution.Solver.Types.PackageIndex.PackageIndex pkg)
instance GHC.Internal.Base.Functor Distribution.Solver.Types.PackageIndex.PackageIndex
instance GHC.Internal.Generics.Generic (Distribution.Solver.Types.PackageIndex.PackageIndex pkg)
instance Distribution.Package.Package pkg => GHC.Internal.Base.Monoid (Distribution.Solver.Types.PackageIndex.PackageIndex pkg)
instance GHC.Internal.Read.Read pkg => GHC.Internal.Read.Read (Distribution.Solver.Types.PackageIndex.PackageIndex pkg)
instance Distribution.Package.Package pkg => GHC.Internal.Base.Semigroup (Distribution.Solver.Types.PackageIndex.PackageIndex pkg)
instance GHC.Internal.Show.Show pkg => GHC.Internal.Show.Show (Distribution.Solver.Types.PackageIndex.PackageIndex pkg)

module Distribution.Solver.Types.PackagePath

-- | A package path consists of a namespace and a package path inside that
--   namespace.
data PackagePath
PackagePath :: Namespace -> Qualifier -> PackagePath

-- | Top-level namespace
--   
--   Package choices in different namespaces are considered completely
--   independent by the solver.
data Namespace

-- | The default namespace
DefaultNamespace :: Namespace

-- | A namespace for a specific build target
Independent :: PackageName -> Namespace

-- | Qualifier of a package within a namespace (see <a>PackagePath</a>)
data Qualifier

-- | Top-level dependency in this namespace
QualToplevel :: Qualifier

-- | Any dependency on base is considered independent
--   
--   This makes it possible to have base shims.
QualBase :: PackageName -> Qualifier

-- | Setup dependency
--   
--   By rights setup dependencies ought to be nestable; after all, the
--   setup dependencies of a package might themselves have setup
--   dependencies, which are independent from everything else. However,
--   this very quickly leads to infinite search trees in the solver.
--   Therefore we limit ourselves to a single qualifier (within a given
--   namespace).
QualSetup :: PackageName -> Qualifier

-- | If we depend on an executable from a package (via
--   <tt>build-tools</tt>), we should solve for the dependencies of that
--   package separately (since we're not going to actually try to link it.)
--   We qualify for EACH package separately; e.g., <tt><tt>Exe</tt> pn1
--   pn2</tt> qualifies the <tt>build-tools</tt> dependency on <tt>pn2</tt>
--   from package <tt>pn1</tt>. (If we tracked only <tt>pn1</tt>, that
--   would require a consistent dependency resolution for all of the
--   depended upon executables from a package; if we tracked only
--   <tt>pn2</tt>, that would require us to pick only one version of an
--   executable over the entire install plan.)
QualExe :: PackageName -> PackageName -> Qualifier

-- | Pretty-prints a qualifier. The result is either empty or ends in a
--   period, so it can be prepended onto a package name.
--   
--   NOTE: the base qualifier is for a dependency _on_ base; the qualifier
--   is there to make sure different dependencies on base are all
--   independent. So we want to print something like <tt>"A.base"</tt>,
--   where the <tt>"A."</tt> part is the qualifier and <tt>"base"</tt> is
--   the actual dependency (which, for the <tt>Base</tt> qualifier, will
--   always be <tt>base</tt>).
dispQualifier :: Qualifier -> Doc

-- | A qualified entity. Pairs a package path with the entity.
data Qualified a
Q :: PackagePath -> a -> Qualified a

-- | Qualified package name.
type QPN = Qualified PackageName

-- | Pretty-prints a qualified package name.
dispQPN :: QPN -> Doc

-- | String representation of a qualified package name.
showQPN :: QPN -> String
instance GHC.Classes.Eq Distribution.Solver.Types.PackagePath.Namespace
instance GHC.Classes.Eq Distribution.Solver.Types.PackagePath.PackagePath
instance GHC.Classes.Eq a => GHC.Classes.Eq (Distribution.Solver.Types.PackagePath.Qualified a)
instance GHC.Classes.Eq Distribution.Solver.Types.PackagePath.Qualifier
instance GHC.Classes.Ord Distribution.Solver.Types.PackagePath.Namespace
instance GHC.Classes.Ord Distribution.Solver.Types.PackagePath.PackagePath
instance GHC.Classes.Ord a => GHC.Classes.Ord (Distribution.Solver.Types.PackagePath.Qualified a)
instance GHC.Classes.Ord Distribution.Solver.Types.PackagePath.Qualifier
instance GHC.Internal.Show.Show Distribution.Solver.Types.PackagePath.Namespace
instance GHC.Internal.Show.Show Distribution.Solver.Types.PackagePath.PackagePath
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Distribution.Solver.Types.PackagePath.Qualified a)
instance GHC.Internal.Show.Show Distribution.Solver.Types.PackagePath.Qualifier


-- | Per-package constraints. Package constraints must be respected by the
--   solver. Multiple constraints for each package can be given, though
--   obviously it is possible to construct conflicting constraints (eg
--   impossible version range or inconsistent flag assignment).
module Distribution.Solver.Types.PackageConstraint

-- | Determines to what packages and in what contexts a constraint applies.
data ConstraintScope

-- | A scope that applies when the given package is used as a build target.
--   In other words, the scope applies iff a goal has a top-level qualifier
--   and its namespace matches the given package name. A namespace is
--   considered to match a package name when it is either the default
--   namespace (for --no-independent-goals) or it is an independent
--   namespace with the given package name (for --independent-goals).
ScopeTarget :: PackageName -> ConstraintScope

-- | The package with the specified name and qualifier.
ScopeQualified :: Qualifier -> PackageName -> ConstraintScope

-- | The package with the specified name when it has a setup qualifier.
ScopeAnySetupQualifier :: PackageName -> ConstraintScope

-- | The package with the specified name regardless of qualifier.
ScopeAnyQualifier :: PackageName -> ConstraintScope

-- | Constructor for a common use case: the constraint applies to the
--   package with the specified name when that package is a top-level
--   dependency in the default namespace.
scopeToplevel :: PackageName -> ConstraintScope

-- | Returns the package name associated with a constraint scope.
scopeToPackageName :: ConstraintScope -> PackageName
constraintScopeMatches :: ConstraintScope -> QPN -> Bool

-- | A package property is a logical predicate on packages.
data PackageProperty
PackagePropertyVersion :: VersionRange -> PackageProperty
PackagePropertyInstalled :: PackageProperty
PackagePropertySource :: PackageProperty
PackagePropertyFlags :: FlagAssignment -> PackageProperty
PackagePropertyStanzas :: [OptionalStanza] -> PackageProperty

-- | Pretty-prints a package property.
dispPackageProperty :: PackageProperty -> Doc

-- | A package constraint consists of a scope plus a property that must
--   hold for all packages within that scope.
data PackageConstraint
PackageConstraint :: ConstraintScope -> PackageProperty -> PackageConstraint

-- | Pretty-prints a package constraint.
dispPackageConstraint :: PackageConstraint -> Doc

-- | Alternative textual representation of a package constraint for
--   debugging purposes (slightly more verbose than that produced by
--   <a>dispPackageConstraint</a>).
showPackageConstraint :: PackageConstraint -> String

-- | Lossily convert a <a>PackageConstraint</a> to a <tt>Dependency</tt>.
packageConstraintToDependency :: PackageConstraint -> Maybe PackageVersionConstraint
instance Data.Binary.Class.Binary Distribution.Solver.Types.PackageConstraint.PackageProperty
instance GHC.Classes.Eq Distribution.Solver.Types.PackageConstraint.ConstraintScope
instance GHC.Classes.Eq Distribution.Solver.Types.PackageConstraint.PackageConstraint
instance GHC.Classes.Eq Distribution.Solver.Types.PackageConstraint.PackageProperty
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.PackageConstraint.PackageProperty
instance GHC.Internal.Show.Show Distribution.Solver.Types.PackageConstraint.ConstraintScope
instance GHC.Internal.Show.Show Distribution.Solver.Types.PackageConstraint.PackageConstraint
instance GHC.Internal.Show.Show Distribution.Solver.Types.PackageConstraint.PackageProperty
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.PackageConstraint.PackageProperty

module Distribution.Solver.Modular.Package

-- | Instance. A version number and a location.
data I
I :: Ver -> Loc -> I

-- | Location. Info about whether a package is installed or not, and where
--   exactly it is located. For installed packages, uniquely identifies the
--   package instance via its <a>PId</a>.
--   
--   TODO: More information is needed about the repo.
data Loc
Inst :: PId -> Loc
InRepo :: Loc
type PackageId = PackageIdentifier
data PackageIdentifier
PackageIdentifier :: PackageName -> Version -> PackageIdentifier
[pkgName] :: PackageIdentifier -> PackageName
[pkgVersion] :: PackageIdentifier -> Version
data PackageName
mkPackageName :: String -> PackageName
unPackageName :: PackageName -> String
data PkgconfigName
mkPkgconfigName :: String -> PkgconfigName
unPkgconfigName :: PkgconfigName -> String

-- | Package instance. A package name and an instance.
data PI qpn
PI :: qpn -> I -> PI qpn

-- | A package name.
type PN = PackageName

-- | Qualified package version.
type QPV = Qualified PV
instI :: I -> Bool

-- | Qualify a target package with its own name so that its dependencies
--   are not required to be consistent with other targets.
makeIndependent :: PN -> QPN

-- | Is the package in the primary group of packages. This is used to
--   determine (1) if we should try to establish stanza preferences for
--   this goal, and (2) whether or not a user specified
--   <tt>--constraint</tt> should apply to this dependency (grep
--   <a>primaryPP</a> to see the use sites). In particular this does not
--   include packages pulled in as setup deps.
primaryPP :: PackagePath -> Bool

-- | Is the package a dependency of a setup script. This is used to
--   establish whether or not certain constraints should apply to this
--   dependency (grep <a>setupPP</a> to see the use sites).
setupPP :: PackagePath -> Bool

-- | String representation of an instance.
showI :: I -> String

-- | String representation of a package instance.
showPI :: PI QPN -> String

-- | Unpacking a package name.
unPN :: PN -> String
instance GHC.Classes.Eq Distribution.Solver.Modular.Package.I
instance GHC.Classes.Eq Distribution.Solver.Modular.Package.Loc
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.Package.PI qpn)
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Package.PI
instance GHC.Classes.Ord Distribution.Solver.Modular.Package.I
instance GHC.Classes.Ord Distribution.Solver.Modular.Package.Loc
instance GHC.Classes.Ord qpn => GHC.Classes.Ord (Distribution.Solver.Modular.Package.PI qpn)
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Package.I
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Package.Loc
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Modular.Package.PI qpn)

module Distribution.Solver.Modular.Configured

-- | A configured package is a package instance together with a flag
--   assignment and complete dependencies.
data CP qpn
CP :: PI qpn -> FlagAssignment -> OptionalStanzaSet -> ComponentDeps [PI qpn] -> CP qpn

module Distribution.Solver.Modular.Flag

-- | Flag info. Default value, whether the flag is manual, and whether the
--   flag is weak. Manual flags can only be set explicitly. Weak flags are
--   typically deferred by the solver.
data FInfo
FInfo :: Bool -> FlagType -> WeakOrTrivial -> FInfo
[fdefault] :: FInfo -> Bool
[fmanual] :: FInfo -> FlagType
[fweak] :: FInfo -> WeakOrTrivial

-- | Flag identifier. Just a string.
type Flag = FlagName

-- | Flag defaults.
type FlagInfo = Map Flag FInfo

-- | Flag name. Consists of a package instance and the flag identifier
--   itself.
data FN qpn
FN :: qpn -> Flag -> FN qpn

-- | Qualified flag name.
type QFN = FN QPN

-- | Qualified stanza name.
type QSN = SN QPN

-- | Stanza identifier.
type Stanza = OptionalStanza

-- | Stanza name. Paired with a package name, much like a flag.
data SN qpn
SN :: qpn -> Stanza -> SN qpn

-- | A property of flag and stanza choices that determines whether the
--   choice should be deferred in the solving process.
--   
--   A choice is called weak if we do want to defer it. This is the case
--   for flags that should be implied by what's currently installed on the
--   system, as opposed to flags that are used to explicitly enable or
--   disable some functionality.
--   
--   A choice is called trivial if it clearly does not matter. The special
--   case of triviality we actually consider is if there are no new
--   dependencies introduced by the choice.
newtype WeakOrTrivial
WeakOrTrivial :: Bool -> WeakOrTrivial
[unWeakOrTrivial] :: WeakOrTrivial -> Bool

-- | Value shown for a flag in a solver log message. The message can refer
--   to only the true choice, only the false choice, or both choices.
data FlagValue
FlagTrue :: FlagValue
FlagFalse :: FlagValue
FlagBoth :: FlagValue
mkFlag :: String -> Flag
showQFN :: QFN -> String
showQFNBool :: QFN -> Bool -> String

-- | String representation of a flag-value pair.
showFlagValue :: FlagName -> FlagValue -> String
showQSN :: QSN -> String
showQSNBool :: QSN -> Bool -> String
showSBool :: Stanza -> Bool -> String
instance GHC.Classes.Eq Distribution.Solver.Modular.Flag.FInfo
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.Flag.FN qpn)
instance GHC.Classes.Eq Distribution.Solver.Modular.Flag.FlagValue
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.Flag.SN qpn)
instance GHC.Classes.Eq Distribution.Solver.Modular.Flag.WeakOrTrivial
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Flag.FN
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Flag.SN
instance GHC.Classes.Ord qpn => GHC.Classes.Ord (Distribution.Solver.Modular.Flag.FN qpn)
instance GHC.Classes.Ord qpn => GHC.Classes.Ord (Distribution.Solver.Modular.Flag.SN qpn)
instance GHC.Classes.Ord Distribution.Solver.Modular.Flag.WeakOrTrivial
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Flag.FInfo
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Modular.Flag.FN qpn)
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Flag.FlagValue
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Modular.Flag.SN qpn)
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Flag.WeakOrTrivial

module Distribution.Solver.Modular.Var

-- | The type of variables that play a role in the solver. Note that the
--   tree currently does not use this type directly, and rather has
--   separate tree nodes for the different types of variables. This fits
--   better with the fact that in most cases, these have to be treated
--   differently.
data Var qpn
P :: qpn -> Var qpn
F :: FN qpn -> Var qpn
S :: SN qpn -> Var qpn
showVar :: Var QPN -> String

-- | Extract the package name from a Var
varPN :: Var qpn -> qpn
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.Var.Var qpn)
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Var.Var
instance GHC.Classes.Ord qpn => GHC.Classes.Ord (Distribution.Solver.Modular.Var.Var qpn)
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Modular.Var.Var qpn)


-- | Conflict sets
--   
--   Intended for double import
--   
--   <pre>
--   import Distribution.Solver.Modular.ConflictSet (ConflictSet)
--   import qualified Distribution.Solver.Modular.ConflictSet as CS
--   </pre>
module Distribution.Solver.Modular.ConflictSet

-- | The set of variables involved in a solver conflict, each paired with
--   details about the conflict.
data ConflictSet

-- | More detailed information about how a conflict set variable caused a
--   conflict. This information can be used to determine whether a second
--   value for that variable would lead to the same conflict.
--   
--   TODO: Handle dependencies under flags or stanzas.
data Conflict

-- | The conflict set variable represents a package which depends on the
--   specified problematic package. For example, the conflict set entry '(P
--   x, GoalConflict y)' means that package x introduced package y, and y
--   led to a conflict.
GoalConflict :: QPN -> Conflict

-- | The conflict set variable represents a package with a constraint that
--   excluded the specified package and version. For example, the conflict
--   set entry '(P x, VersionConstraintConflict y (mkVersion [2, 0]))'
--   means that package x's constraint on y excluded y-2.0.
VersionConstraintConflict :: QPN -> Ver -> Conflict

-- | The conflict set variable represents a package that was excluded by a
--   constraint from the specified package. For example, the conflict set
--   entry '(P x, VersionConflict y (orLaterVersion (mkVersion [2, 0])))'
--   means that package y's constraint 'x &gt;= 2.0' excluded some version
--   of x.
VersionConflict :: QPN -> OrderedVersionRange -> Conflict

-- | Any other conflict.
OtherConflict :: Conflict
type ConflictMap = Map Var QPN Int

-- | Version range with an <a>Ord</a> instance.
newtype OrderedVersionRange
OrderedVersionRange :: VR -> OrderedVersionRange
showConflictSet :: ConflictSet -> String
showCSSortedByFrequency :: ConflictMap -> ConflictSet -> String
showCSWithFrequency :: ConflictMap -> ConflictSet -> String
toSet :: ConflictSet -> Set (Var QPN)
toList :: ConflictSet -> [Var QPN]
union :: ConflictSet -> ConflictSet -> ConflictSet
unions :: [ConflictSet] -> ConflictSet
insert :: Var QPN -> ConflictSet -> ConflictSet
delete :: Var QPN -> ConflictSet -> ConflictSet
empty :: ConflictSet
singleton :: Var QPN -> ConflictSet
singletonWithConflict :: Var QPN -> Conflict -> ConflictSet
size :: ConflictSet -> Int
member :: Var QPN -> ConflictSet -> Bool
lookup :: Var QPN -> ConflictSet -> Maybe (Set Conflict)
filter :: (a -> Bool) -> [a] -> [a]
fromList :: [Var QPN] -> ConflictSet
instance GHC.Classes.Eq Distribution.Solver.Modular.ConflictSet.Conflict
instance GHC.Classes.Eq Distribution.Solver.Modular.ConflictSet.ConflictSet
instance GHC.Classes.Eq Distribution.Solver.Modular.ConflictSet.OrderedVersionRange
instance GHC.Classes.Ord Distribution.Solver.Modular.ConflictSet.Conflict
instance GHC.Classes.Ord Distribution.Solver.Modular.ConflictSet.OrderedVersionRange
instance GHC.Internal.Show.Show Distribution.Solver.Modular.ConflictSet.Conflict
instance GHC.Internal.Show.Show Distribution.Solver.Modular.ConflictSet.ConflictSet
instance GHC.Internal.Show.Show Distribution.Solver.Modular.ConflictSet.OrderedVersionRange

module Distribution.Solver.Modular.Dependency

-- | The type of variables that play a role in the solver. Note that the
--   tree currently does not use this type directly, and rather has
--   separate tree nodes for the different types of variables. This fits
--   better with the fact that in most cases, these have to be treated
--   differently.
data Var qpn
P :: qpn -> Var qpn
F :: FN qpn -> Var qpn
S :: SN qpn -> Var qpn
showVar :: Var QPN -> String

-- | Extract the package name from a Var
varPN :: Var qpn -> qpn

-- | The set of variables involved in a solver conflict, each paired with
--   details about the conflict.
data ConflictSet
type ConflictMap = Map Var QPN Int
showConflictSet :: ConflictSet -> String

-- | Constrained instance. It represents the allowed instances for a
--   package, which can be either a fixed instance or a version range.
data CI
Fixed :: I -> CI
Constrained :: VR -> CI

-- | Flagged dependencies
--   
--   <a>FlaggedDeps</a> is the modular solver's view of a packages
--   dependencies: rather than having the dependencies indexed by
--   component, each dependency defines what component it is in.
--   
--   Note that each dependency is associated with a Component. We must know
--   what component the dependencies belong to, or else we won't be able to
--   construct fine-grained reverse dependencies.
type FlaggedDeps qpn = [FlaggedDep qpn]

-- | Flagged dependencies can either be plain dependency constraints, or
--   flag-dependent dependency trees.
data FlaggedDep qpn

-- | Dependencies which are conditional on a flag choice.
Flagged :: FN qpn -> FInfo -> TrueFlaggedDeps qpn -> FalseFlaggedDeps qpn -> FlaggedDep qpn

-- | Dependencies which are conditional on whether or not a stanza (e.g., a
--   test suite or benchmark) is enabled.
Stanza :: SN qpn -> TrueFlaggedDeps qpn -> FlaggedDep qpn

-- | Dependencies which are always enabled, for the component
--   <tt>comp</tt>.
Simple :: LDep qpn -> Component -> FlaggedDep qpn

-- | A <a>Dep</a> labeled with the reason it was introduced.
--   
--   <a>LDep</a> intentionally has no <a>Functor</a> instance because the
--   type variable is used both to record the dependencies as well as who's
--   doing the depending; having a <a>Functor</a> instance makes bugs where
--   we don't distinguish these two far too likely. (By rights <a>LDep</a>
--   ought to have two type variables.)
data LDep qpn
LDep :: DependencyReason qpn -> Dep qpn -> LDep qpn

-- | A dependency (constraint) associates a package name with a constrained
--   instance. It can also represent other types of dependencies, such as
--   dependencies on language extensions.
data Dep qpn

-- | dependency on a package component
Dep :: PkgComponent qpn -> CI -> Dep qpn

-- | dependency on a language extension
Ext :: Extension -> Dep qpn

-- | dependency on a language version
Lang :: Language -> Dep qpn

-- | dependency on a pkg-config package
Pkg :: PkgconfigName -> PkgconfigVersionRange -> Dep qpn

-- | An exposed component within a package. This type is used to represent
--   build-depends and build-tool-depends dependencies.
data PkgComponent qpn
PkgComponent :: qpn -> ExposedComponent -> PkgComponent qpn

-- | A component that can be depended upon by another package, i.e., a
--   library or an executable.
data ExposedComponent
ExposedLib :: LibraryName -> ExposedComponent
ExposedExe :: UnqualComponentName -> ExposedComponent

-- | The reason that a dependency is active. It identifies the package and
--   any flag and stanza choices that introduced the dependency. It
--   contains everything needed for creating ConflictSets or describing
--   conflicts in solver log messages.
data DependencyReason qpn
DependencyReason :: qpn -> Map Flag FlagValue -> Set Stanza -> DependencyReason qpn

-- | Print the reason that a dependency was introduced.
showDependencyReason :: DependencyReason QPN -> String

-- | Conservatively flatten out flagged dependencies
--   
--   NOTE: We do not filter out duplicates.
flattenFlaggedDeps :: FlaggedDeps qpn -> [(LDep qpn, Component)]

-- | Options for goal qualification (used in <a>qualifyDeps</a>)
--   
--   See also <tt>defaultQualifyOptions</tt>
data QualifyOptions
QO :: Bool -> Bool -> QualifyOptions

-- | Do we have a version of base relying on another version of base?
[qoBaseShim] :: QualifyOptions -> Bool
[qoSetupIndependent] :: QualifyOptions -> Bool

-- | Apply built-in rules for package qualifiers
--   
--   Although the behaviour of <a>qualifyDeps</a> depends on the
--   <a>QualifyOptions</a>, it is important that these
--   <a>QualifyOptions</a> are _static_. Qualification does NOT depend on
--   flag assignment; in other words, it behaves the same no matter which
--   choices the solver makes (modulo the global <a>QualifyOptions</a>); we
--   rely on this in <tt>linkDeps</tt> (see comment there).
--   
--   NOTE: It's the _dependencies_ of a package that may or may not be
--   independent from the package itself. Package flag choices must of
--   course be consistent.
qualifyDeps :: QualifyOptions -> QPN -> FlaggedDeps PN -> FlaggedDeps QPN

-- | Remove qualifiers from set of dependencies
--   
--   This is used during link validation: when we link package <tt>Q.A</tt>
--   to <tt>Q'.A</tt>, then all dependencies <tt>Q.B</tt> need to be linked
--   to <tt>Q'.B</tt>. In order to compute what to link these dependencies
--   to, we need to requalify <tt>Q.B</tt> to become <tt>Q'.B</tt>; we do
--   this by first removing all qualifiers and then calling
--   <a>qualifyDeps</a> again.
unqualifyDeps :: FlaggedDeps QPN -> FlaggedDeps PN

-- | A map containing reverse dependencies between qualified package names.
type RevDepMap = Map QPN [(Component, QPN)]

-- | A goal is just a solver variable paired with a reason. The reason is
--   only used for tracing.
data Goal qpn
Goal :: Var qpn -> GoalReason qpn -> Goal qpn

-- | Reason why a goal is being added to a goal set.
data GoalReason qpn
UserGoal :: GoalReason qpn
DependencyGoal :: DependencyReason qpn -> GoalReason qpn
type QGoalReason = GoalReason QPN
goalToVar :: Goal a -> Var a

-- | Compute a singleton conflict set from a <a>Var</a>
varToConflictSet :: Var QPN -> ConflictSet

-- | Convert a <a>GoalReason</a> to a <a>ConflictSet</a> that can be used
--   when the goal leads to a conflict.
goalReasonToConflictSet :: GoalReason QPN -> ConflictSet

-- | Convert a <a>GoalReason</a> to a <a>ConflictSet</a> containing the
--   reason that the conflict occurred, namely the conflict set variables
--   caused a conflict by introducing the given package goal. See the
--   documentation for <tt>GoalConflict</tt>.
--   
--   This function currently only specifies the reason for the conflict in
--   the simple case where the <a>GoalReason</a> does not involve any flags
--   or stanzas. Otherwise, it falls back to calling
--   <a>goalReasonToConflictSet</a>.
goalReasonToConflictSetWithConflict :: QPN -> GoalReason QPN -> ConflictSet

-- | This function returns the solver variables responsible for the
--   dependency. It drops the values chosen for flag and stanza variables,
--   which are only needed for log messages.
dependencyReasonToConflictSet :: DependencyReason QPN -> ConflictSet

-- | Convert a <a>DependencyReason</a> to a <a>ConflictSet</a> specifying
--   that the conflict occurred because the conflict set variables
--   introduced a problematic version constraint. See the documentation for
--   <tt>VersionConstraintConflict</tt>.
--   
--   This function currently only specifies the reason for the conflict in
--   the simple case where the <a>DependencyReason</a> does not involve any
--   flags or stanzas. Otherwise, it falls back to calling
--   <a>dependencyReasonToConflictSet</a>.
dependencyReasonToConflictSetWithVersionConstraintConflict :: QPN -> Ver -> DependencyReason QPN -> ConflictSet

-- | Convert a <a>DependencyReason</a> to a <a>ConflictSet</a> specifying
--   that the conflict occurred because the conflict set variables
--   introduced a version of a package that was excluded by a version
--   constraint. See the documentation for <tt>VersionConflict</tt>.
--   
--   This function currently only specifies the reason for the conflict in
--   the simple case where the <a>DependencyReason</a> does not involve any
--   flags or stanzas. Otherwise, it falls back to calling
--   <a>dependencyReasonToConflictSet</a>.
dependencyReasonToConflictSetWithVersionConflict :: QPN -> OrderedVersionRange -> DependencyReason QPN -> ConflictSet
instance GHC.Classes.Eq Distribution.Solver.Modular.Dependency.CI
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.Dependency.DependencyReason qpn)
instance GHC.Classes.Eq Distribution.Solver.Modular.Dependency.ExposedComponent
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.Dependency.Goal qpn)
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.Dependency.GoalReason qpn)
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.Dependency.PkgComponent qpn)
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Dependency.Dep
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Dependency.DependencyReason
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Dependency.Goal
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Dependency.GoalReason
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Dependency.PkgComponent
instance GHC.Classes.Ord Distribution.Solver.Modular.Dependency.ExposedComponent
instance GHC.Classes.Ord qpn => GHC.Classes.Ord (Distribution.Solver.Modular.Dependency.PkgComponent qpn)
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Dependency.CI
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Modular.Dependency.DependencyReason qpn)
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Dependency.ExposedComponent
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Modular.Dependency.Goal qpn)
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Modular.Dependency.GoalReason qpn)
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Modular.Dependency.PkgComponent qpn)
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Dependency.QualifyOptions

module Distribution.Solver.Modular.Assignment

-- | A (partial) assignment of variables.
data Assignment
A :: PAssignment -> FAssignment -> SAssignment -> Assignment

-- | A (partial) package assignment. Qualified package names are associated
--   with instances.
type PAssignment = Map QPN I
type FAssignment = Map QFN Bool
type SAssignment = Map QSN Bool

-- | Delivers an ordered list of fully configured packages.
--   
--   TODO: This function is (sort of) ok. However, there's an open bug
--   w.r.t. unqualification. There might be several different instances of
--   one package version chosen by the solver, which will lead to clashes.
toCPs :: Assignment -> RevDepMap -> [CP QPN]
instance GHC.Classes.Eq Distribution.Solver.Modular.Assignment.Assignment
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Assignment.Assignment

module Distribution.Solver.Types.PackagePreferences

-- | Per-package preferences on the version. It is a soft constraint that
--   the <tt>DependencyResolver</tt> should try to respect where possible.
--   It consists of an <a>InstalledPreference</a> which says if we prefer
--   versions of packages that are already installed. It also has (possibly
--   multiple) <tt>PackageVersionPreference</tt>s which are suggested
--   constraints on the version number. The resolver should try to use
--   package versions that satisfy the maximum number of the suggested
--   version constraints.
--   
--   It is not specified if preferences on some packages are more important
--   than others.
data PackagePreferences
PackagePreferences :: [VersionRange] -> InstalledPreference -> [OptionalStanza] -> PackagePreferences


-- | Read the list of packages available to pkg-config.
module Distribution.Solver.Types.PkgConfigDb

-- | The list of packages installed in the system visible to
--   <tt>pkg-config</tt>. This is an opaque datatype, to be constructed
--   with <a>readPkgConfigDb</a> and queried with
--   <tt>pkgConfigPkgPresent</tt>.
data PkgConfigDb

-- | If an entry is <a>Nothing</a>, this means that the package seems to be
--   present, but we don't know the exact version (because parsing of the
--   version number failed).
PkgConfigDb :: Map PkgconfigName (Maybe PkgconfigVersion) -> PkgConfigDb

-- | For when we could not run pkg-config successfully.
NoPkgConfigDb :: PkgConfigDb

-- | Query pkg-config for the list of installed packages, together with
--   their versions. Return a <a>PkgConfigDb</a> encapsulating this
--   information.
readPkgConfigDb :: Verbosity -> ProgramDb -> IO PkgConfigDb

-- | Create a <a>PkgConfigDb</a> from a list of <tt>(packageName,
--   version)</tt> pairs.
pkgConfigDbFromList :: [(String, String)] -> PkgConfigDb

-- | Check whether a given package range is satisfiable in the given
--   <tt>pkg-config</tt> database.
pkgConfigPkgIsPresent :: PkgConfigDb -> PkgconfigName -> PkgconfigVersionRange -> Bool

-- | Query the version of a package in the <tt>pkg-config</tt> database.
--   <tt>Nothing</tt> indicates the package is not in the database, while
--   <tt>Just Nothing</tt> indicates that the package is in the database,
--   but its version is not known.
pkgConfigDbPkgVersion :: PkgConfigDb -> PkgconfigName -> Maybe (Maybe PkgconfigVersion)

-- | Query pkg-config for the locations of pkg-config's package files. Use
--   this to monitor for changes in the pkg-config DB.
getPkgConfigDbDirs :: Verbosity -> ProgramDb -> IO [FilePath]
instance Data.Binary.Class.Binary Distribution.Solver.Types.PkgConfigDb.PkgConfigDb
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.PkgConfigDb.PkgConfigDb
instance GHC.Internal.Show.Show Distribution.Solver.Types.PkgConfigDb.PkgConfigDb
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.PkgConfigDb.PkgConfigDb

module Distribution.Solver.Types.Progress

-- | A type to represent the unfolding of an expensive long running
--   calculation that may fail. We may get intermediate steps before the
--   final result which may be used to indicate progress and/or logging
--   messages.
data Progress step fail done
Step :: step -> Progress step fail done -> Progress step fail done
Fail :: fail -> Progress step fail done
Done :: done -> Progress step fail done

-- | Consume a <a>Progress</a> calculation. Much like <a>foldr</a> for
--   lists but with two base cases, one for a final result and one for
--   failure.
--   
--   Eg to convert into a simple <a>Either</a> result use:
--   
--   <pre>
--   foldProgress (flip const) Left Right
--   </pre>
foldProgress :: (step -> a -> a) -> (fail -> a) -> (done -> a) -> Progress step fail done -> a
instance GHC.Internal.Base.Monoid fail => GHC.Internal.Base.Alternative (Distribution.Solver.Types.Progress.Progress step fail)
instance GHC.Internal.Base.Applicative (Distribution.Solver.Types.Progress.Progress step fail)
instance GHC.Internal.Base.Functor (Distribution.Solver.Types.Progress.Progress step fail)
instance GHC.Internal.Base.Monad (Distribution.Solver.Types.Progress.Progress step fail)

module Distribution.Solver.Types.ProjectConfigPath

-- | Path to a configuration file, either a singleton project root, or a
--   longer list representing a path to an import. The path is a non-empty
--   list that we build up by prepending relative imports with
--   <tt>consProjectConfigPath</tt>.
--   
--   An import can be a URI, such as <a>a stackage cabal.config</a>, but we
--   do not support URIs in the middle of the path, URIs that import other
--   URIs, or URIs that import local files.
--   
--   List elements are relative to each other but once canonicalized,
--   elements are relative to the directory of the project root.
newtype ProjectConfigPath
ProjectConfigPath :: NonEmpty FilePath -> ProjectConfigPath

-- | The root of the path, the project itself.
projectConfigPathRoot :: ProjectConfigPath -> FilePath

-- | Used by some tests as a dummy "unused" project root.
nullProjectConfigPath :: ProjectConfigPath

-- | Prepends the path of the importee to the importer path.
consProjectConfigPath :: FilePath -> ProjectConfigPath -> ProjectConfigPath

-- | Renders the path like this; <tt> D.config imported by: C.config
--   imported by: B.config imported by: A.project </tt> &gt;&gt;&gt; render
--   . docProjectConfigPath $ ProjectConfigPath $ "D.config" :|
--   ["C.config", "B.config", "A.project"] "D.confign imported by:
--   C.confign imported by: B.confign imported by: A.project"
docProjectConfigPath :: ProjectConfigPath -> Doc

-- | Renders the paths as a list without showing which path imports
--   another, like this; <tt> - cabal.project -
--   project-cabal/constraints.config - project-cabal/ghc-latest.config -
--   project-cabal/ghc-options.config - project-cabal/pkgs.config -
--   project-cabal<i>pkgs</i>benchmarks.config -
--   project-cabal<i>pkgs</i>buildinfo.config -
--   project-cabal<i>pkgs</i>cabal.config -
--   project-cabal<i>pkgs</i>install.config -
--   project-cabal<i>pkgs</i>integration-tests.config -
--   project-cabal<i>pkgs</i>tests.config </tt>
--   
--   <pre>
--   &gt;&gt;&gt; :{
--     do
--       let ps =
--                [ ProjectConfigPath ("cabal.project" :| [])
--                , ProjectConfigPath ("project-cabal/constraints.config" :| ["cabal.project"])
--                , ProjectConfigPath ("project-cabal/ghc-latest.config" :| ["cabal.project"])
--                , ProjectConfigPath ("project-cabal/ghc-options.config" :| ["cabal.project"])
--                , ProjectConfigPath ("project-cabal/pkgs.config" :| ["cabal.project"])
--                , ProjectConfigPath ("project-cabal/pkgs/benchmarks.config" :| ["project-cabal/pkgs.config","cabal.project"])
--                , ProjectConfigPath ("project-cabal/pkgs/buildinfo.config" :| ["project-cabal/pkgs.config","cabal.project"])
--                , ProjectConfigPath ("project-cabal/pkgs/cabal.config" :| ["project-cabal/pkgs.config","cabal.project"])
--                , ProjectConfigPath ("project-cabal/pkgs/install.config" :| ["project-cabal/pkgs.config","cabal.project"])
--                , ProjectConfigPath ("project-cabal/pkgs/integration-tests.config" :| ["project-cabal/pkgs.config","cabal.project"])
--                , ProjectConfigPath ("project-cabal/pkgs/tests.config" :| ["project-cabal/pkgs.config","cabal.project"])
--                ]
--       return . render $ docProjectConfigPaths ps
--   :}
--   "- cabal.project\n- project-cabal/constraints.config\n- project-cabal/ghc-latest.config\n- project-cabal/ghc-options.config\n- project-cabal/pkgs.config\n- project-cabal/pkgs/benchmarks.config\n- project-cabal/pkgs/buildinfo.config\n- project-cabal/pkgs/cabal.config\n- project-cabal/pkgs/install.config\n- project-cabal/pkgs/integration-tests.config\n- project-cabal/pkgs/tests.config"
--   </pre>
docProjectConfigPaths :: [ProjectConfigPath] -> Doc

-- | A message for a cyclical import, assuming the head of the path is the
--   duplicate.
cyclicalImportMsg :: ProjectConfigPath -> Doc
docProjectConfigPathFailReason :: VR -> ProjectConfigPath -> Doc

-- | Check if the path has duplicates. A cycle of imports is not allowed.
--   This check should only be done after the path has been canonicalized
--   with <tt>canonicalizeConfigPath</tt>. This is because the import path
--   may contain paths that are the same in relation to their importers but
--   different in relation to the project root directory.
isCyclicConfigPath :: ProjectConfigPath -> Bool

-- | Normalizes and canonicalizes a path removing <a>.</a> and '..'
--   indirections. Makes the path relative to the given directory
--   (typically the project root) instead of relative to the file it was
--   imported from.
--   
--   It converts paths like this: <tt> └─ hops-0.project └─
--   hops/hops-1.config └─ ../hops-2.config └─ hops/hops-3.config └─
--   ../hops-4.config └─ hops/hops-5.config └─ ../hops-6.config └─
--   hops/hops-7.config └─ ../hops-8.config └─ hops/hops-9.config </tt>
--   
--   Into paths like this: <tt> └─ hops-0.project └─ hops/hops-1.config └─
--   hops-2.config └─ hops/hops-3.config └─ hops-4.config └─
--   hops/hops-5.config └─ hops-6.config └─ hops/hops-7.config └─
--   hops-8.config └─ hops/hops-9.config </tt>
--   
--   That way we have <tt>hops-8.config</tt> instead of
--   <tt>.<i>hops</i>..<i>hops</i>..<i>hops</i>..<i>hops</i>../hops-8.config</tt>.
--   
--   Let's see how <tt>canonicalizePath</tt> works that is used in the
--   implementation then we'll see how <tt>canonicalizeConfigPath</tt>
--   works.
--   
--   <pre>
--   &gt;&gt;&gt; let d = testDir
--   
--   &gt;&gt;&gt; makeRelative d &lt;$&gt; canonicalizePath (d &lt;/&gt; "hops/../hops/../hops/../hops/../hops-8.config")
--   "hops-8.config"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; let d = testDir
--   
--   &gt;&gt;&gt; p &lt;- canonicalizeConfigPath d (ProjectConfigPath $ (d &lt;/&gt; "hops/../hops/../hops/../hops/../hops-8.config") :| [])
--   
--   &gt;&gt;&gt; render $ docProjectConfigPath p
--   "hops-8.config"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; :{
--     do
--       let expected = unlines
--             [ "hops/hops-9.config"
--             , "  imported by: hops-8.config"
--             , "  imported by: hops/hops-7.config"
--             , "  imported by: hops-6.config"
--             , "  imported by: hops/hops-5.config"
--             , "  imported by: hops-4.config"
--             , "  imported by: hops/hops-3.config"
--             , "  imported by: hops-2.config"
--             , "  imported by: hops/hops-1.config"
--             , "  imported by: hops-0.project"
--             ]
--       let d = testDir
--       let configPath = ProjectConfigPath ("hops/hops-9.config" :|
--             [ "../hops-8.config"
--             , "hops/hops-7.config"
--             , "../hops-6.config"
--             , "hops/hops-5.config"
--             , "../hops-4.config"
--             , "hops/hops-3.config"
--             , "../hops-2.config"
--             , "hops/hops-1.config"
--             , d &lt;/&gt; "hops-0.project"])
--       p &lt;- canonicalizeConfigPath d configPath
--       return $ expected == render (docProjectConfigPath p) ++ "\n"
--   :}
--   True
--   </pre>
canonicalizeConfigPath :: FilePath -> ProjectConfigPath -> IO ProjectConfigPath
instance Data.Binary.Class.Binary Distribution.Solver.Types.ProjectConfigPath.ProjectConfigPath
instance GHC.Classes.Eq Distribution.Solver.Types.ProjectConfigPath.ProjectConfigPath
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.ProjectConfigPath.ProjectConfigPath
instance GHC.Classes.Ord Distribution.Solver.Types.ProjectConfigPath.ProjectConfigPath
instance GHC.Internal.Show.Show Distribution.Solver.Types.ProjectConfigPath.ProjectConfigPath
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.ProjectConfigPath.ProjectConfigPath

module Distribution.Solver.Types.ConstraintSource

-- | Source of a <tt>PackageConstraint</tt>.
data ConstraintSource

-- | Main config file, which is ~<i>.cabal</i>config by default.
ConstraintSourceMainConfig :: FilePath -> ConstraintSource

-- | Local cabal.project file
ConstraintSourceProjectConfig :: ProjectConfigPath -> ConstraintSource

-- | User config file, which is ./cabal.config by default.
ConstraintSourceUserConfig :: FilePath -> ConstraintSource

-- | Flag specified on the command line.
ConstraintSourceCommandlineFlag :: ConstraintSource

-- | Target specified by the user, e.g., <tt>cabal install
--   package-0.1.0.0</tt> implies <tt>package==0.1.0.0</tt>.
ConstraintSourceUserTarget :: ConstraintSource

-- | Internal requirement to use installed versions of packages like
--   ghc-prim.
ConstraintSourceNonReinstallablePackage :: ConstraintSource

-- | Internal constraint used by <tt>cabal freeze</tt>.
ConstraintSourceFreeze :: ConstraintSource

-- | Constraint specified by a config file, a command line flag, or a user
--   target, when a more specific source is not known.
ConstraintSourceConfigFlagOrTarget :: ConstraintSource

-- | Constraint introduced by --enable-multi-repl, which requires features
--   from Cabal &gt;= 3.11
ConstraintSourceMultiRepl :: ConstraintSource

-- | The source of the constraint is not specified.
ConstraintSourceUnknown :: ConstraintSource

-- | An internal constraint due to compatibility issues with the Setup.hs
--   command line interface requires a minimum lower bound on Cabal
ConstraintSetupCabalMinVersion :: ConstraintSource

-- | An internal constraint due to compatibility issues with the Setup.hs
--   command line interface requires a maximum upper bound on Cabal
ConstraintSetupCabalMaxVersion :: ConstraintSource

-- | Description of a <a>ConstraintSource</a>.
showConstraintSource :: ConstraintSource -> String
instance Data.Binary.Class.Binary Distribution.Solver.Types.ConstraintSource.ConstraintSource
instance GHC.Classes.Eq Distribution.Solver.Types.ConstraintSource.ConstraintSource
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.ConstraintSource.ConstraintSource
instance GHC.Internal.Show.Show Distribution.Solver.Types.ConstraintSource.ConstraintSource
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.ConstraintSource.ConstraintSource

module Distribution.Solver.Types.LabeledPackageConstraint

-- | <a>PackageConstraint</a> labeled with its source.
data LabeledPackageConstraint
LabeledPackageConstraint :: PackageConstraint -> ConstraintSource -> LabeledPackageConstraint
unlabelPackageConstraint :: LabeledPackageConstraint -> PackageConstraint

module Distribution.Solver.Modular.Tree

-- | A package option is a package instance with an optional linking
--   annotation
--   
--   The modular solver has a number of package goals to solve for, and can
--   only pick a single package version for a single goal. In order to
--   allow to install multiple versions of the same package as part of a
--   single solution the solver uses qualified goals. For example,
--   <tt>0.P</tt> and <tt>1.P</tt> might both be qualified goals for
--   <tt>P</tt>, allowing to pick a difference version of package
--   <tt>P</tt> for <tt>0.P</tt> and <tt>1.P</tt>.
--   
--   Linking is an essential part of this story. In addition to picking a
--   specific version for <tt>1.P</tt>, the solver can also decide to link
--   <tt>1.P</tt> to <tt>0.P</tt> (or vice versa). It means that
--   <tt>1.P</tt> and <tt>0.P</tt> really must be the very same package
--   (and hence must have the same build time configuration, and their
--   dependencies must also be the exact same).
--   
--   See <a>http://www.well-typed.com/blog/2015/03/qualified-goals/</a> for
--   details.
data POption
POption :: I -> Maybe PackagePath -> POption

-- | Type of the search tree. Inlining the choice nodes for now. Weights on
--   package, flag, and stanza choices control the traversal order.
--   
--   The tree can hold additional data on <a>Done</a> nodes (type
--   <tt>d</tt>) and choice nodes (type <tt>c</tt>). For example, during
--   the final traversal, choice nodes contain the variables that
--   introduced the choices, and <a>Done</a> nodes contain the assignments
--   for all variables.
--   
--   TODO: The weight type should be changed from [Double] to Double to
--   avoid giving too much weight to preferences that are applied later.
data Tree d c

-- | Choose a version for a package (or choose to link)
PChoice :: QPN -> RevDepMap -> c -> WeightedPSQ [Weight] POption (Tree d c) -> Tree d c

-- | Choose a value for a flag
--   
--   The Bool is the default value.
FChoice :: QFN -> RevDepMap -> c -> WeakOrTrivial -> FlagType -> Bool -> WeightedPSQ [Weight] Bool (Tree d c) -> Tree d c

-- | Choose whether or not to enable a stanza
SChoice :: QSN -> RevDepMap -> c -> WeakOrTrivial -> WeightedPSQ [Weight] Bool (Tree d c) -> Tree d c

-- | Choose which choice to make next
--   
--   Invariants:
--   
--   <ul>
--   <li>PSQ should never be empty</li>
--   <li>For each choice we additionally record the <a>QGoalReason</a> why
--   we are introducing that goal into tree. Note that most of the time we
--   are working with <tt>Tree QGoalReason</tt>; in that case, we must have
--   the invariant that the <a>QGoalReason</a> cached in the
--   <a>PChoice</a>, <a>FChoice</a> or <a>SChoice</a> directly below a
--   <a>GoalChoice</a> node must equal the reason recorded on that
--   <a>GoalChoice</a> node.</li>
--   </ul>
GoalChoice :: RevDepMap -> PSQ (Goal QPN) (Tree d c) -> Tree d c

-- | We're done -- we found a solution!
Done :: RevDepMap -> d -> Tree d c

-- | We failed to find a solution in this path through the tree
Fail :: ConflictSet -> FailReason -> Tree d c

-- | Functor for the tree type. <tt>a</tt> is the type of nodes' children.
--   <tt>d</tt> and <tt>c</tt> have the same meaning as in <a>Tree</a>.
data TreeF d c a
PChoiceF :: QPN -> RevDepMap -> c -> WeightedPSQ [Weight] POption a -> TreeF d c a
FChoiceF :: QFN -> RevDepMap -> c -> WeakOrTrivial -> FlagType -> Bool -> WeightedPSQ [Weight] Bool a -> TreeF d c a
SChoiceF :: QSN -> RevDepMap -> c -> WeakOrTrivial -> WeightedPSQ [Weight] Bool a -> TreeF d c a
GoalChoiceF :: RevDepMap -> PSQ (Goal QPN) a -> TreeF d c a
DoneF :: RevDepMap -> d -> TreeF d c a
FailF :: ConflictSet -> FailReason -> TreeF d c a
type Weight = Double
data FailReason
UnsupportedExtension :: Extension -> FailReason
UnsupportedLanguage :: Language -> FailReason
MissingPkgconfigPackage :: PkgconfigName -> PkgconfigVersionRange -> FailReason
NewPackageDoesNotMatchExistingConstraint :: ConflictingDep -> FailReason
ConflictingConstraints :: ConflictingDep -> ConflictingDep -> FailReason
NewPackageIsMissingRequiredComponent :: ExposedComponent -> DependencyReason QPN -> FailReason
NewPackageHasPrivateRequiredComponent :: ExposedComponent -> DependencyReason QPN -> FailReason
NewPackageHasUnbuildableRequiredComponent :: ExposedComponent -> DependencyReason QPN -> FailReason
PackageRequiresMissingComponent :: QPN -> ExposedComponent -> FailReason
PackageRequiresPrivateComponent :: QPN -> ExposedComponent -> FailReason
PackageRequiresUnbuildableComponent :: QPN -> ExposedComponent -> FailReason
CannotReinstall :: FailReason
NotExplicit :: FailReason
Shadowed :: FailReason
Broken :: UnitId -> FailReason
UnknownPackage :: FailReason
GlobalConstraintVersion :: VR -> ConstraintSource -> FailReason
GlobalConstraintInstalled :: ConstraintSource -> FailReason
GlobalConstraintSource :: ConstraintSource -> FailReason
GlobalConstraintFlag :: ConstraintSource -> FailReason
ManualFlag :: FailReason
MalformedFlagChoice :: QFN -> FailReason
MalformedStanzaChoice :: QSN -> FailReason
EmptyGoalChoice :: FailReason
Backjump :: FailReason
MultipleInstances :: FailReason
DependenciesNotLinked :: String -> FailReason
CyclicDependencies :: FailReason
UnsupportedSpecVer :: Ver -> FailReason

-- | Information about a dependency involved in a conflict, for error
--   messages.
data ConflictingDep
ConflictingDep :: DependencyReason QPN -> PkgComponent QPN -> CI -> ConflictingDep

-- | Anamorphism on trees.
ana :: (a -> TreeF d c a) -> a -> Tree d c

-- | Catamorphism on trees.
cata :: (TreeF d c a -> a) -> Tree d c -> a
inn :: TreeF d c (Tree d c) -> Tree d c
innM :: Monad m => TreeF d c (m (Tree d c)) -> m (Tree d c)

-- | Paramorphism on trees.
para :: (TreeF d c (a, Tree d c) -> a) -> Tree d c -> a
trav :: TreeTrav d c a -> Tree d c -> Tree d a

-- | Approximates the number of active choices that are available in a
--   node. Note that we count goal choices as having one choice, always.
zeroOrOneChoices :: Tree d c -> Bool

-- | Determines whether a tree is active, i.e., isn't a failure node.
active :: Tree d c -> Bool
type TreeTrav d c a = TreeF d c Tree d a -> TreeF d a Tree d a
type EndoTreeTrav d c = TreeTrav d c c
instance GHC.Classes.Eq Distribution.Solver.Modular.Tree.ConflictingDep
instance GHC.Classes.Eq Distribution.Solver.Modular.Tree.FailReason
instance GHC.Classes.Eq Distribution.Solver.Modular.Tree.POption
instance GHC.Internal.Data.Foldable.Foldable (Distribution.Solver.Modular.Tree.TreeF d c)
instance GHC.Internal.Base.Functor (Distribution.Solver.Modular.Tree.TreeF d c)
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Tree.ConflictingDep
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Tree.FailReason
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Tree.POption
instance GHC.Internal.Data.Traversable.Traversable (Distribution.Solver.Modular.Tree.TreeF d c)

module Distribution.Solver.Modular.Index

-- | An index contains information about package instances. This is a
--   nested dictionary. Package names are mapped to instances, which in
--   turn is mapped to info.
type Index = Map PN Map I PInfo

-- | Info associated with a package instance. Currently, dependencies,
--   component names, flags and failure reasons. The component map records
--   whether any components are unbuildable in the current environment
--   (compiler, os, arch, and global flag constraints). Packages that have
--   a failure reason recorded for them are disabled globally, for reasons
--   external to the solver. We currently use this for shadowing which
--   essentially is a GHC limitation, and for installed packages that are
--   broken.
data PInfo
PInfo :: FlaggedDeps PN -> Map ExposedComponent ComponentInfo -> FlagInfo -> Maybe FailReason -> PInfo

-- | Info associated with each library and executable in a package
--   instance.
data ComponentInfo
ComponentInfo :: IsVisible -> IsBuildable -> ComponentInfo
[compIsVisible] :: ComponentInfo -> IsVisible
[compIsBuildable] :: ComponentInfo -> IsBuildable

-- | Whether a component is visible in the current environment.
newtype IsVisible
IsVisible :: Bool -> IsVisible

-- | Whether a component is made unbuildable by a "buildable: False" field.
newtype IsBuildable
IsBuildable :: Bool -> IsBuildable
defaultQualifyOptions :: Index -> QualifyOptions
mkIndex :: [(PN, I, PInfo)] -> Index
instance GHC.Classes.Eq Distribution.Solver.Modular.Index.IsBuildable
instance GHC.Classes.Eq Distribution.Solver.Modular.Index.IsVisible
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Index.ComponentInfo
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Index.IsBuildable
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Index.IsVisible

module Distribution.Solver.Modular.Validate

-- | Interface.
validateTree :: CompilerInfo -> Index -> PkgConfigDb -> Tree d c -> Tree d c
instance GHC.Internal.Base.Applicative Distribution.Solver.Modular.Validate.Validate
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Validate.Validate
instance Control.Monad.Reader.Class.MonadReader Distribution.Solver.Modular.Validate.ValidateState Distribution.Solver.Modular.Validate.Validate
instance GHC.Internal.Base.Monad Distribution.Solver.Modular.Validate.Validate

module Distribution.Solver.Modular.Linking

-- | Validate linked packages
--   
--   Verify that linked packages have
--   
--   <ul>
--   <li>Linked dependencies,</li>
--   <li>Equal flag assignments</li>
--   <li>Equal stanza assignments</li>
--   </ul>
validateLinking :: Index -> Tree d c -> Tree d c
instance GHC.Internal.Base.Applicative Distribution.Solver.Modular.Linking.UpdateState
instance GHC.Classes.Eq Distribution.Solver.Modular.Linking.LinkGroup
instance GHC.Internal.Base.Functor Distribution.Solver.Modular.Linking.UpdateState
instance Control.Monad.State.Class.MonadState Distribution.Solver.Modular.Linking.ValidateState Distribution.Solver.Modular.Linking.UpdateState
instance GHC.Internal.Base.Monad Distribution.Solver.Modular.Linking.UpdateState
instance GHC.Internal.Show.Show Distribution.Solver.Modular.Linking.LinkGroup

module Distribution.Solver.Modular.Cycles

-- | Find and reject any nodes with cyclic dependencies
detectCyclesPhase :: Tree d c -> Tree d c
instance Distribution.Compat.Graph.IsNode Distribution.Solver.Modular.Cycles.RevDepMapNode

module Distribution.Solver.Modular.Message
data Message

-- | increase indentation level
Enter :: Message

-- | decrease indentation level
Leave :: Message
TryP :: QPN -> POption -> Message
TryF :: QFN -> Bool -> Message
TryS :: QSN -> Bool -> Message
Next :: Goal QPN -> Message
Skip :: Set Conflict -> Message
Success :: Message
Failure :: ConflictSet -> FailReason -> Message

-- | Transforms the structured message type to actual messages (strings).
--   
--   The log contains level numbers, which are useful for any trace that
--   involves backtracking, because only the level numbers will allow to
--   keep track of backjumps.
showMessages :: Progress Message a b -> Progress String a b

module Distribution.Solver.Modular.RetryLog

-- | <a>Progress</a> as a difference list that allows efficient appends at
--   failures.
data RetryLog step fail done

-- | <i>O(1)</i>. Convert a <a>RetryLog</a> to a <a>Progress</a>.
toProgress :: RetryLog step fail done -> Progress step fail done

-- | <i>O(N)</i>. Convert a <a>Progress</a> to a <a>RetryLog</a>.
fromProgress :: Progress step fail done -> RetryLog step fail done

-- | <i>O(1)</i>. Apply a function to the failure value in a log.
mapFailure :: (fail1 -> fail2) -> RetryLog step fail1 done -> RetryLog step fail2 done

-- | <i>O(1)</i>. If the first log leads to failure, continue with the
--   second.
retry :: RetryLog step fail1 done -> (fail1 -> RetryLog step fail2 done) -> RetryLog step fail2 done

-- | <i>O(1)</i>. Create a log with one message before a failure.
failWith :: step -> fail -> RetryLog step fail done

-- | <i>O(1)</i>. Create a log with one message before a success.
succeedWith :: step -> done -> RetryLog step fail done

-- | <i>O(1)</i>. Prepend a message to a log.
continueWith :: step -> RetryLog step fail done -> RetryLog step fail done

-- | <i>O(1)</i>. Prepend the given message and <a>Enter</a> to the log,
--   and insert <a>Leave</a> before the failure if the log fails.
tryWith :: Message -> RetryLog Message fail done -> RetryLog Message fail done

module Distribution.Solver.Modular.Log

-- | Postprocesses a log file. This function discards all log messages and
--   avoids calling <a>showMessages</a> if the log isn't needed (specified
--   by <tt>keepLog</tt>), for efficiency.
displayLogMessages :: Bool -> RetryLog Message SolverFailure a -> RetryLog String SolverFailure a

-- | Information about a dependency solver failure.
data SolverFailure
ExhaustiveSearch :: ConflictSet -> ConflictMap -> SolverFailure
BackjumpLimitReached :: SolverFailure

module Distribution.Solver.Types.Settings
newtype ReorderGoals
ReorderGoals :: Bool -> ReorderGoals
newtype IndependentGoals
IndependentGoals :: Bool -> IndependentGoals
newtype PreferOldest
PreferOldest :: Bool -> PreferOldest
newtype MinimizeConflictSet
MinimizeConflictSet :: Bool -> MinimizeConflictSet
newtype AvoidReinstalls
AvoidReinstalls :: Bool -> AvoidReinstalls
newtype ShadowPkgs
ShadowPkgs :: Bool -> ShadowPkgs
newtype StrongFlags
StrongFlags :: Bool -> StrongFlags
newtype AllowBootLibInstalls
AllowBootLibInstalls :: Bool -> AllowBootLibInstalls

-- | Should we consider all packages we know about, or only those that have
--   constraints explicitly placed on them or which are goals?
data OnlyConstrained
OnlyConstrainedNone :: OnlyConstrained
OnlyConstrainedAll :: OnlyConstrained
newtype EnableBackjumping
EnableBackjumping :: Bool -> EnableBackjumping
newtype CountConflicts
CountConflicts :: Bool -> CountConflicts
newtype FineGrainedConflicts
FineGrainedConflicts :: Bool -> FineGrainedConflicts
newtype SolveExecutables
SolveExecutables :: Bool -> SolveExecutables
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.AllowBootLibInstalls
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.AvoidReinstalls
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.CountConflicts
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.FineGrainedConflicts
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.IndependentGoals
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.MinimizeConflictSet
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.OnlyConstrained
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.PreferOldest
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.ReorderGoals
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.ShadowPkgs
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.SolveExecutables
instance Data.Binary.Class.Binary Distribution.Solver.Types.Settings.StrongFlags
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.AllowBootLibInstalls
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.AvoidReinstalls
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.CountConflicts
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.EnableBackjumping
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.FineGrainedConflicts
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.IndependentGoals
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.MinimizeConflictSet
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.PreferOldest
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.ReorderGoals
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.ShadowPkgs
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.SolveExecutables
instance Distribution.Simple.Flag.BooleanFlag Distribution.Solver.Types.Settings.StrongFlags
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.AllowBootLibInstalls
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.AvoidReinstalls
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.CountConflicts
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.EnableBackjumping
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.FineGrainedConflicts
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.IndependentGoals
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.MinimizeConflictSet
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.OnlyConstrained
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.PreferOldest
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.ReorderGoals
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.ShadowPkgs
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.SolveExecutables
instance GHC.Classes.Eq Distribution.Solver.Types.Settings.StrongFlags
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.AllowBootLibInstalls
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.AvoidReinstalls
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.CountConflicts
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.EnableBackjumping
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.FineGrainedConflicts
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.IndependentGoals
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.MinimizeConflictSet
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.OnlyConstrained
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.PreferOldest
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.ReorderGoals
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.ShadowPkgs
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.SolveExecutables
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.Settings.StrongFlags
instance Distribution.Parsec.Parsec Distribution.Solver.Types.Settings.OnlyConstrained
instance Distribution.Pretty.Pretty Distribution.Solver.Types.Settings.OnlyConstrained
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.AllowBootLibInstalls
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.AvoidReinstalls
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.CountConflicts
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.EnableBackjumping
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.FineGrainedConflicts
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.IndependentGoals
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.MinimizeConflictSet
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.OnlyConstrained
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.PreferOldest
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.ReorderGoals
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.ShadowPkgs
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.SolveExecutables
instance GHC.Internal.Show.Show Distribution.Solver.Types.Settings.StrongFlags
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.AllowBootLibInstalls
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.AvoidReinstalls
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.CountConflicts
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.FineGrainedConflicts
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.IndependentGoals
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.MinimizeConflictSet
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.OnlyConstrained
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.PreferOldest
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.ReorderGoals
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.ShadowPkgs
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.SolveExecutables
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.Settings.StrongFlags

module Distribution.Solver.Modular.Explore

-- | Interface.
--   
--   Takes as an argument a limit on allowed backjumps. If the limit is
--   <a>Nothing</a>, then infinitely many backjumps are allowed. If the
--   limit is 'Just 0', backtracking is completely disabled.
backjumpAndExplore :: Maybe Int -> EnableBackjumping -> FineGrainedConflicts -> CountConflicts -> Index -> Tree d QGoalReason -> RetryLog Message SolverFailure (Assignment, RevDepMap)

module Distribution.Solver.Modular.Builder

-- | Interface to the tree builder. Just takes an index and a list of
--   package names, and computes the initial state and then the tree from
--   there.
buildTree :: Index -> IndependentGoals -> [PN] -> Tree () QGoalReason

-- | Pairs each element of a list with the list resulting from removal of
--   that element from the original list.
splits :: [a] -> [(a, [a])]

module Distribution.Solver.Types.SolverId

-- | The solver can produce references to existing packages or packages we
--   plan to install. Unlike <tt>ConfiguredId</tt> we don't yet know the
--   <a>UnitId</a> for planned packages, because it's not the solver's job
--   to compute them.
data SolverId
PreExistingId :: PackageId -> UnitId -> SolverId
[solverSrcId] :: SolverId -> PackageId
[solverInstId] :: SolverId -> UnitId
PlannedId :: PackageId -> SolverId
[solverSrcId] :: SolverId -> PackageId
instance Data.Binary.Class.Binary Distribution.Solver.Types.SolverId.SolverId
instance GHC.Classes.Eq Distribution.Solver.Types.SolverId.SolverId
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.SolverId.SolverId
instance GHC.Classes.Ord Distribution.Solver.Types.SolverId.SolverId
instance Distribution.Package.Package Distribution.Solver.Types.SolverId.SolverId
instance GHC.Internal.Show.Show Distribution.Solver.Types.SolverId.SolverId
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.SolverId.SolverId

module Distribution.Solver.Types.InstSolverPackage

-- | An <a>InstSolverPackage</a> is a pre-existing installed package
--   specified by the dependency solver.
data InstSolverPackage
InstSolverPackage :: InstalledPackageInfo -> ComponentDeps [SolverId] -> ComponentDeps [SolverId] -> InstSolverPackage
[instSolverPkgIPI] :: InstSolverPackage -> InstalledPackageInfo
[instSolverPkgLibDeps] :: InstSolverPackage -> ComponentDeps [SolverId]
[instSolverPkgExeDeps] :: InstSolverPackage -> ComponentDeps [SolverId]
instance Data.Binary.Class.Binary Distribution.Solver.Types.InstSolverPackage.InstSolverPackage
instance GHC.Classes.Eq Distribution.Solver.Types.InstSolverPackage.InstSolverPackage
instance GHC.Internal.Generics.Generic Distribution.Solver.Types.InstSolverPackage.InstSolverPackage
instance Distribution.Package.HasMungedPackageId Distribution.Solver.Types.InstSolverPackage.InstSolverPackage
instance Distribution.Package.HasUnitId Distribution.Solver.Types.InstSolverPackage.InstSolverPackage
instance Distribution.Package.Package Distribution.Solver.Types.InstSolverPackage.InstSolverPackage
instance GHC.Internal.Show.Show Distribution.Solver.Types.InstSolverPackage.InstSolverPackage
instance Distribution.Utils.Structured.Structured Distribution.Solver.Types.InstSolverPackage.InstSolverPackage

module Distribution.Solver.Types.SourcePackage

-- | We sometimes need to override the .cabal file in the tarball with the
--   newer one from the package index.
type PackageDescriptionOverride = Maybe ByteString

-- | A package description along with the location of the package sources.
data SourcePackage loc
SourcePackage :: PackageId -> GenericPackageDescription -> loc -> PackageDescriptionOverride -> SourcePackage loc
[srcpkgPackageId] :: SourcePackage loc -> PackageId

-- | Note, this field is lazy, e.g. when reading in hackage index we parse
--   only what we need, not whole index.
[srcpkgDescription] :: SourcePackage loc -> GenericPackageDescription
[srcpkgSource] :: SourcePackage loc -> loc
[srcpkgDescrOverride] :: SourcePackage loc -> PackageDescriptionOverride
instance Data.Binary.Class.Binary loc => Data.Binary.Class.Binary (Distribution.Solver.Types.SourcePackage.SourcePackage loc)
instance GHC.Classes.Eq loc => GHC.Classes.Eq (Distribution.Solver.Types.SourcePackage.SourcePackage loc)
instance GHC.Internal.Generics.Generic (Distribution.Solver.Types.SourcePackage.SourcePackage loc)
instance Distribution.Package.Package (Distribution.Solver.Types.SourcePackage.SourcePackage a)
instance GHC.Internal.Show.Show loc => GHC.Internal.Show.Show (Distribution.Solver.Types.SourcePackage.SourcePackage loc)
instance Distribution.Utils.Structured.Structured loc => Distribution.Utils.Structured.Structured (Distribution.Solver.Types.SourcePackage.SourcePackage loc)

module Distribution.Solver.Types.SolverPackage

-- | A <a>SolverPackage</a> is a package specified by the dependency
--   solver. It will get elaborated into a <tt>ConfiguredPackage</tt> or
--   even an <tt>ElaboratedConfiguredPackage</tt>.
--   
--   NB: <a>SolverPackage</a>s are essentially always with
--   <tt>UnresolvedPkgLoc</tt>, but for symmetry we have the parameter.
--   (Maybe it can be removed.)
data SolverPackage loc
SolverPackage :: SourcePackage loc -> FlagAssignment -> OptionalStanzaSet -> ComponentDeps [SolverId] -> ComponentDeps [SolverId] -> SolverPackage loc
[solverPkgSource] :: SolverPackage loc -> SourcePackage loc
[solverPkgFlags] :: SolverPackage loc -> FlagAssignment
[solverPkgStanzas] :: SolverPackage loc -> OptionalStanzaSet
[solverPkgLibDeps] :: SolverPackage loc -> ComponentDeps [SolverId]
[solverPkgExeDeps] :: SolverPackage loc -> ComponentDeps [SolverId]
instance Data.Binary.Class.Binary loc => Data.Binary.Class.Binary (Distribution.Solver.Types.SolverPackage.SolverPackage loc)
instance GHC.Classes.Eq loc => GHC.Classes.Eq (Distribution.Solver.Types.SolverPackage.SolverPackage loc)
instance GHC.Internal.Generics.Generic (Distribution.Solver.Types.SolverPackage.SolverPackage loc)
instance Distribution.Package.Package (Distribution.Solver.Types.SolverPackage.SolverPackage loc)
instance GHC.Internal.Show.Show loc => GHC.Internal.Show.Show (Distribution.Solver.Types.SolverPackage.SolverPackage loc)
instance Distribution.Utils.Structured.Structured loc => Distribution.Utils.Structured.Structured (Distribution.Solver.Types.SolverPackage.SolverPackage loc)

module Distribution.Solver.Types.ResolverPackage

-- | The dependency resolver picks either pre-existing installed packages
--   or it picks source packages along with package configuration.
--   
--   This is like the <a>PlanPackage</a> but with fewer cases.
data ResolverPackage loc
PreExisting :: InstSolverPackage -> ResolverPackage loc
Configured :: SolverPackage loc -> ResolverPackage loc
resolverPackageLibDeps :: ResolverPackage loc -> ComponentDeps [SolverId]
resolverPackageExeDeps :: ResolverPackage loc -> ComponentDeps [SolverId]
instance Data.Binary.Class.Binary loc => Data.Binary.Class.Binary (Distribution.Solver.Types.ResolverPackage.ResolverPackage loc)
instance GHC.Classes.Eq loc => GHC.Classes.Eq (Distribution.Solver.Types.ResolverPackage.ResolverPackage loc)
instance GHC.Internal.Generics.Generic (Distribution.Solver.Types.ResolverPackage.ResolverPackage loc)
instance Distribution.Compat.Graph.IsNode (Distribution.Solver.Types.ResolverPackage.ResolverPackage loc)
instance Distribution.Package.Package (Distribution.Solver.Types.ResolverPackage.ResolverPackage loc)
instance GHC.Internal.Show.Show loc => GHC.Internal.Show.Show (Distribution.Solver.Types.ResolverPackage.ResolverPackage loc)
instance Distribution.Utils.Structured.Structured loc => Distribution.Utils.Structured.Structured (Distribution.Solver.Types.ResolverPackage.ResolverPackage loc)

module Distribution.Solver.Types.DependencyResolver

-- | A dependency resolver is a function that works out an installation
--   plan given the set of installed and available packages and a set of
--   deps to solve for.
--   
--   The reason for this interface is because there are dozens of
--   approaches to solving the package dependency problem and we want to
--   make it easy to swap in alternatives.
type DependencyResolver loc = Platform -> CompilerInfo -> InstalledPackageIndex -> PackageIndex SourcePackage loc -> PkgConfigDb -> PackageName -> PackagePreferences -> [LabeledPackageConstraint] -> Set PackageName -> Progress String String [ResolverPackage loc]

module Distribution.Solver.Modular.IndexConversion

-- | Convert both the installed package index and the source package index
--   into one uniform solver index.
--   
--   We use <tt>allPackagesBySourcePackageId</tt> for the installed package
--   index because that returns us several instances of the same package
--   and version in order of preference. This allows us in principle to
--   "shadow" packages if there are several installed packages of the same
--   version. There are currently some shortcomings in both GHC and Cabal
--   in resolving these situations. However, the right thing to do is to
--   fix the problem there, so for now, shadowing is only activated if
--   explicitly requested.
convPIs :: OS -> Arch -> CompilerInfo -> Map PN [LabeledPackageConstraint] -> ShadowPkgs -> StrongFlags -> SolveExecutables -> InstalledPackageIndex -> PackageIndex (SourcePackage loc) -> Index
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Modular.IndexConversion.SimpleFlaggedDepKey qpn)
instance GHC.Classes.Ord qpn => GHC.Classes.Ord (Distribution.Solver.Modular.IndexConversion.SimpleFlaggedDepKey qpn)

module Distribution.Solver.Modular.ConfiguredConversion

-- | Converts from the solver specific result <tt>CP QPN</tt> into a
--   <a>ResolverPackage</a>, which can then be converted into the install
--   plan.
convCP :: InstalledPackageIndex -> PackageIndex (SourcePackage loc) -> CP QPN -> ResolverPackage loc

module Distribution.Solver.Types.Variable

-- | Variables used by the dependency solver. This type is similar to the
--   internal <tt>Var</tt> type.
data Variable qpn
PackageVar :: qpn -> Variable qpn
FlagVar :: qpn -> FlagName -> Variable qpn
StanzaVar :: qpn -> OptionalStanza -> Variable qpn
instance GHC.Classes.Eq qpn => GHC.Classes.Eq (Distribution.Solver.Types.Variable.Variable qpn)
instance GHC.Internal.Show.Show qpn => GHC.Internal.Show.Show (Distribution.Solver.Types.Variable.Variable qpn)


-- | Reordering or pruning the tree in order to prefer or make certain
--   choices.
module Distribution.Solver.Modular.Preference

-- | Avoid reinstalls.
--   
--   This is a tricky strategy. If a package version is installed already
--   and the same version is available from a repo, the repo version will
--   never be chosen. This would result in a reinstall (either
--   destructively, or potentially, shadowing). The old instance won't be
--   visible or even present anymore, but other packages might have
--   depended on it.
--   
--   TODO: It would be better to actually check the reverse dependencies of
--   installed packages. If they're not depended on, then reinstalling
--   should be fine. Even if they are, perhaps this should just result in
--   trying to reinstall those other packages as well. However, doing this
--   all neatly in one pass would require to change the builder, or at
--   least to change the goal set after building.
avoidReinstalls :: (PN -> Bool) -> EndoTreeTrav d c

-- | Deal with setup and build-tool-depends dependencies after regular
--   dependencies, so we will link setup/exe dependencies against package
--   dependencies when possible
deferSetupExeChoices :: EndoTreeTrav d c

-- | Transformation that tries to avoid making weak flag choices early.
--   Weak flags are trivial flags (not influencing dependencies) or such
--   flags that are explicitly declared to be weak in the index.
deferWeakFlagChoices :: EndoTreeTrav d c

-- | Transformation that tries to enforce the rule that manual flags can
--   only be set by the user.
--   
--   If there are no constraints on a manual flag, this function prunes all
--   but the default value. If there are constraints, then the flag is
--   allowed to have the values specified by the constraints. Note that the
--   type used for flag values doesn't need to be Bool.
--   
--   This function makes an exception for the case where there are multiple
--   goals for a single package (with different qualifiers), and flag
--   constraints for manual flag x only apply to some of those goals. In
--   that case, we allow the unconstrained goals to use the default value
--   for x OR any of the values in the constraints on x (even though the
--   constraints don't apply), in order to allow the unconstrained goals to
--   be linked to the constrained goals. See
--   <a>https://github.com/haskell/cabal/issues/4299</a>. Removing the
--   single instance restriction (SIR) would also fix #4299, so we may want
--   to remove this exception and only let the user toggle manual flags if
--   we remove the SIR.
--   
--   This function does not enforce any of the constraints, since that is
--   done by <a>enforcePackageConstraints</a>.
enforceManualFlags :: Map PN [LabeledPackageConstraint] -> EndoTreeTrav d c

-- | Traversal that tries to establish various kinds of user constraints.
--   Works by selectively disabling choices that have been ruled out by
--   global user constraints.
enforcePackageConstraints :: Map PN [LabeledPackageConstraint] -> EndoTreeTrav d c

-- | Enforce ghc's single instance restriction
--   
--   From the solver's perspective, this means that for any package
--   instance (that is, package name + package version) there can be at
--   most one qualified goal resolving to that instance (there may be other
--   goals _linking_ to that instance however).
enforceSingleInstanceRestriction :: Tree d c -> Tree d c

-- | Always choose the first goal in the list next, abandoning all other
--   choices.
--   
--   This is unnecessary for the default search strategy, because it
--   descends only into the first goal choice anyway, but may still make
--   sense to just reduce the tree size a bit.
firstGoal :: EndoTreeTrav d c

-- | Transformation that tries to make a decision on base as early as
--   possible by pruning all other goals when base is available. In nearly
--   all cases, there's a single choice for the base package. Also, fixing
--   base early should lead to better error messages.
preferBaseGoalChoice :: EndoTreeTrav d c

-- | Prefer to link packages whenever possible.
preferLinked :: EndoTreeTrav d c
preferPackagePreferences :: (PN -> PackagePreferences) -> EndoTreeTrav d c

-- | Transformation that prefers goals with lower branching degrees.
--   
--   When a goal choice node has at least one goal with zero or one
--   children, this function prunes all other goals. This transformation
--   can help the solver find a solution in fewer steps by allowing it to
--   backtrack sooner when it is exploring a subtree with no solutions.
--   However, each step is more expensive.
preferReallyEasyGoalChoices :: EndoTreeTrav d c

-- | Require all packages to be mentioned in a constraint or as a goal.
onlyConstrained :: (PN -> Bool) -> EndoTreeTrav d QGoalReason

-- | Sort all goals using the provided function.
sortGoals :: (Variable QPN -> Variable QPN -> Ordering) -> EndoTreeTrav d c

-- | Reduce the branching degree of the search tree by removing all choices
--   after the first successful choice at each level. The returned tree is
--   the minimal subtree containing the path to the first backjump.
pruneAfterFirstSuccess :: EndoTreeTrav d c

module Distribution.Solver.Modular.Solver

-- | Various options for the modular solver.
data SolverConfig
SolverConfig :: ReorderGoals -> CountConflicts -> FineGrainedConflicts -> MinimizeConflictSet -> IndependentGoals -> AvoidReinstalls -> ShadowPkgs -> StrongFlags -> OnlyConstrained -> Maybe Int -> EnableBackjumping -> SolveExecutables -> Maybe (Variable QPN -> Variable QPN -> Ordering) -> Verbosity -> PruneAfterFirstSuccess -> SolverConfig
[reorderGoals] :: SolverConfig -> ReorderGoals
[countConflicts] :: SolverConfig -> CountConflicts
[fineGrainedConflicts] :: SolverConfig -> FineGrainedConflicts
[minimizeConflictSet] :: SolverConfig -> MinimizeConflictSet
[independentGoals] :: SolverConfig -> IndependentGoals
[avoidReinstalls] :: SolverConfig -> AvoidReinstalls
[shadowPkgs] :: SolverConfig -> ShadowPkgs
[strongFlags] :: SolverConfig -> StrongFlags
[onlyConstrained] :: SolverConfig -> OnlyConstrained
[maxBackjumps] :: SolverConfig -> Maybe Int
[enableBackjumping] :: SolverConfig -> EnableBackjumping
[solveExecutables] :: SolverConfig -> SolveExecutables
[goalOrder] :: SolverConfig -> Maybe (Variable QPN -> Variable QPN -> Ordering)
[solverVerbosity] :: SolverConfig -> Verbosity
[pruneAfterFirstSuccess] :: SolverConfig -> PruneAfterFirstSuccess

-- | Run all solver phases.
--   
--   In principle, we have a valid tree after <tt>validationPhase</tt>,
--   which means that every <a>Done</a> node should correspond to valid
--   solution.
--   
--   There is one exception, though, and that is cycle detection, which has
--   been added relatively recently. Cycles are only removed directly
--   before exploration.
solve :: SolverConfig -> CompilerInfo -> Index -> PkgConfigDb -> (PN -> PackagePreferences) -> Map PN [LabeledPackageConstraint] -> Set PN -> RetryLog Message SolverFailure (Assignment, RevDepMap)

-- | Whether to remove all choices after the first successful choice at
--   each level in the search tree.
newtype PruneAfterFirstSuccess
PruneAfterFirstSuccess :: Bool -> PruneAfterFirstSuccess

module Distribution.Solver.Modular

-- | Ties the two worlds together: classic cabal-install vs. the modular
--   solver. Performs the necessary translations before and after.
modularResolver :: SolverConfig -> DependencyResolver loc

-- | Various options for the modular solver.
data SolverConfig
SolverConfig :: ReorderGoals -> CountConflicts -> FineGrainedConflicts -> MinimizeConflictSet -> IndependentGoals -> AvoidReinstalls -> ShadowPkgs -> StrongFlags -> OnlyConstrained -> Maybe Int -> EnableBackjumping -> SolveExecutables -> Maybe (Variable QPN -> Variable QPN -> Ordering) -> Verbosity -> PruneAfterFirstSuccess -> SolverConfig
[reorderGoals] :: SolverConfig -> ReorderGoals
[countConflicts] :: SolverConfig -> CountConflicts
[fineGrainedConflicts] :: SolverConfig -> FineGrainedConflicts
[minimizeConflictSet] :: SolverConfig -> MinimizeConflictSet
[independentGoals] :: SolverConfig -> IndependentGoals
[avoidReinstalls] :: SolverConfig -> AvoidReinstalls
[shadowPkgs] :: SolverConfig -> ShadowPkgs
[strongFlags] :: SolverConfig -> StrongFlags
[onlyConstrained] :: SolverConfig -> OnlyConstrained
[maxBackjumps] :: SolverConfig -> Maybe Int
[enableBackjumping] :: SolverConfig -> EnableBackjumping
[solveExecutables] :: SolverConfig -> SolveExecutables
[goalOrder] :: SolverConfig -> Maybe (Variable QPN -> Variable QPN -> Ordering)
[solverVerbosity] :: SolverConfig -> Verbosity
[pruneAfterFirstSuccess] :: SolverConfig -> PruneAfterFirstSuccess

-- | Whether to remove all choices after the first successful choice at
--   each level in the search tree.
newtype PruneAfterFirstSuccess
PruneAfterFirstSuccess :: Bool -> PruneAfterFirstSuccess
