    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE DeriveDataTypeable #-}
    module Distribution.Solver.Types.SourcePackage
        ( PackageDescriptionOverride
        , SourcePackage(..)
        ) where

    import Distribution.Solver.Compat.Prelude
    import Prelude ()

    import Distribution.Package
             ( PackageId, Package(..) )
    import Distribution.PackageDescription
             ( GenericPackageDescription(..) )

    import Data.ByteString.Lazy (ByteString)

    -- | A package description along with the location of the package sources.
    --
    data SourcePackage loc = SourcePackage
      { forall loc. SourcePackage loc -> PackageId
    srcpkgPackageId     :: PackageId
      , forall loc. SourcePackage loc -> GenericPackageDescription
    srcpkgDescription   :: GenericPackageDescription
        -- ^ Note, this field is lazy, e.g. when reading in hackage index
        --   we parse only what we need, not whole index.
      , forall loc. SourcePackage loc -> loc
    srcpkgSource        :: loc
      , forall loc. SourcePackage loc -> PackageDescriptionOverride
    srcpkgDescrOverride :: PackageDescriptionOverride
      }
      deriving (SourcePackage loc -> SourcePackage loc -> Bool
    (SourcePackage loc -> SourcePackage loc -> Bool)
    -> (SourcePackage loc -> SourcePackage loc -> Bool)
    -> Eq (SourcePackage loc)
    forall loc.
    Eq loc =>
    SourcePackage loc -> SourcePackage loc -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: forall loc.
    Eq loc =>
    SourcePackage loc -> SourcePackage loc -> Bool
    == :: SourcePackage loc -> SourcePackage loc -> Bool
    $c/= :: forall loc.
    Eq loc =>
    SourcePackage loc -> SourcePackage loc -> Bool
    /= :: SourcePackage loc -> SourcePackage loc -> Bool
    Eq, Int -> SourcePackage loc -> ShowS
    [SourcePackage loc] -> ShowS
    SourcePackage loc -> String
    (Int -> SourcePackage loc -> ShowS)
    -> (SourcePackage loc -> String)
    -> ([SourcePackage loc] -> ShowS)
    -> Show (SourcePackage loc)
    forall loc. Show loc => Int -> SourcePackage loc -> ShowS
    forall loc. Show loc => [SourcePackage loc] -> ShowS
    forall loc. Show loc => SourcePackage loc -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall loc. Show loc => Int -> SourcePackage loc -> ShowS
    showsPrec :: Int -> SourcePackage loc -> ShowS
    $cshow :: forall loc. Show loc => SourcePackage loc -> String
    show :: SourcePackage loc -> String
    $cshowList :: forall loc. Show loc => [SourcePackage loc] -> ShowS
    showList :: [SourcePackage loc] -> ShowS
    Show, (forall x. SourcePackage loc -> Rep (SourcePackage loc) x)
    -> (forall x. Rep (SourcePackage loc) x -> SourcePackage loc)
    -> Generic (SourcePackage loc)
    forall x. Rep (SourcePackage loc) x -> SourcePackage loc
    forall x. SourcePackage loc -> Rep (SourcePackage loc) x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    forall loc x. Rep (SourcePackage loc) x -> SourcePackage loc
    forall loc x. SourcePackage loc -> Rep (SourcePackage loc) x
    $cfrom :: forall loc x. SourcePackage loc -> Rep (SourcePackage loc) x
    from :: forall x. SourcePackage loc -> Rep (SourcePackage loc) x
    $cto :: forall loc x. Rep (SourcePackage loc) x -> SourcePackage loc
    to :: forall x. Rep (SourcePackage loc) x -> SourcePackage loc
    Generic, Typeable)

    instance Binary loc => Binary (SourcePackage loc)
    instance Structured loc => Structured (SourcePackage loc)

    instance Package (SourcePackage a) where packageId :: SourcePackage a -> PackageId
    packageId = SourcePackage a -> PackageId
    forall loc. SourcePackage loc -> PackageId
    srcpkgPackageId

    -- | We sometimes need to override the .cabal file in the tarball with
    -- the newer one from the package index.
    type PackageDescriptionOverride = Maybe ByteString