{-# LANGUAGE DeriveGeneric #-}
module Distribution.Client.Dependency.Types
( PreSolver (..)
, Solver (..)
, PackagesPreferenceDefault (..)
) where
import Distribution.Client.Compat.Prelude
import Prelude ()
import Text.PrettyPrint (text)
import qualified Distribution.Compat.CharParsing as P
data PreSolver = AlwaysModular
deriving (PreSolver -> PreSolver -> Bool
(PreSolver -> PreSolver -> Bool)
-> (PreSolver -> PreSolver -> Bool) -> Eq PreSolver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PreSolver -> PreSolver -> Bool
== :: PreSolver -> PreSolver -> Bool
$c/= :: PreSolver -> PreSolver -> Bool
/= :: PreSolver -> PreSolver -> Bool
Eq, Eq PreSolver
Eq PreSolver =>
(PreSolver -> PreSolver -> Ordering)
-> (PreSolver -> PreSolver -> Bool)
-> (PreSolver -> PreSolver -> Bool)
-> (PreSolver -> PreSolver -> Bool)
-> (PreSolver -> PreSolver -> Bool)
-> (PreSolver -> PreSolver -> PreSolver)
-> (PreSolver -> PreSolver -> PreSolver)
-> Ord PreSolver
PreSolver -> PreSolver -> Bool
PreSolver -> PreSolver -> Ordering
PreSolver -> PreSolver -> PreSolver
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PreSolver -> PreSolver -> Ordering
compare :: PreSolver -> PreSolver -> Ordering
$c< :: PreSolver -> PreSolver -> Bool
< :: PreSolver -> PreSolver -> Bool
$c<= :: PreSolver -> PreSolver -> Bool
<= :: PreSolver -> PreSolver -> Bool
$c> :: PreSolver -> PreSolver -> Bool
> :: PreSolver -> PreSolver -> Bool
$c>= :: PreSolver -> PreSolver -> Bool
>= :: PreSolver -> PreSolver -> Bool
$cmax :: PreSolver -> PreSolver -> PreSolver
max :: PreSolver -> PreSolver -> PreSolver
$cmin :: PreSolver -> PreSolver -> PreSolver
min :: PreSolver -> PreSolver -> PreSolver
Ord, Int -> PreSolver -> ShowS
[PreSolver] -> ShowS
PreSolver -> String
(Int -> PreSolver -> ShowS)
-> (PreSolver -> String)
-> ([PreSolver] -> ShowS)
-> Show PreSolver
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PreSolver -> ShowS
showsPrec :: Int -> PreSolver -> ShowS
$cshow :: PreSolver -> String
show :: PreSolver -> String
$cshowList :: [PreSolver] -> ShowS
showList :: [PreSolver] -> ShowS
Show, PreSolver
PreSolver -> PreSolver -> Bounded PreSolver
forall a. a -> a -> Bounded a
$cminBound :: PreSolver
minBound :: PreSolver
$cmaxBound :: PreSolver
maxBound :: PreSolver
Bounded, Int -> PreSolver
PreSolver -> Int
PreSolver -> [PreSolver]
PreSolver -> PreSolver
PreSolver -> PreSolver -> [PreSolver]
PreSolver -> PreSolver -> PreSolver -> [PreSolver]
(PreSolver -> PreSolver)
-> (PreSolver -> PreSolver)
-> (Int -> PreSolver)
-> (PreSolver -> Int)
-> (PreSolver -> [PreSolver])
-> (PreSolver -> PreSolver -> [PreSolver])
-> (PreSolver -> PreSolver -> [PreSolver])
-> (PreSolver -> PreSolver -> PreSolver -> [PreSolver])
-> Enum PreSolver
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: PreSolver -> PreSolver
succ :: PreSolver -> PreSolver
$cpred :: PreSolver -> PreSolver
pred :: PreSolver -> PreSolver
$ctoEnum :: Int -> PreSolver
toEnum :: Int -> PreSolver
$cfromEnum :: PreSolver -> Int
fromEnum :: PreSolver -> Int
$cenumFrom :: PreSolver -> [PreSolver]
enumFrom :: PreSolver -> [PreSolver]
$cenumFromThen :: PreSolver -> PreSolver -> [PreSolver]
enumFromThen :: PreSolver -> PreSolver -> [PreSolver]
$cenumFromTo :: PreSolver -> PreSolver -> [PreSolver]
enumFromTo :: PreSolver -> PreSolver -> [PreSolver]
$cenumFromThenTo :: PreSolver -> PreSolver -> PreSolver -> [PreSolver]
enumFromThenTo :: PreSolver -> PreSolver -> PreSolver -> [PreSolver]
Enum, (forall x. PreSolver -> Rep PreSolver x)
-> (forall x. Rep PreSolver x -> PreSolver) -> Generic PreSolver
forall x. Rep PreSolver x -> PreSolver
forall x. PreSolver -> Rep PreSolver x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PreSolver -> Rep PreSolver x
from :: forall x. PreSolver -> Rep PreSolver x
$cto :: forall x. Rep PreSolver x -> PreSolver
to :: forall x. Rep PreSolver x -> PreSolver
Generic)
data Solver = Modular
deriving (Solver -> Solver -> Bool
(Solver -> Solver -> Bool)
-> (Solver -> Solver -> Bool) -> Eq Solver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Solver -> Solver -> Bool
== :: Solver -> Solver -> Bool
$c/= :: Solver -> Solver -> Bool
/= :: Solver -> Solver -> Bool
Eq, Eq Solver
Eq Solver =>
(Solver -> Solver -> Ordering)
-> (Solver -> Solver -> Bool)
-> (Solver -> Solver -> Bool)
-> (Solver -> Solver -> Bool)
-> (Solver -> Solver -> Bool)
-> (Solver -> Solver -> Solver)
-> (Solver -> Solver -> Solver)
-> Ord Solver
Solver -> Solver -> Bool
Solver -> Solver -> Ordering
Solver -> Solver -> Solver
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Solver -> Solver -> Ordering
compare :: Solver -> Solver -> Ordering
$c< :: Solver -> Solver -> Bool
< :: Solver -> Solver -> Bool
$c<= :: Solver -> Solver -> Bool
<= :: Solver -> Solver -> Bool
$c> :: Solver -> Solver -> Bool
> :: Solver -> Solver -> Bool
$c>= :: Solver -> Solver -> Bool
>= :: Solver -> Solver -> Bool
$cmax :: Solver -> Solver -> Solver
max :: Solver -> Solver -> Solver
$cmin :: Solver -> Solver -> Solver
min :: Solver -> Solver -> Solver
Ord, Int -> Solver -> ShowS
[Solver] -> ShowS
Solver -> String
(Int -> Solver -> ShowS)
-> (Solver -> String) -> ([Solver] -> ShowS) -> Show Solver
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Solver -> ShowS
showsPrec :: Int -> Solver -> ShowS
$cshow :: Solver -> String
show :: Solver -> String
$cshowList :: [Solver] -> ShowS
showList :: [Solver] -> ShowS
Show, Solver
Solver -> Solver -> Bounded Solver
forall a. a -> a -> Bounded a
$cminBound :: Solver
minBound :: Solver
$cmaxBound :: Solver
maxBound :: Solver
Bounded, Int -> Solver
Solver -> Int
Solver -> [Solver]
Solver -> Solver
Solver -> Solver -> [Solver]
Solver -> Solver -> Solver -> [Solver]
(Solver -> Solver)
-> (Solver -> Solver)
-> (Int -> Solver)
-> (Solver -> Int)
-> (Solver -> [Solver])
-> (Solver -> Solver -> [Solver])
-> (Solver -> Solver -> [Solver])
-> (Solver -> Solver -> Solver -> [Solver])
-> Enum Solver
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Solver -> Solver
succ :: Solver -> Solver
$cpred :: Solver -> Solver
pred :: Solver -> Solver
$ctoEnum :: Int -> Solver
toEnum :: Int -> Solver
$cfromEnum :: Solver -> Int
fromEnum :: Solver -> Int
$cenumFrom :: Solver -> [Solver]
enumFrom :: Solver -> [Solver]
$cenumFromThen :: Solver -> Solver -> [Solver]
enumFromThen :: Solver -> Solver -> [Solver]
$cenumFromTo :: Solver -> Solver -> [Solver]
enumFromTo :: Solver -> Solver -> [Solver]
$cenumFromThenTo :: Solver -> Solver -> Solver -> [Solver]
enumFromThenTo :: Solver -> Solver -> Solver -> [Solver]
Enum, (forall x. Solver -> Rep Solver x)
-> (forall x. Rep Solver x -> Solver) -> Generic Solver
forall x. Rep Solver x -> Solver
forall x. Solver -> Rep Solver x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Solver -> Rep Solver x
from :: forall x. Solver -> Rep Solver x
$cto :: forall x. Rep Solver x -> Solver
to :: forall x. Rep Solver x -> Solver
Generic)
instance Binary PreSolver
instance Binary Solver
instance Structured PreSolver
instance Structured Solver
instance Pretty PreSolver where
pretty :: PreSolver -> Doc
pretty PreSolver
AlwaysModular = String -> Doc
text String
"modular"
instance Parsec PreSolver where
parsec :: forall (m :: * -> *). CabalParsing m => m PreSolver
parsec = do
String
name <- (Char -> Bool) -> m String
forall (m :: * -> *). CharParsing m => (Char -> Bool) -> m String
P.munch1 Char -> Bool
isAlpha
case (Char -> Char) -> ShowS
forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
toLower String
name of
String
"modular" -> PreSolver -> m PreSolver
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return PreSolver
AlwaysModular
String
_ -> String -> m PreSolver
forall a. String -> m a
forall (m :: * -> *) a. Parsing m => String -> m a
P.unexpected (String -> m PreSolver) -> String -> m PreSolver
forall a b. (a -> b) -> a -> b
$ String
"PreSolver: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
name
data PackagesPreferenceDefault
=
PreferAllLatest
|
PreferAllOldest
|
PreferAllInstalled
|
PreferLatestForSelected
deriving (Int -> PackagesPreferenceDefault -> ShowS
[PackagesPreferenceDefault] -> ShowS
PackagesPreferenceDefault -> String
(Int -> PackagesPreferenceDefault -> ShowS)
-> (PackagesPreferenceDefault -> String)
-> ([PackagesPreferenceDefault] -> ShowS)
-> Show PackagesPreferenceDefault
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PackagesPreferenceDefault -> ShowS
showsPrec :: Int -> PackagesPreferenceDefault -> ShowS
$cshow :: PackagesPreferenceDefault -> String
show :: PackagesPreferenceDefault -> String
$cshowList :: [PackagesPreferenceDefault] -> ShowS
showList :: [PackagesPreferenceDefault] -> ShowS
Show)