{-# 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. 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
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
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]
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
SetupBuildInfo -> DataType
SetupBuildInfo -> Constr
(forall b. Data b => b -> b) -> SetupBuildInfo -> 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)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
Monad m =>
(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 :: forall u.
Int -> (forall d. Data d => d -> u) -> SetupBuildInfo -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SetupBuildInfo -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> SetupBuildInfo -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SetupBuildInfo -> [u]
gmapQr :: forall r r'.
(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 :: forall r r'.
(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 (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(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 (t :: * -> *) (c :: * -> *).
Typeable t =>
(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 (c :: * -> *).
(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 (c :: * -> *).
(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
Data)

instance Binary SetupBuildInfo
instance Structured SetupBuildInfo
instance NFData SetupBuildInfo where rnf :: SetupBuildInfo -> ()
rnf = 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 = 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 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)