{-# 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(..)
, installedPackageId
, 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' = mungedName . mungedId
mungedVersion' :: HasMungedPackageId munged => munged -> Version
mungedVersion' = mungedVersion . mungedId
class HasMungedPackageId pkg where
mungedId :: pkg -> MungedPackageId
instance Package PackageIdentifier where
packageId = id
packageName :: Package pkg => pkg -> PackageName
packageName = pkgName . packageId
packageVersion :: Package pkg => pkg -> Version
packageVersion = pkgVersion . packageId
instance HasMungedPackageId MungedPackageId where
mungedId = id
class Package pkg => HasUnitId pkg where
installedUnitId :: pkg -> UnitId
{-# DEPRECATED installedPackageId "Use installedUnitId instead. This symbol will be removed in Cabal-3.0 (est. Mar 2019)." #-}
installedPackageId :: HasUnitId pkg => pkg -> UnitId
installedPackageId = installedUnitId
class (HasUnitId pkg) => PackageInstalled pkg where
installedDepends :: pkg -> [UnitId]