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

module Distribution.Types.ModuleReexport (
    ModuleReexport(..)
) where

import Distribution.Compat.Prelude
import Prelude ()

import Distribution.ModuleName
import Distribution.Parsec
import Distribution.Pretty
import Distribution.Types.PackageName

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

-- -----------------------------------------------------------------------------
-- Module re-exports

data ModuleReexport = ModuleReexport {
       ModuleReexport -> Maybe PackageName
moduleReexportOriginalPackage :: Maybe PackageName,
       ModuleReexport -> ModuleName
moduleReexportOriginalName    :: ModuleName,
       ModuleReexport -> ModuleName
moduleReexportName            :: ModuleName
    }
    deriving (ModuleReexport -> ModuleReexport -> Bool
(ModuleReexport -> ModuleReexport -> Bool)
-> (ModuleReexport -> ModuleReexport -> Bool) -> Eq ModuleReexport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleReexport -> ModuleReexport -> Bool
$c/= :: ModuleReexport -> ModuleReexport -> Bool
== :: ModuleReexport -> ModuleReexport -> Bool
$c== :: ModuleReexport -> ModuleReexport -> Bool
External instance of the constraint type Eq PackageName
External instance of the constraint type Eq ModuleName
External instance of the constraint type Eq ModuleName
External instance of the constraint type Eq PackageName
External instance of the constraint type forall a. Eq a => Eq (Maybe a)
Eq, (forall x. ModuleReexport -> Rep ModuleReexport x)
-> (forall x. Rep ModuleReexport x -> ModuleReexport)
-> Generic ModuleReexport
forall x. Rep ModuleReexport x -> ModuleReexport
forall x. ModuleReexport -> Rep ModuleReexport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModuleReexport x -> ModuleReexport
$cfrom :: forall x. ModuleReexport -> Rep ModuleReexport x
Generic, ReadPrec [ModuleReexport]
ReadPrec ModuleReexport
Int -> ReadS ModuleReexport
ReadS [ModuleReexport]
(Int -> ReadS ModuleReexport)
-> ReadS [ModuleReexport]
-> ReadPrec ModuleReexport
-> ReadPrec [ModuleReexport]
-> Read ModuleReexport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModuleReexport]
$creadListPrec :: ReadPrec [ModuleReexport]
readPrec :: ReadPrec ModuleReexport
$creadPrec :: ReadPrec ModuleReexport
readList :: ReadS [ModuleReexport]
$creadList :: ReadS [ModuleReexport]
readsPrec :: Int -> ReadS ModuleReexport
$creadsPrec :: Int -> ReadS ModuleReexport
External instance of the constraint type Read PackageName
External instance of the constraint type Read ModuleName
External instance of the constraint type Read ModuleName
External instance of the constraint type Read PackageName
External instance of the constraint type forall a. Read a => Read (Maybe a)
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 ModuleReexport
Read, Int -> ModuleReexport -> ShowS
[ModuleReexport] -> ShowS
ModuleReexport -> String
(Int -> ModuleReexport -> ShowS)
-> (ModuleReexport -> String)
-> ([ModuleReexport] -> ShowS)
-> Show ModuleReexport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleReexport] -> ShowS
$cshowList :: [ModuleReexport] -> ShowS
show :: ModuleReexport -> String
$cshow :: ModuleReexport -> String
showsPrec :: Int -> ModuleReexport -> ShowS
$cshowsPrec :: Int -> ModuleReexport -> ShowS
External instance of the constraint type Show PackageName
External instance of the constraint type Show ModuleName
External instance of the constraint type Show ModuleName
External instance of the constraint type Show PackageName
External instance of the constraint type forall a. Show a => Show (Maybe a)
External instance of the constraint type Ord Int
Show, Typeable, Typeable ModuleReexport
DataType
Constr
Typeable ModuleReexport
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ModuleReexport -> c ModuleReexport)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ModuleReexport)
-> (ModuleReexport -> Constr)
-> (ModuleReexport -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ModuleReexport))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ModuleReexport))
-> ((forall b. Data b => b -> b)
    -> ModuleReexport -> ModuleReexport)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ModuleReexport -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ModuleReexport -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ModuleReexport -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ModuleReexport -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ModuleReexport -> m ModuleReexport)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ModuleReexport -> m ModuleReexport)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ModuleReexport -> m ModuleReexport)
