{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}

module Distribution.Types.SetupBuildInfo (
    SetupBuildInfo(..)
) where

import Prelude ()
import Distribution.Compat.Prelude

import Distribution.Types.Dependency

-- ---------------------------------------------------------------------------
-- The SetupBuildInfo type

-- One can see this as a very cut-down version of BuildInfo below.
-- To keep things simple for tools that compile Setup.hs we limit the
-- options authors can specify to just Haskell package dependencies.

data SetupBuildInfo = SetupBuildInfo
    { SetupBuildInfo -> [Dependency]
setupDepends        :: [Dependency]
    , SetupBuildInfo -> Bool
defaultSetupDepends :: Bool
        -- ^ Is this a default 'custom-setup' section added by the cabal-install
        -- code (as opposed to user-provided)? This field is only used
        -- internally, and doesn't correspond to anything in the .cabal
        -- file. See #3199.
    }
    deriving ((forall x. SetupBuildInfo -> Rep SetupBuildInfo x)
-> (forall x. Rep SetupBuildInfo x -> SetupBuildInfo)
-> Generic SetupBuildInfo
forall x. Rep SetupBuildInfo x -> SetupBuildInfo
forall x. SetupBuildInfo -> Rep SetupBuildInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetupBuildInfo x -> SetupBuildInfo
$cfrom :: forall x. SetupBuildInfo -> Rep SetupBuildInfo x
Generic, Int -> SetupBuildInfo -> ShowS
[SetupBuildInfo] -> ShowS
SetupBuildInfo -> String
(Int -> SetupBuildInfo -> ShowS)
-> (SetupBuildInfo -> String)
-> ([SetupBuildInfo] -> ShowS)
-> Show SetupBuildInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetupBuildInfo] -> ShowS
$cshowList :: [SetupBuildInfo] -> ShowS
show :: SetupBuildInfo -> String
$cshow :: SetupBuildInfo -> String
showsPrec :: Int -> SetupBuildInfo -> ShowS
$cshowsPrec :: Int -> SetupBuildInfo -> ShowS
Show, SetupBuildInfo -> SetupBuildInfo -> Bool
(SetupBuildInfo -> SetupBuildInfo -> Bool)
-> (SetupBuildInfo -> SetupBuildInfo -> Bool) -> Eq SetupBuildInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetupBuildInfo -> SetupBuildInfo -> Bool
$c/= :: SetupBuildInfo -> SetupBuildInfo -> Bool
== :: SetupBuildInfo -> SetupBuildInfo -> Bool
$c== :: SetupBuildInfo -> SetupBuildInfo -> Bool
Eq, ReadPrec [SetupBuildInfo]
ReadPrec SetupBuildInfo
Int -> ReadS SetupBuildInfo
ReadS [SetupBuildInfo]
(Int -> ReadS SetupBuildInfo)
-> ReadS [SetupBuildInfo]
-> ReadPrec SetupBuildInfo
-> ReadPrec [SetupBuildInfo]
-> Read SetupBuildInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SetupBuildInfo]
$creadListPrec :: ReadPrec [SetupBuildInfo]
readPrec :: ReadPrec SetupBuildInfo
$creadPrec :: ReadPrec SetupBuildInfo
readList :: ReadS [SetupBuildInfo]
$creadList :: ReadS [SetupBuildInfo]
readsPrec :: Int -> ReadS SetupBuildInfo
$creadsPrec :: Int -> ReadS SetupBuildInfo
Read, Typeable, Typeable SetupBuildInfo
DataType
Constr
Typeable SetupBuildInfo
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> SetupBuildInfo -> c SetupBuildInfo)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SetupBuildInfo)
-> (SetupBuildInfo -> Constr)
-> (SetupBuildInfo -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SetupBuildInfo))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SetupBuildInfo))
-> ((forall b. Data b => b -> b)
    -> SetupBuildInfo -> SetupBuildInfo)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SetupBuildInfo -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SetupBuildInfo -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> SetupBuildInfo -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> SetupBuildInfo -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SetupBuildInfo -> m SetupBuildInfo)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SetupBuildInfo -> m SetupBuildInfo)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SetupBuildInfo -> m SetupBuildInfo)
