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

module Distribution.Types.ForeignLibOption(
    ForeignLibOption(..)
) where

import Prelude ()
import Distribution.Compat.Prelude

import Distribution.Pretty
import Distribution.Parsec

import qualified Distribution.Compat.CharParsing as P
import qualified Text.PrettyPrint as Disp

data ForeignLibOption =
     -- | Merge in all dependent libraries (i.e., use
     -- @ghc -shared -static@ rather than just record
     -- the dependencies, ala @ghc -shared -dynamic@).
     -- This option is compulsory on Windows and unsupported
     -- on other platforms.
     ForeignLibStandalone
    deriving ((forall x. ForeignLibOption -> Rep ForeignLibOption x)
-> (forall x. Rep ForeignLibOption x -> ForeignLibOption)
-> Generic ForeignLibOption
forall x. Rep ForeignLibOption x -> ForeignLibOption
forall x. ForeignLibOption -> Rep ForeignLibOption x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ForeignLibOption -> Rep ForeignLibOption x
$cto :: forall x. Rep ForeignLibOption x -> ForeignLibOption
Generic, Int -> ForeignLibOption -> ShowS
[ForeignLibOption] -> ShowS
ForeignLibOption -> String
(Int -> ForeignLibOption -> ShowS)
-> (ForeignLibOption -> String)
-> ([ForeignLibOption] -> ShowS)
-> Show ForeignLibOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ForeignLibOption -> ShowS
showsPrec :: Int -> ForeignLibOption -> ShowS
$cshow :: ForeignLibOption -> String
show :: ForeignLibOption -> String
$cshowList :: [ForeignLibOption] -> ShowS
showList :: [ForeignLibOption] -> ShowS
Show, ReadPrec [ForeignLibOption]
ReadPrec ForeignLibOption
Int -> ReadS ForeignLibOption
ReadS [ForeignLibOption]
(Int -> ReadS ForeignLibOption)
-> ReadS [ForeignLibOption]
-> ReadPrec ForeignLibOption
-> ReadPrec [ForeignLibOption]
-> Read ForeignLibOption
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ForeignLibOption
readsPrec :: Int -> ReadS ForeignLibOption
$creadList :: ReadS [ForeignLibOption]
readList :: ReadS [ForeignLibOption]
$creadPrec :: ReadPrec ForeignLibOption
readPrec :: ReadPrec ForeignLibOption
$creadListPrec :: ReadPrec [ForeignLibOption]
readListPrec :: ReadPrec [ForeignLibOption]
Read, ForeignLibOption -> ForeignLibOption -> Bool
(ForeignLibOption -> ForeignLibOption -> Bool)
-> (ForeignLibOption -> ForeignLibOption -> Bool)
-> Eq ForeignLibOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ForeignLibOption -> ForeignLibOption -> Bool
== :: ForeignLibOption -> ForeignLibOption -> Bool
$c/= :: ForeignLibOption -> ForeignLibOption -> Bool
/= :: ForeignLibOption -> ForeignLibOption -> Bool
Eq, Typeable, Typeable ForeignLibOption
Typeable ForeignLibOption
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> ForeignLibOption -> c ForeignLibOption)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c ForeignLibOption)
-> (ForeignLibOption -> Constr)
-> (ForeignLibOption -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c ForeignLibOption))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c ForeignLibOption))
-> ((forall b. Data b => b -> b)
    -> ForeignLibOption -> ForeignLibOption)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> ForeignLibOption -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> ForeignLibOption -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> ForeignLibOption -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> ForeignLibOption -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> ForeignLibOption -> m ForeignLibOption)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ForeignLibOption -> m ForeignLibOption)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> ForeignLibOption -> m ForeignLibOption)
-> Data ForeignLibOption
ForeignLibOption -> Constr
ForeignLibOption -> DataType
(forall b. Data b => b -> b)
-> ForeignLibOption -> ForeignLibOption
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) -> ForeignLibOption -> u
forall u. (forall d. Data d => d -> u) -> ForeignLibOption -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLibOption -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLibOption -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ForeignLibOption -> m ForeignLibOption
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ForeignLibOption -> m ForeignLibOption
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForeignLibOption
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForeignLibOption -> c ForeignLibOption
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForeignLibOption)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ForeignLibOption)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForeignLibOption -> c ForeignLibOption
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ForeignLibOption -> c ForeignLibOption
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForeignLibOption
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ForeignLibOption
$ctoConstr :: ForeignLibOption -> Constr
toConstr :: ForeignLibOption -> Constr
$cdataTypeOf :: ForeignLibOption -> DataType
dataTypeOf :: ForeignLibOption -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForeignLibOption)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ForeignLibOption)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ForeignLibOption)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ForeignLibOption)
$cgmapT :: (forall b. Data b => b -> b)
-> ForeignLibOption -> ForeignLibOption
gmapT :: (forall b. Data b => b -> b)
-> ForeignLibOption -> ForeignLibOption
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLibOption -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLibOption -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLibOption -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ForeignLibOption -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ForeignLibOption -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ForeignLibOption -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ForeignLibOption -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ForeignLibOption -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ForeignLibOption -> m ForeignLibOption
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ForeignLibOption -> m ForeignLibOption
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ForeignLibOption -> m ForeignLibOption
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ForeignLibOption -> m ForeignLibOption
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ForeignLibOption -> m ForeignLibOption
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ForeignLibOption -> m ForeignLibOption
Data)

instance Pretty ForeignLibOption where
  pretty :: ForeignLibOption -> Doc
pretty ForeignLibOption
ForeignLibStandalone = String -> Doc
Disp.text String
"standalone"

instance Parsec ForeignLibOption where
  parsec :: forall (m :: * -> *). CabalParsing m => m ForeignLibOption
parsec = do
    String
name <- (Char -> Bool) -> m String
forall (m :: * -> *). CharParsing m => (Char -> Bool) -> m String
P.munch1 (\Char
c -> Char -> Bool
isAlphaNum Char
c Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'-')
    case String
name of
      String
"standalone" -> ForeignLibOption -> m ForeignLibOption
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return ForeignLibOption
ForeignLibStandalone
      String
_            -> String -> m ForeignLibOption
forall a. String -> m a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"unrecognized foreign-library option"

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