{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
module Distribution.Types.PkgconfigDependency
  ( PkgconfigDependency(..)
  ) where

import Distribution.Compat.Prelude
import Prelude ()

import Distribution.Types.PkgconfigName
import Distribution.Types.PkgconfigVersionRange

import Distribution.Parsec
import Distribution.Pretty

import qualified Distribution.Compat.CharParsing as P
import           Text.PrettyPrint           ((<+>))

-- | Describes a dependency on a pkg-config library
--
-- @since 2.0.0.2
data PkgconfigDependency = PkgconfigDependency
                           PkgconfigName
                           PkgconfigVersionRange
                         deriving ((forall x. PkgconfigDependency -> Rep PkgconfigDependency x)
-> (forall x. Rep PkgconfigDependency x -> PkgconfigDependency)
-> Generic PkgconfigDependency
forall x. Rep PkgconfigDependency x -> PkgconfigDependency
forall x. PkgconfigDependency -> Rep PkgconfigDependency x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PkgconfigDependency x -> PkgconfigDependency
$cfrom :: forall x. PkgconfigDependency -> Rep PkgconfigDependency x
Generic, ReadPrec [PkgconfigDependency]
ReadPrec PkgconfigDependency
Int -> ReadS PkgconfigDependency
ReadS [PkgconfigDependency]
(Int -> ReadS PkgconfigDependency)
-> ReadS [PkgconfigDependency]
-> ReadPrec PkgconfigDependency
-> ReadPrec [PkgconfigDependency]
-> Read PkgconfigDependency
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PkgconfigDependency]
$creadListPrec :: ReadPrec [PkgconfigDependency]
readPrec :: ReadPrec PkgconfigDependency
$creadPrec :: ReadPrec PkgconfigDependency
readList :: ReadS [PkgconfigDependency]
$creadList :: ReadS [PkgconfigDependency]
readsPrec :: Int -> ReadS PkgconfigDependency
$creadsPrec :: Int -> ReadS PkgconfigDependency
External instance of the constraint type Read PkgconfigVersionRange
External instance of the constraint type Read PkgconfigName
External instance of the constraint type Monad ReadPrec
External instance of the constraint type Monad ReadPrec
Instance of class: Read of the constraint type Read PkgconfigDependency
Read, Int -> PkgconfigDependency -> ShowS
[PkgconfigDependency] -> ShowS
PkgconfigDependency -> String
(Int -> PkgconfigDependency -> ShowS)
-> (PkgconfigDependency -> String)
-> ([PkgconfigDependency] -> ShowS)
-> Show PkgconfigDependency
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PkgconfigDependency] -> ShowS
$cshowList :: [PkgconfigDependency] -> ShowS
show :: PkgconfigDependency -> String
$cshow :: PkgconfigDependency -> String
showsPrec :: Int -> PkgconfigDependency -> ShowS
$cshowsPrec :: Int -> PkgconfigDependency -> ShowS
External instance of the constraint type Show PkgconfigVersionRange
External instance of the constraint type Show PkgconfigName
External instance of the constraint type Ord Int
Show, PkgconfigDependency -> PkgconfigDependency -> Bool
(PkgconfigDependency -> PkgconfigDependency -> Bool)
-> (PkgconfigDependency -> PkgconfigDependency -> Bool)
-> Eq PkgconfigDependency
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PkgconfigDependency -> PkgconfigDependency -> Bool
$c/= :: PkgconfigDependency -> PkgconfigDependency -> Bool
== :: PkgconfigDependency -> PkgconfigDependency -> Bool
$c== :: PkgconfigDependency -> PkgconfigDependency -> Bool
External instance of the constraint type Eq PkgconfigVersionRange
External instance of the constraint type Eq PkgconfigName
Eq, Typeable, Typeable PkgconfigDependency
DataType
Constr
Typeable PkgconfigDependency
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> PkgconfigDependency
    -> c PkgconfigDependency)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PkgconfigDependency)
-> (PkgconfigDependency -> Constr)
-> (PkgconfigDependency -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PkgconfigDependency))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PkgconfigDependency))
-> ((forall b. Data b => b -> b)
    -> PkgconfigDependency -> PkgconfigDependency)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PkgconfigDependency -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PkgconfigDependency -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> PkgconfigDependency -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> PkgconfigDependency -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PkgconfigDependency -> m PkgconfigDependency)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PkgconfigDependency -> m PkgconfigDependency)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PkgconfigDependency -> m PkgconfigDependency)