-> Data ModuleReexport
ModuleReexport -> DataType
ModuleReexport -> Constr
(forall b. Data b => b -> b) -> ModuleReexport -> ModuleReexport
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleReexport -> c ModuleReexport
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleReexport
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) -> ModuleReexport -> u
forall u. (forall d. Data d => d -> u) -> ModuleReexport -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleReexport -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleReexport -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleReexport -> m ModuleReexport
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleReexport -> m ModuleReexport
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleReexport
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleReexport -> c ModuleReexport
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleReexport)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleReexport)
$cModuleReexport :: Constr
$tModuleReexport :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> ModuleReexport -> m ModuleReexport
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleReexport -> m ModuleReexport
gmapMp :: (forall d. Data d => d -> m d)
-> ModuleReexport -> m ModuleReexport
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ModuleReexport -> m ModuleReexport
gmapM :: (forall d. Data d => d -> m d)
-> ModuleReexport -> m ModuleReexport
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ModuleReexport -> m ModuleReexport
gmapQi :: Int -> (forall d. Data d => d -> u) -> ModuleReexport -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ModuleReexport -> u
gmapQ :: (forall d. Data d => d -> u) -> ModuleReexport -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ModuleReexport -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleReexport -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleReexport -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleReexport -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ModuleReexport -> r
gmapT :: (forall b. Data b => b -> b) -> ModuleReexport -> ModuleReexport
$cgmapT :: (forall b. Data b => b -> b) -> ModuleReexport -> ModuleReexport
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleReexport)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ModuleReexport)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ModuleReexport)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ModuleReexport)
dataTypeOf :: ModuleReexport -> DataType
$cdataTypeOf :: ModuleReexport -> DataType
toConstr :: ModuleReexport -> Constr
$ctoConstr :: ModuleReexport -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleReexport
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ModuleReexport
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleReexport -> c ModuleReexport
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ModuleReexport -> c ModuleReexport
External instance of the constraint type Data PackageName
External instance of the constraint type Data PackageName
External instance of the constraint type Data ModuleName
External instance of the constraint type Data PackageName
External instance of the constraint type forall a. Data a => Data (Maybe a)
External instance of the constraint type Data ModuleName
External instance of the constraint type Data ModuleName
Data)

instance Binary ModuleReexport
instance Structured ModuleReexport
instance NFData ModuleReexport where rnf :: ModuleReexport -> ()
rnf = ModuleReexport -> ()
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 forall a. NFData a => NFData (Maybe a)
External instance of the constraint type NFData PackageName
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 ModuleName
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 ModuleName
Instance of class: Generic of the constraint type Generic ModuleReexport
genericRnf

instance Pretty ModuleReexport where
    pretty :: ModuleReexport -> Doc
pretty (ModuleReexport Maybe PackageName
mpkgname ModuleName
origname ModuleName
newname) =
          Doc -> (PackageName -> Doc) -> Maybe PackageName -> Doc
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Doc
Disp.empty (\PackageName
pkgname -> PackageName -> Doc
forall a. Pretty a => a -> Doc
External instance of the constraint type Pretty PackageName
pretty PackageName
pkgname Doc -> Doc -> Doc
<<>> Char -> Doc
Disp.char Char
':') Maybe PackageName
mpkgname
       Doc -> Doc -> Doc
<<>> ModuleName -> Doc
forall a. Pretty a => a -> Doc
External instance of the constraint type Pretty ModuleName
pretty ModuleName
origname
      Doc -> Doc -> Doc
<+> if ModuleName
newname ModuleName -> ModuleName -> Bool
forall a. Eq a => a -> a -> Bool
External instance of the constraint type Eq ModuleName
== ModuleName
origname
            then Doc
Disp.empty
            else String -> Doc
Disp.text String
"as" Doc -> Doc -> Doc
<+> ModuleName -> Doc
forall a. Pretty a => a -> Doc
External instance of the constraint type Pretty ModuleName
pretty ModuleName
newname

instance Parsec ModuleReexport where
    parsec :: m ModuleReexport
parsec = do
        Maybe PackageName
mpkgname <- m PackageName -> m (Maybe PackageName)
forall (f :: * -> *) a. Alternative f => f a -> f (Maybe 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
P.optional (m PackageName -> m PackageName
forall (m :: * -> *) a. Parsing m => m a -> m a
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
P.try (m PackageName -> m PackageName) -> m PackageName -> m PackageName
forall a b. (a -> b) -> a -> b
$ m PackageName
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 PackageName
parsec m PackageName -> m Char -> m PackageName
forall (f :: * -> *) a b. Applicative f => f a -> f b -> 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
<* Char -> m Char
forall (m :: * -> *). CharParsing m => Char -> m Char
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.char Char
':')
        ModuleName
origname <- m ModuleName
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 ModuleName
parsec
        ModuleName
newname  <- ModuleName -> m ModuleName -> m ModuleName
forall (m :: * -> *) a. Alternative m => a -> m a -> m 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
P.option ModuleName
origname (m ModuleName -> m ModuleName) -> m ModuleName -> m ModuleName
forall a b. (a -> b) -> a -> b
$ m ModuleName -> m ModuleName
forall (m :: * -> *) a. Parsing m => m a -> m a
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
P.try (m ModuleName -> m ModuleName) -> m ModuleName -> m ModuleName
forall a b. (a -> b) -> a -> b
$ do
            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
            String
_ <- String -> m String
forall (m :: * -> *). CharParsing m => String -> m String
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.string String
"as"
            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
            m ModuleName
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 ModuleName
parsec
        ModuleReexport -> m ModuleReexport
forall (m :: * -> *) a. Monad m => a -> m a
External instance of the constraint type forall (m :: * -> *). MonadPlus m => Monad m
External instance of the constraint type forall (m :: * -> *). CabalParsing m => MonadPlus m
Evidence bound by a type signature of the constraint type CabalParsing m
return (Maybe PackageName -> ModuleName -> ModuleName -> ModuleReexport
ModuleReexport Maybe PackageName
mpkgname ModuleName
origname ModuleName
newname)