-> Data SetupBuildInfo
SetupBuildInfo -> DataType
SetupBuildInfo -> Constr
(forall b. Data b => b -> b) -> SetupBuildInfo -> SetupBuildInfo
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SetupBuildInfo -> c SetupBuildInfo
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SetupBuildInfo
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> SetupBuildInfo -> u
forall u. (forall d. Data d => d -> u) -> SetupBuildInfo -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SetupBuildInfo -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SetupBuildInfo -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SetupBuildInfo -> m SetupBuildInfo
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SetupBuildInfo -> m SetupBuildInfo
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SetupBuildInfo
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SetupBuildInfo -> c SetupBuildInfo
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SetupBuildInfo)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SetupBuildInfo)
$cSetupBuildInfo :: Constr
$tSetupBuildInfo :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> SetupBuildInfo -> m SetupBuildInfo
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SetupBuildInfo -> m SetupBuildInfo
gmapMp :: (forall d. Data d => d -> m d)
-> SetupBuildInfo -> m SetupBuildInfo
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SetupBuildInfo -> m SetupBuildInfo
gmapM :: (forall d. Data d => d -> m d)
-> SetupBuildInfo -> m SetupBuildInfo
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SetupBuildInfo -> m SetupBuildInfo
gmapQi :: Int -> (forall d. Data d => d -> u) -> SetupBuildInfo -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SetupBuildInfo -> u
gmapQ :: (forall d. Data d => d -> u) -> SetupBuildInfo -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SetupBuildInfo -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SetupBuildInfo -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SetupBuildInfo -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SetupBuildInfo -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SetupBuildInfo -> r
gmapT :: (forall b. Data b => b -> b) -> SetupBuildInfo -> SetupBuildInfo
$cgmapT :: (forall b. Data b => b -> b) -> SetupBuildInfo -> SetupBuildInfo
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SetupBuildInfo)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SetupBuildInfo)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c SetupBuildInfo)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SetupBuildInfo)
dataTypeOf :: SetupBuildInfo -> DataType
$cdataTypeOf :: SetupBuildInfo -> DataType
toConstr :: SetupBuildInfo -> Constr
$ctoConstr :: SetupBuildInfo -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SetupBuildInfo
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SetupBuildInfo
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SetupBuildInfo -> c SetupBuildInfo
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SetupBuildInfo -> c SetupBuildInfo
$cp1Data :: Typeable SetupBuildInfo
Data)

instance Binary SetupBuildInfo
instance Structured SetupBuildInfo
instance NFData SetupBuildInfo where rnf :: SetupBuildInfo -> ()
rnf = SetupBuildInfo -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf

instance Monoid SetupBuildInfo where
    mempty :: SetupBuildInfo
mempty  = [Dependency] -> Bool -> SetupBuildInfo
SetupBuildInfo [] Bool
False
    mappend :: SetupBuildInfo -> SetupBuildInfo -> SetupBuildInfo
mappend = SetupBuildInfo -> SetupBuildInfo -> SetupBuildInfo
forall a. Semigroup a => a -> a -> a
(<>)

instance Semigroup SetupBuildInfo where
    SetupBuildInfo
a <> :: SetupBuildInfo -> SetupBuildInfo -> SetupBuildInfo
<> SetupBuildInfo
b = [Dependency] -> Bool -> SetupBuildInfo
SetupBuildInfo
        (SetupBuildInfo -> [Dependency]
setupDepends SetupBuildInfo
a [Dependency] -> [Dependency] -> [Dependency]
forall a. Semigroup a => a -> a -> a
<> SetupBuildInfo -> [Dependency]
setupDepends SetupBuildInfo
b)
        (SetupBuildInfo -> Bool
defaultSetupDepends SetupBuildInfo
a Bool -> Bool -> Bool
|| SetupBuildInfo -> Bool
defaultSetupDepends SetupBuildInfo
b)