never executed always true always false
1 {-# LANGUAGE DeriveGeneric #-}
2 module Distribution.Client.Dependency.Types (
3 PreSolver(..),
4 Solver(..),
5 PackagesPreferenceDefault(..),
6 ) where
7
8 import Distribution.Client.Compat.Prelude
9 import Prelude ()
10
11 import Text.PrettyPrint (text)
12
13 import qualified Distribution.Compat.CharParsing as P
14
15
16 -- | All the solvers that can be selected.
17 data PreSolver = AlwaysModular
18 deriving (Eq, Ord, Show, Bounded, Enum, Generic)
19
20 -- | All the solvers that can be used.
21 data Solver = Modular
22 deriving (Eq, Ord, Show, Bounded, Enum, Generic)
23
24 instance Binary PreSolver
25 instance Binary Solver
26
27 instance Structured PreSolver
28 instance Structured Solver
29
30 instance Pretty PreSolver where
31 pretty AlwaysModular = text "modular"
32
33 instance Parsec PreSolver where
34 parsec = do
35 name <- P.munch1 isAlpha
36 case map toLower name of
37 "modular" -> return AlwaysModular
38 _ -> P.unexpected $ "PreSolver: " ++ name
39
40 -- | Global policy for all packages to say if we prefer package versions that
41 -- are already installed locally or if we just prefer the latest available.
42 --
43 data PackagesPreferenceDefault =
44
45 -- | Always prefer the latest version irrespective of any existing
46 -- installed version.
47 --
48 -- * This is the standard policy for upgrade.
49 --
50 PreferAllLatest
51
52 -- | Always prefer the installed versions over ones that would need to be
53 -- installed. Secondarily, prefer latest versions (eg the latest installed
54 -- version or if there are none then the latest source version).
55 | PreferAllInstalled
56
57 -- | Prefer the latest version for packages that are explicitly requested
58 -- but prefers the installed version for any other packages.
59 --
60 -- * This is the standard policy for install.
61 --
62 | PreferLatestForSelected
63 deriving Show