{-# LANGUAGE UndecidableInstances #-}
module Shrun.Configuration.Data.CommonLogging.KeyHideSwitch
( KeyHideSwitch (..),
)
where
import Shrun.Configuration.Data.ConfigPhase (parseSwitch)
import Shrun.Configuration.Default (Default (def))
import Shrun.Prelude
newtype KeyHideSwitch = MkKeyHideSwitch Bool
deriving stock (KeyHideSwitch
KeyHideSwitch -> KeyHideSwitch -> Bounded KeyHideSwitch
forall a. a -> a -> Bounded a
$cminBound :: KeyHideSwitch
minBound :: KeyHideSwitch
$cmaxBound :: KeyHideSwitch
maxBound :: KeyHideSwitch
Bounded, KeyHideSwitch -> KeyHideSwitch -> Bool
(KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool) -> Eq KeyHideSwitch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: KeyHideSwitch -> KeyHideSwitch -> Bool
== :: KeyHideSwitch -> KeyHideSwitch -> Bool
$c/= :: KeyHideSwitch -> KeyHideSwitch -> Bool
/= :: KeyHideSwitch -> KeyHideSwitch -> Bool
Eq, Eq KeyHideSwitch
Eq KeyHideSwitch =>
(KeyHideSwitch -> KeyHideSwitch -> Ordering)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> Bool)
-> (KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch)
-> (KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch)
-> Ord KeyHideSwitch
KeyHideSwitch -> KeyHideSwitch -> Bool
KeyHideSwitch -> KeyHideSwitch -> Ordering
KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: KeyHideSwitch -> KeyHideSwitch -> Ordering
compare :: KeyHideSwitch -> KeyHideSwitch -> Ordering
$c< :: KeyHideSwitch -> KeyHideSwitch -> Bool
< :: KeyHideSwitch -> KeyHideSwitch -> Bool
$c<= :: KeyHideSwitch -> KeyHideSwitch -> Bool
<= :: KeyHideSwitch -> KeyHideSwitch -> Bool
$c> :: KeyHideSwitch -> KeyHideSwitch -> Bool
> :: KeyHideSwitch -> KeyHideSwitch -> Bool
$c>= :: KeyHideSwitch -> KeyHideSwitch -> Bool
>= :: KeyHideSwitch -> KeyHideSwitch -> Bool
$cmax :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
max :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
$cmin :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
min :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch
Ord, Int -> KeyHideSwitch -> ShowS
[KeyHideSwitch] -> ShowS
KeyHideSwitch -> String
(Int -> KeyHideSwitch -> ShowS)
-> (KeyHideSwitch -> String)
-> ([KeyHideSwitch] -> ShowS)
-> Show KeyHideSwitch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> KeyHideSwitch -> ShowS
showsPrec :: Int -> KeyHideSwitch -> ShowS
$cshow :: KeyHideSwitch -> String
show :: KeyHideSwitch -> String
$cshowList :: [KeyHideSwitch] -> ShowS
showList :: [KeyHideSwitch] -> ShowS
Show)
deriving newtype (Int -> KeyHideSwitch
KeyHideSwitch -> Int
KeyHideSwitch -> [KeyHideSwitch]
KeyHideSwitch -> KeyHideSwitch
KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
(KeyHideSwitch -> KeyHideSwitch)
-> (KeyHideSwitch -> KeyHideSwitch)
-> (Int -> KeyHideSwitch)
-> (KeyHideSwitch -> Int)
-> (KeyHideSwitch -> [KeyHideSwitch])
-> (KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch])
-> (KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch])
-> (KeyHideSwitch
-> KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch])
-> Enum KeyHideSwitch
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 :: KeyHideSwitch -> KeyHideSwitch
succ :: KeyHideSwitch -> KeyHideSwitch
$cpred :: KeyHideSwitch -> KeyHideSwitch
pred :: KeyHideSwitch -> KeyHideSwitch
$ctoEnum :: Int -> KeyHideSwitch
toEnum :: Int -> KeyHideSwitch
$cfromEnum :: KeyHideSwitch -> Int
fromEnum :: KeyHideSwitch -> Int
$cenumFrom :: KeyHideSwitch -> [KeyHideSwitch]
enumFrom :: KeyHideSwitch -> [KeyHideSwitch]
$cenumFromThen :: KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
enumFromThen :: KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
$cenumFromTo :: KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
enumFromTo :: KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
$cenumFromThenTo :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
enumFromThenTo :: KeyHideSwitch -> KeyHideSwitch -> KeyHideSwitch -> [KeyHideSwitch]
Enum)
deriving ((forall ann. KeyHideSwitch -> Doc ann)
-> (forall ann. [KeyHideSwitch] -> Doc ann) -> Pretty KeyHideSwitch
forall ann. [KeyHideSwitch] -> Doc ann
forall ann. KeyHideSwitch -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. KeyHideSwitch -> Doc ann
pretty :: forall ann. KeyHideSwitch -> Doc ann
$cprettyList :: forall ann. [KeyHideSwitch] -> Doc ann
prettyList :: forall ann. [KeyHideSwitch] -> Doc ann
Pretty) via PrettySwitch
instance DecodeTOML KeyHideSwitch where
tomlDecoder :: Decoder KeyHideSwitch
tomlDecoder = Bool -> KeyHideSwitch
MkKeyHideSwitch (Bool -> KeyHideSwitch) -> Decoder Bool -> Decoder KeyHideSwitch
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> (Decoder Text
forall a. DecodeTOML a => Decoder a
tomlDecoder Decoder Text -> (Text -> Decoder Bool) -> Decoder Bool
forall a b. Decoder a -> (a -> Decoder b) -> Decoder b
forall (m :: Type -> Type) a b. Monad m => m a -> (a -> m b) -> m b
>>= Text -> Decoder Bool
forall (m :: Type -> Type). MonadFail m => Text -> m Bool
parseSwitch)
instance Default KeyHideSwitch where
def :: KeyHideSwitch
def = Bool -> KeyHideSwitch
MkKeyHideSwitch Bool
False
instance
(k ~ An_Iso, a ~ Bool, b ~ Bool) =>
LabelOptic "unKeyHideSwitch" k KeyHideSwitch KeyHideSwitch a b
where
labelOptic :: Optic k NoIx KeyHideSwitch KeyHideSwitch a b
labelOptic = (KeyHideSwitch -> a)
-> (b -> KeyHideSwitch) -> Iso KeyHideSwitch KeyHideSwitch a b
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(MkKeyHideSwitch Bool
b) -> a
Bool
b) b -> KeyHideSwitch
Bool -> KeyHideSwitch
MkKeyHideSwitch
{-# INLINE labelOptic #-}