-> Data PkgconfigDependency
PkgconfigDependency -> DataType
PkgconfigDependency -> Constr
(forall b. Data b => b -> b)
-> PkgconfigDependency -> PkgconfigDependency
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> PkgconfigDependency
-> c PkgconfigDependency
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PkgconfigDependency
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) -> PkgconfigDependency -> u
forall u.
(forall d. Data d => d -> u) -> PkgconfigDependency -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PkgconfigDependency -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PkgconfigDependency -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PkgconfigDependency -> m PkgconfigDependency
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PkgconfigDependency -> m PkgconfigDependency
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PkgconfigDependency
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> PkgconfigDependency
-> c PkgconfigDependency
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PkgconfigDependency)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PkgconfigDependency)
$cPkgconfigDependency :: Constr
$tPkgconfigDependency :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> PkgconfigDependency -> m PkgconfigDependency
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PkgconfigDependency -> m PkgconfigDependency
gmapMp :: (forall d. Data d => d -> m d)
-> PkgconfigDependency -> m PkgconfigDependency
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PkgconfigDependency -> m PkgconfigDependency
gmapM :: (forall d. Data d => d -> m d)
-> PkgconfigDependency -> m PkgconfigDependency
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PkgconfigDependency -> m PkgconfigDependency
gmapQi :: Int -> (forall d. Data d => d -> u) -> PkgconfigDependency -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> PkgconfigDependency -> u
gmapQ :: (forall d. Data d => d -> u) -> PkgconfigDependency -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> PkgconfigDependency -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PkgconfigDependency -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PkgconfigDependency -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PkgconfigDependency -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PkgconfigDependency -> r
gmapT :: (forall b. Data b => b -> b)
-> PkgconfigDependency -> PkgconfigDependency
$cgmapT :: (forall b. Data b => b -> b)
-> PkgconfigDependency -> PkgconfigDependency
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PkgconfigDependency)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PkgconfigDependency)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c PkgconfigDependency)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PkgconfigDependency)
dataTypeOf :: PkgconfigDependency -> DataType
$cdataTypeOf :: PkgconfigDependency -> DataType
toConstr :: PkgconfigDependency -> Constr
$ctoConstr :: PkgconfigDependency -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PkgconfigDependency
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PkgconfigDependency
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> PkgconfigDependency
-> c PkgconfigDependency
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> PkgconfigDependency
-> c PkgconfigDependency
External instance of the constraint type Data PkgconfigName
External instance of the constraint type Data PkgconfigVersionRange
Data)

instance Binary PkgconfigDependency
instance Structured PkgconfigDependency
instance NFData PkgconfigDependency where rnf :: PkgconfigDependency -> ()
rnf = PkgconfigDependency -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
External instance of the constraint type forall (a :: * -> *) i (c :: Meta). GNFData a => GNFData (M1 i c a)
External instance of the constraint type forall (a :: * -> *) i (c :: Meta). GNFData a => GNFData (M1 i c a)
External instance of the constraint type forall (a :: * -> *) (b :: * -> *).
(GNFData a, GNFData b) =>
GNFData (a :*: b)
External instance of the constraint type forall (a :: * -> *) i (c :: Meta). GNFData a => GNFData (M1 i c a)
External instance of the constraint type forall a i. NFData a => GNFData (K1 i a)
External instance of the constraint type NFData PkgconfigName
External instance of the constraint type forall (a :: * -> *) i (c :: Meta). GNFData a => GNFData (M1 i c a)
External instance of the constraint type forall a i. NFData a => GNFData (K1 i a)
External instance of the constraint type NFData PkgconfigVersionRange
Instance of class: Generic of the constraint type Generic PkgconfigDependency
genericRnf

instance Pretty PkgconfigDependency where
  pretty :: PkgconfigDependency -> Doc
pretty (PkgconfigDependency PkgconfigName
name PkgconfigVersionRange
ver) =
    PkgconfigName -> Doc
forall a. Pretty a => a -> Doc
External instance of the constraint type Pretty PkgconfigName
pretty PkgconfigName
name Doc -> Doc -> Doc
<+> PkgconfigVersionRange -> Doc
forall a. Pretty a => a -> Doc
External instance of the constraint type Pretty PkgconfigVersionRange
pretty PkgconfigVersionRange
ver

instance Parsec PkgconfigDependency where
    parsec :: m PkgconfigDependency
parsec = do
        PkgconfigName
name <- m PkgconfigName
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
Evidence bound by a type signature of the constraint type CabalParsing m
External instance of the constraint type Parsec PkgconfigName
parsec
        m ()
forall (m :: * -> *). CharParsing m => m ()
External instance of the constraint type forall (m :: * -> *). CabalParsing m => CharParsing m
Evidence bound by a type signature of the constraint type CabalParsing m
P.spaces
        PkgconfigVersionRange
verRange <- m PkgconfigVersionRange
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
Evidence bound by a type signature of the constraint type CabalParsing m
External instance of the constraint type Parsec PkgconfigVersionRange
parsec m PkgconfigVersionRange
-> m PkgconfigVersionRange -> m PkgconfigVersionRange
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
External instance of the constraint type forall (m :: * -> *). Parsing m => Alternative m
External instance of the constraint type forall (m :: * -> *). CharParsing m => Parsing m
External instance of the constraint type forall (m :: * -> *). CabalParsing m => CharParsing m
Evidence bound by a type signature of the constraint type CabalParsing m
<|> PkgconfigVersionRange -> m PkgconfigVersionRange
forall (f :: * -> *) a. Applicative f => a -> f a
External instance of the constraint type forall (f :: * -> *). Alternative f => Applicative f
External instance of the constraint type forall (m :: * -> *). Parsing m => Alternative m
External instance of the constraint type forall (m :: * -> *). CharParsing m => Parsing m
External instance of the constraint type forall (m :: * -> *). CabalParsing m => CharParsing m
Evidence bound by a type signature of the constraint type CabalParsing m
pure PkgconfigVersionRange
anyPkgconfigVersion
        PkgconfigDependency -> m PkgconfigDependency
forall (f :: * -> *) a. Applicative f => a -> f a
External instance of the constraint type forall (f :: * -> *). Alternative f => Applicative f
External instance of the constraint type forall (m :: * -> *). Parsing m => Alternative m
External instance of the constraint type forall (m :: * -> *). CharParsing m => Parsing m
External instance of the constraint type forall (m :: * -> *). CabalParsing m => CharParsing m
Evidence bound by a type signature of the constraint type CabalParsing m
pure (PkgconfigDependency -> m PkgconfigDependency)
-> PkgconfigDependency -> m PkgconfigDependency
forall a b. (a -> b) -> a -> b
$ PkgconfigName -> PkgconfigVersionRange -> PkgconfigDependency
PkgconfigDependency PkgconfigName
name PkgconfigVersionRange
verRange