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

module Distribution.Types.Mixin (
    Mixin(..),
) where

import Distribution.Compat.Prelude
import Prelude ()

import Text.PrettyPrint ((<+>))

import Distribution.Parsec
import Distribution.Pretty
import Distribution.Types.IncludeRenaming
import Distribution.Types.PackageName

import qualified Distribution.Compat.CharParsing as P

data Mixin = Mixin { Mixin -> PackageName
mixinPackageName :: PackageName
                   , Mixin -> IncludeRenaming
mixinIncludeRenaming :: IncludeRenaming }
    deriving (Int -> Mixin -> ShowS
[Mixin] -> ShowS
Mixin -> String
(Int -> Mixin -> ShowS)
-> (Mixin -> String) -> ([Mixin] -> ShowS) -> Show Mixin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Mixin] -> ShowS
$cshowList :: [Mixin] -> ShowS
show :: Mixin -> String
$cshow :: Mixin -> String
showsPrec :: Int -> Mixin -> ShowS
$cshowsPrec :: Int -> Mixin -> ShowS
Show, ReadPrec [Mixin]
ReadPrec Mixin
Int -> ReadS Mixin
ReadS [Mixin]
(Int -> ReadS Mixin)
-> ReadS [Mixin]
-> ReadPrec Mixin
-> ReadPrec [Mixin]
-> Read Mixin
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Mixin]
$creadListPrec :: ReadPrec [Mixin]
readPrec :: ReadPrec Mixin
$creadPrec :: ReadPrec Mixin
readList :: ReadS [Mixin]
$creadList :: ReadS [Mixin]
readsPrec :: Int -> ReadS Mixin
$creadsPrec :: Int -> ReadS Mixin
Read, Mixin -> Mixin -> Bool
(Mixin -> Mixin -> Bool) -> (Mixin -> Mixin -> Bool) -> Eq Mixin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Mixin -> Mixin -> Bool
$c/= :: Mixin -> Mixin -> Bool
== :: Mixin -> Mixin -> Bool
$c== :: Mixin -> Mixin -> Bool
Eq, Eq Mixin
Eq Mixin
-> (Mixin -> Mixin -> Ordering)
-> (Mixin -> Mixin -> Bool)
-> (Mixin -> Mixin -> Bool)
-> (Mixin -> Mixin -> Bool)
-> (Mixin -> Mixin -> Bool)
-> (Mixin -> Mixin -> Mixin)
-> (Mixin -> Mixin -> Mixin)
-> Ord Mixin
Mixin -> Mixin -> Bool
Mixin -> Mixin -> Ordering
Mixin -> Mixin -> Mixin
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Mixin -> Mixin -> Mixin
$cmin :: Mixin -> Mixin -> Mixin
max :: Mixin -> Mixin -> Mixin
$cmax :: Mixin -> Mixin -> Mixin
>= :: Mixin -> Mixin -> Bool
$c>= :: Mixin -> Mixin -> Bool
> :: Mixin -> Mixin -> Bool
$c> :: Mixin -> Mixin -> Bool
<= :: Mixin -> Mixin -> Bool
$c<= :: Mixin -> Mixin -> Bool
< :: Mixin -> Mixin -> Bool
$c< :: Mixin -> Mixin -> Bool
compare :: Mixin -> Mixin -> Ordering
$ccompare :: Mixin -> Mixin -> Ordering
$cp1Ord :: Eq Mixin
Ord, Typeable, Typeable Mixin
DataType
Constr
Typeable Mixin
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Mixin -> c Mixin)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Mixin)
-> (Mixin -> Constr)
-> (Mixin -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Mixin))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Mixin))
-> ((forall b. Data b => b -> b) -> Mixin -> Mixin)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Mixin -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Mixin -> r)
-> (forall u. (forall d. Data d => d -> u) -> Mixin -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Mixin -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Mixin -> m Mixin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Mixin -> m Mixin)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Mixin -> m Mixin)
-> Data Mixin
Mixin -> DataType
Mixin -> Constr
(forall b. Data b => b -> b) -> Mixin -> Mixin
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Mixin -> c Mixin
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Mixin
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) -> Mixin -> u
forall u. (forall d. Data d => d -> u) -> Mixin -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Mixin -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Mixin -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Mixin -> m Mixin
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Mixin -> m Mixin
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Mixin
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Mixin -> c Mixin
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Mixin)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Mixin)
$cMixin :: Constr
$tMixin :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Mixin -> m Mixin
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Mixin -> m Mixin
gmapMp :: (forall d. Data d => d -> m d) -> Mixin -> m Mixin
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Mixin -> m Mixin
gmapM :: (forall d. Data d => d -> m d) -> Mixin -> m Mixin
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Mixin -> m Mixin
gmapQi :: Int -> (forall d. Data d => d -> u) -> Mixin -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Mixin -> u
gmapQ :: (forall d. Data d => d -> u) -> Mixin -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Mixin -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Mixin -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Mixin -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Mixin -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Mixin -> r
gmapT :: (forall b. Data b => b -> b) -> Mixin -> Mixin
$cgmapT :: (forall b. Data b => b -> b) -> Mixin -> Mixin
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Mixin)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Mixin)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Mixin)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Mixin)
dataTypeOf :: Mixin -> DataType
$cdataTypeOf :: Mixin -> DataType
toConstr :: Mixin -> Constr
$ctoConstr :: Mixin -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Mixin
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Mixin
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Mixin -> c Mixin
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Mixin -> c Mixin
$cp1Data :: Typeable Mixin
Data, (forall x. Mixin -> Rep Mixin x)
-> (forall x. Rep Mixin x -> Mixin) -> Generic Mixin
forall x. Rep Mixin x -> Mixin
forall x. Mixin -> Rep Mixin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Mixin x -> Mixin
$cfrom :: forall x. Mixin -> Rep Mixin x
Generic)

instance Binary Mixin
instance Structured Mixin

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

instance Pretty Mixin where
    pretty :: Mixin -> Doc
pretty (Mixin PackageName
pkg_name IncludeRenaming
incl) = PackageName -> Doc
forall a. Pretty a => a -> Doc
pretty PackageName
pkg_name Doc -> Doc -> Doc
<+> IncludeRenaming -> Doc
forall a. Pretty a => a -> Doc
pretty IncludeRenaming
incl

instance Parsec Mixin where
    parsec :: m Mixin
parsec = do
        PackageName
mod_name <- m PackageName
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
parsec
        m ()
forall (m :: * -> *). CharParsing m => m ()
P.spaces
        IncludeRenaming
incl <- m IncludeRenaming
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
parsec
        Mixin -> m Mixin
forall (m :: * -> *) a. Monad m => a -> m a
return (PackageName -> IncludeRenaming -> Mixin
Mixin PackageName
mod_name IncludeRenaming
incl)