make LTS branch pre-releases
[cabal.git] / cabal-install-solver / src / Distribution / Solver / Modular / Var.hs
blobc3284f1c18e1c1f1557622cdc2833e097032af4c
1 {-# LANGUAGE DeriveFunctor #-}
2 module Distribution.Solver.Modular.Var (
3 Var(..)
4 , showVar
5 , varPN
6 ) where
8 import Prelude hiding (pi)
10 import Distribution.Solver.Modular.Flag
11 import Distribution.Solver.Types.PackagePath
13 {-------------------------------------------------------------------------------
14 Variables
15 -------------------------------------------------------------------------------}
17 -- | The type of variables that play a role in the solver.
18 -- Note that the tree currently does not use this type directly,
19 -- and rather has separate tree nodes for the different types of
20 -- variables. This fits better with the fact that in most cases,
21 -- these have to be treated differently.
22 data Var qpn = P qpn | F (FN qpn) | S (SN qpn)
23 deriving (Eq, Ord, Show, Functor)
25 showVar :: Var QPN -> String
26 showVar (P qpn) = showQPN qpn
27 showVar (F qfn) = showQFN qfn
28 showVar (S qsn) = showQSN qsn
30 -- | Extract the package name from a Var
31 varPN :: Var qpn -> qpn
32 varPN (P qpn) = qpn
33 varPN (F (FN qpn _)) = qpn
34 varPN (S (SN qpn _)) = qpn