{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module Distribution.Types.LibraryVisibility(
LibraryVisibility(..),
) where
import Distribution.Compat.Prelude
import Prelude ()
import Distribution.Parsec
import Distribution.Pretty
import qualified Distribution.Compat.CharParsing as P
import qualified Text.PrettyPrint as Disp
data LibraryVisibility
= LibraryVisibilityPublic
| LibraryVisibilityPrivate
deriving ((forall x. LibraryVisibility -> Rep LibraryVisibility x)
-> (forall x. Rep LibraryVisibility x -> LibraryVisibility)
-> Generic LibraryVisibility
forall x. Rep LibraryVisibility x -> LibraryVisibility
forall x. LibraryVisibility -> Rep LibraryVisibility x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LibraryVisibility -> Rep LibraryVisibility x
from :: forall x. LibraryVisibility -> Rep LibraryVisibility x
$cto :: forall x. Rep LibraryVisibility x -> LibraryVisibility
to :: forall x. Rep LibraryVisibility x -> LibraryVisibility
Generic, Int -> LibraryVisibility -> ShowS
[LibraryVisibility] -> ShowS
LibraryVisibility -> String
(Int -> LibraryVisibility -> ShowS)
-> (LibraryVisibility -> String)
-> ([LibraryVisibility] -> ShowS)
-> Show LibraryVisibility
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LibraryVisibility -> ShowS
showsPrec :: Int -> LibraryVisibility -> ShowS
$cshow :: LibraryVisibility -> String
show :: LibraryVisibility -> String
$cshowList :: [LibraryVisibility] -> ShowS
showList :: [LibraryVisibility] -> ShowS
Show, ReadPrec [LibraryVisibility]
ReadPrec LibraryVisibility
Int -> ReadS LibraryVisibility
ReadS [LibraryVisibility]
(Int -> ReadS LibraryVisibility)
-> ReadS [LibraryVisibility]
-> ReadPrec LibraryVisibility
-> ReadPrec [LibraryVisibility]
-> Read LibraryVisibility
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS LibraryVisibility
readsPrec :: Int -> ReadS LibraryVisibility
$creadList :: ReadS [LibraryVisibility]
readList :: ReadS [LibraryVisibility]
$creadPrec :: ReadPrec LibraryVisibility
readPrec :: ReadPrec LibraryVisibility
$creadListPrec :: ReadPrec [LibraryVisibility]
readListPrec :: ReadPrec [LibraryVisibility]
Read, LibraryVisibility -> LibraryVisibility -> Bool
(LibraryVisibility -> LibraryVisibility -> Bool)
-> (LibraryVisibility -> LibraryVisibility -> Bool)
-> Eq LibraryVisibility
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LibraryVisibility -> LibraryVisibility -> Bool
== :: LibraryVisibility -> LibraryVisibility -> Bool
$c/= :: LibraryVisibility -> LibraryVisibility -> Bool
/= :: LibraryVisibility -> LibraryVisibility -> Bool
Eq, Typeable, Typeable LibraryVisibility
Typeable LibraryVisibility
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> LibraryVisibility
-> c LibraryVisibility)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LibraryVisibility)
-> (LibraryVisibility -> Constr)
-> (LibraryVisibility -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LibraryVisibility))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LibraryVisibility))
-> ((forall b. Data b => b -> b)
-> LibraryVisibility -> LibraryVisibility)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LibraryVisibility -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LibraryVisibility -> r)
-> (forall u.
(forall d. Data d => d -> u) -> LibraryVisibility -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> LibraryVisibility -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility)
-> Data LibraryVisibility
LibraryVisibility -> Constr
LibraryVisibility -> DataType
(forall b. Data b => b -> b)
-> LibraryVisibility -> LibraryVisibility
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) -> LibraryVisibility -> u
forall u. (forall d. Data d => d -> u) -> LibraryVisibility -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LibraryVisibility -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LibraryVisibility -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LibraryVisibility
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LibraryVisibility -> c LibraryVisibility
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LibraryVisibility)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LibraryVisibility)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LibraryVisibility -> c LibraryVisibility
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LibraryVisibility -> c LibraryVisibility
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LibraryVisibility
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LibraryVisibility
$ctoConstr :: LibraryVisibility -> Constr
toConstr :: LibraryVisibility -> Constr
$cdataTypeOf :: LibraryVisibility -> DataType
dataTypeOf :: LibraryVisibility -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LibraryVisibility)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LibraryVisibility)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LibraryVisibility)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c LibraryVisibility)
$cgmapT :: (forall b. Data b => b -> b)
-> LibraryVisibility -> LibraryVisibility
gmapT :: (forall b. Data b => b -> b)
-> LibraryVisibility -> LibraryVisibility
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LibraryVisibility -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LibraryVisibility -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LibraryVisibility -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LibraryVisibility -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LibraryVisibility -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> LibraryVisibility -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> LibraryVisibility -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> LibraryVisibility -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> LibraryVisibility -> m LibraryVisibility
Data)
instance Pretty LibraryVisibility where
pretty :: LibraryVisibility -> Doc
pretty LibraryVisibility
LibraryVisibilityPublic = String -> Doc
Disp.text String
"public"
pretty LibraryVisibility
LibraryVisibilityPrivate = String -> Doc
Disp.text String
"private"
instance Parsec LibraryVisibility where
parsec :: forall (m :: * -> *). CabalParsing m => m LibraryVisibility
parsec = do
String
name <- (Char -> Bool) -> m String
forall (m :: * -> *). CharParsing m => (Char -> Bool) -> m String
P.munch1 Char -> Bool
isAlpha
case String
name of
String
"public" -> LibraryVisibility -> m LibraryVisibility
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return LibraryVisibility
LibraryVisibilityPublic
String
"private" -> LibraryVisibility -> m LibraryVisibility
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return LibraryVisibility
LibraryVisibilityPrivate
String
_ -> String -> m LibraryVisibility
forall a. String -> m a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> m LibraryVisibility) -> String -> m LibraryVisibility
forall a b. (a -> b) -> a -> b
$ String
"Unknown visibility: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
name
instance Binary LibraryVisibility
instance Structured LibraryVisibility
instance NFData LibraryVisibility where rnf :: LibraryVisibility -> ()
rnf = LibraryVisibility -> ()
forall a. (Generic a, GNFData (Rep a)) => a -> ()
genericRnf
instance Semigroup LibraryVisibility where
LibraryVisibility
LibraryVisibilityPrivate <> :: LibraryVisibility -> LibraryVisibility -> LibraryVisibility
<> LibraryVisibility
LibraryVisibilityPrivate = LibraryVisibility
LibraryVisibilityPrivate
LibraryVisibility
_ <> LibraryVisibility
_ = LibraryVisibility
LibraryVisibilityPublic
instance Monoid LibraryVisibility where
mempty :: LibraryVisibility
mempty = LibraryVisibility
LibraryVisibilityPrivate
mappend :: LibraryVisibility -> LibraryVisibility -> LibraryVisibility
mappend = LibraryVisibility -> LibraryVisibility -> LibraryVisibility
forall a. Semigroup a => a -> a -> a
(<>)