{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Distribution.Package
( module Distribution.Types.AbiHash
, module Distribution.Types.ComponentId
, module Distribution.Types.PackageId
, module Distribution.Types.UnitId
, module Distribution.Types.Module
, module Distribution.Types.PackageName
, module Distribution.Types.PkgconfigName
, module Distribution.Types.Dependency
, Package(..), packageName, packageVersion
, HasMungedPackageId(..), mungedName', mungedVersion'
, HasUnitId(..)
, PackageInstalled(..)
) where
import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Version
( Version )
import Distribution.Types.AbiHash
import Distribution.Types.ComponentId
import Distribution.Types.Dependency
import Distribution.Types.MungedPackageId
import Distribution.Types.PackageId
import Distribution.Types.UnitId
import Distribution.Types.Module
import Distribution.Types.MungedPackageName
import Distribution.Types.PackageName
import Distribution.Types.PkgconfigName
class Package pkg where
packageId :: pkg -> PackageIdentifier
mungedName' :: HasMungedPackageId pkg => pkg -> MungedPackageName
mungedName' :: pkg -> MungedPackageName
mungedName' = MungedPackageId -> MungedPackageName
mungedName (MungedPackageId -> MungedPackageName)
-> (pkg -> MungedPackageId) -> pkg -> MungedPackageName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. pkg -> MungedPackageId
forall pkg. HasMungedPackageId pkg => pkg -> MungedPackageId
mungedId
mungedVersion' :: HasMungedPackageId munged => munged -> Version
mungedVersion' :: munged -> Version
mungedVersion' = MungedPackageId -> Version
mungedVersion (MungedPackageId -> Version)
-> (munged -> MungedPackageId) -> munged -> Version
forall b c a. (b -> c) -> (a -> b) -> a -> c
. munged -> MungedPackageId
forall pkg. HasMungedPackageId pkg => pkg -> MungedPackageId
mungedId
class HasMungedPackageId pkg where
mungedId :: pkg -> MungedPackageId
instance Package PackageIdentifier where
packageId :: PackageIdentifier -> PackageIdentifier
packageId = PackageIdentifier -> PackageIdentifier
forall a. a -> a
id
packageName :: Package pkg => pkg -> PackageName
packageName :: pkg -> PackageName
packageName = PackageIdentifier -> PackageName
pkgName (PackageIdentifier -> PackageName)
-> (pkg -> PackageIdentifier) -> pkg -> PackageName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. pkg -> PackageIdentifier
forall pkg. Package pkg => pkg -> PackageIdentifier
packageId
packageVersion :: Package pkg => pkg -> Version
packageVersion :: pkg -> Version
packageVersion = PackageIdentifier -> Version
pkgVersion (PackageIdentifier -> Version)
-> (pkg -> PackageIdentifier) -> pkg -> Version
forall b c a. (b -> c) -> (a -> b) -> a -> c
. pkg -> PackageIdentifier
forall pkg. Package pkg => pkg -> PackageIdentifier
packageId
instance HasMungedPackageId MungedPackageId where
mungedId :: MungedPackageId -> MungedPackageId
mungedId = MungedPackageId -> MungedPackageId
forall a. a -> a
id
class Package pkg => HasUnitId pkg where
installedUnitId :: pkg -> UnitId
class (HasUnitId pkg) => PackageInstalled pkg where
installedDepends :: pkg -> [UnitId]