InstSolverPackage.hs 1.38 KB
Newer Older
1
{-# LANGUAGE DeriveGeneric #-}
Oleg Grenrus's avatar
Oleg Grenrus committed
2
module Distribution.Solver.Types.InstSolverPackage
3 4 5
    ( InstSolverPackage(..)
    ) where

6 7 8
import Distribution.Solver.Compat.Prelude
import Prelude ()

9
import Distribution.Package ( Package(..), HasMungedPackageId(..), HasUnitId(..) )
10 11
import Distribution.Solver.Types.ComponentDeps ( ComponentDeps )
import Distribution.Solver.Types.SolverId
12 13 14
import Distribution.Types.MungedPackageId
import Distribution.Types.PackageId
import Distribution.Types.MungedPackageName
15 16
import Distribution.InstalledPackageInfo (InstalledPackageInfo)

Brian Wignall's avatar
Brian Wignall committed
17
-- | An 'InstSolverPackage' is a pre-existing installed package
18 19 20 21 22 23 24 25 26
-- specified by the dependency solver.
data InstSolverPackage = InstSolverPackage {
      instSolverPkgIPI :: InstalledPackageInfo,
      instSolverPkgLibDeps :: ComponentDeps [SolverId],
      instSolverPkgExeDeps :: ComponentDeps [SolverId]
    }
  deriving (Eq, Show, Generic)

instance Binary InstSolverPackage
27
instance Structured InstSolverPackage
28 29

instance Package InstSolverPackage where
30 31 32
    packageId i =
        -- HACK! See Note [Index conversion with internal libraries]
        let MungedPackageId mpn v = mungedId i
33
        in PackageIdentifier (encodeCompatPackageName mpn) v
34

35 36 37
instance HasMungedPackageId InstSolverPackage where
    mungedId = mungedId . instSolverPkgIPI

38 39
instance HasUnitId InstSolverPackage where
    installedUnitId = installedUnitId . instSolverPkgIPI