{-# 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' = 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
class (HasUnitId pkg) => PackageInstalled pkg where
installedDepends :: pkg -> [UnitId]