{-# LANGUAGE DeriveGeneric #-} module Distribution.Client.Types.OverwritePolicy where import Distribution.Client.Compat.Prelude import Prelude () import qualified Distribution.Compat.CharParsing as P import qualified Text.PrettyPrint as PP data OverwritePolicy = NeverOverwrite | AlwaysOverwrite | PromptOverwrite deriving (Int -> OverwritePolicy -> ShowS [OverwritePolicy] -> ShowS OverwritePolicy -> String (Int -> OverwritePolicy -> ShowS) -> (OverwritePolicy -> String) -> ([OverwritePolicy] -> ShowS) -> Show OverwritePolicy forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> OverwritePolicy -> ShowS showsPrec :: Int -> OverwritePolicy -> ShowS $cshow :: OverwritePolicy -> String show :: OverwritePolicy -> String $cshowList :: [OverwritePolicy] -> ShowS showList :: [OverwritePolicy] -> ShowS Show, OverwritePolicy -> OverwritePolicy -> Bool (OverwritePolicy -> OverwritePolicy -> Bool) -> (OverwritePolicy -> OverwritePolicy -> Bool) -> Eq OverwritePolicy forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: OverwritePolicy -> OverwritePolicy -> Bool == :: OverwritePolicy -> OverwritePolicy -> Bool $c/= :: OverwritePolicy -> OverwritePolicy -> Bool /= :: OverwritePolicy -> OverwritePolicy -> Bool Eq, (forall x. OverwritePolicy -> Rep OverwritePolicy x) -> (forall x. Rep OverwritePolicy x -> OverwritePolicy) -> Generic OverwritePolicy forall x. Rep OverwritePolicy x -> OverwritePolicy forall x. OverwritePolicy -> Rep OverwritePolicy x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cfrom :: forall x. OverwritePolicy -> Rep OverwritePolicy x from :: forall x. OverwritePolicy -> Rep OverwritePolicy x $cto :: forall x. Rep OverwritePolicy x -> OverwritePolicy to :: forall x. Rep OverwritePolicy x -> OverwritePolicy Generic, OverwritePolicy OverwritePolicy -> OverwritePolicy -> Bounded OverwritePolicy forall a. a -> a -> Bounded a $cminBound :: OverwritePolicy minBound :: OverwritePolicy $cmaxBound :: OverwritePolicy maxBound :: OverwritePolicy Bounded, Int -> OverwritePolicy OverwritePolicy -> Int OverwritePolicy -> [OverwritePolicy] OverwritePolicy -> OverwritePolicy OverwritePolicy -> OverwritePolicy -> [OverwritePolicy] OverwritePolicy -> OverwritePolicy -> OverwritePolicy -> [OverwritePolicy] (OverwritePolicy -> OverwritePolicy) -> (OverwritePolicy -> OverwritePolicy) -> (Int -> OverwritePolicy) -> (OverwritePolicy -> Int) -> (OverwritePolicy -> [OverwritePolicy]) -> (OverwritePolicy -> OverwritePolicy -> [OverwritePolicy]) -> (OverwritePolicy -> OverwritePolicy -> [OverwritePolicy]) -> (OverwritePolicy -> OverwritePolicy -> OverwritePolicy -> [OverwritePolicy]) -> Enum OverwritePolicy forall a. (a -> a) -> (a -> a) -> (Int -> a) -> (a -> Int) -> (a -> [a]) -> (a -> a -> [a]) -> (a -> a -> [a]) -> (a -> a -> a -> [a]) -> Enum a $csucc :: OverwritePolicy -> OverwritePolicy succ :: OverwritePolicy -> OverwritePolicy $cpred :: OverwritePolicy -> OverwritePolicy pred :: OverwritePolicy -> OverwritePolicy $ctoEnum :: Int -> OverwritePolicy toEnum :: Int -> OverwritePolicy $cfromEnum :: OverwritePolicy -> Int fromEnum :: OverwritePolicy -> Int $cenumFrom :: OverwritePolicy -> [OverwritePolicy] enumFrom :: OverwritePolicy -> [OverwritePolicy] $cenumFromThen :: OverwritePolicy -> OverwritePolicy -> [OverwritePolicy] enumFromThen :: OverwritePolicy -> OverwritePolicy -> [OverwritePolicy] $cenumFromTo :: OverwritePolicy -> OverwritePolicy -> [OverwritePolicy] enumFromTo :: OverwritePolicy -> OverwritePolicy -> [OverwritePolicy] $cenumFromThenTo :: OverwritePolicy -> OverwritePolicy -> OverwritePolicy -> [OverwritePolicy] enumFromThenTo :: OverwritePolicy -> OverwritePolicy -> OverwritePolicy -> [OverwritePolicy] Enum) instance Binary OverwritePolicy instance Structured OverwritePolicy instance Parsec OverwritePolicy where parsec :: forall (m :: * -> *). CabalParsing m => m OverwritePolicy 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 "always" -> OverwritePolicy -> m OverwritePolicy forall a. a -> m a forall (f :: * -> *) a. Applicative f => a -> f a pure OverwritePolicy AlwaysOverwrite String "never" -> OverwritePolicy -> m OverwritePolicy forall a. a -> m a forall (f :: * -> *) a. Applicative f => a -> f a pure OverwritePolicy NeverOverwrite String "prompt" -> OverwritePolicy -> m OverwritePolicy forall a. a -> m a forall (f :: * -> *) a. Applicative f => a -> f a pure OverwritePolicy PromptOverwrite String _ -> String -> m OverwritePolicy forall a. String -> m a forall (m :: * -> *) a. Parsing m => String -> m a P.unexpected (String -> m OverwritePolicy) -> String -> m OverwritePolicy forall a b. (a -> b) -> a -> b $ String "OverwritePolicy: " String -> ShowS forall a. [a] -> [a] -> [a] ++ String name instance Pretty OverwritePolicy where pretty :: OverwritePolicy -> Doc pretty OverwritePolicy NeverOverwrite = String -> Doc PP.text String "never" pretty OverwritePolicy AlwaysOverwrite = String -> Doc PP.text String "always" pretty OverwritePolicy PromptOverwrite = String -> Doc PP.text String "prompt"