module Text.PrettyPrint.GenericPretty.Type
  ( PrettyLog (..),
    SecretVision (..),
  )
where

import Text.PrettyPrint.GenericPretty (Out (..))
import Universum

data PrettyLog a
  = PrettyLog a
  | SecretLog SecretVision a
  deriving stock (PrettyLog a -> PrettyLog a -> Bool
(PrettyLog a -> PrettyLog a -> Bool)
-> (PrettyLog a -> PrettyLog a -> Bool) -> Eq (PrettyLog a)
forall a. Eq a => PrettyLog a -> PrettyLog a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrettyLog a -> PrettyLog a -> Bool
$c/= :: forall a. Eq a => PrettyLog a -> PrettyLog a -> Bool
== :: PrettyLog a -> PrettyLog a -> Bool
$c== :: forall a. Eq a => PrettyLog a -> PrettyLog a -> Bool
Eq, Eq (PrettyLog a)
Eq (PrettyLog a)
-> (PrettyLog a -> PrettyLog a -> Ordering)
-> (PrettyLog a -> PrettyLog a -> Bool)
-> (PrettyLog a -> PrettyLog a -> Bool)
-> (PrettyLog a -> PrettyLog a -> Bool)
-> (PrettyLog a -> PrettyLog a -> Bool)
-> (PrettyLog a -> PrettyLog a -> PrettyLog a)
-> (PrettyLog a -> PrettyLog a -> PrettyLog a)
-> Ord (PrettyLog a)
PrettyLog a -> PrettyLog a -> Bool
PrettyLog a -> PrettyLog a -> Ordering
PrettyLog a -> PrettyLog a -> PrettyLog a
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
forall {a}. Ord a => Eq (PrettyLog a)
forall a. Ord a => PrettyLog a -> PrettyLog a -> Bool
forall a. Ord a => PrettyLog a -> PrettyLog a -> Ordering
forall a. Ord a => PrettyLog a -> PrettyLog a -> PrettyLog a
min :: PrettyLog a -> PrettyLog a -> PrettyLog a
$cmin :: forall a. Ord a => PrettyLog a -> PrettyLog a -> PrettyLog a
max :: PrettyLog a -> PrettyLog a -> PrettyLog a
$cmax :: forall a. Ord a => PrettyLog a -> PrettyLog a -> PrettyLog a
>= :: PrettyLog a -> PrettyLog a -> Bool
$c>= :: forall a. Ord a => PrettyLog a -> PrettyLog a -> Bool
> :: PrettyLog a -> PrettyLog a -> Bool
$c> :: forall a. Ord a => PrettyLog a -> PrettyLog a -> Bool
<= :: PrettyLog a -> PrettyLog a -> Bool
$c<= :: forall a. Ord a => PrettyLog a -> PrettyLog a -> Bool
< :: PrettyLog a -> PrettyLog a -> Bool
$c< :: forall a. Ord a => PrettyLog a -> PrettyLog a -> Bool
compare :: PrettyLog a -> PrettyLog a -> Ordering
$ccompare :: forall a. Ord a => PrettyLog a -> PrettyLog a -> Ordering
Ord)

data SecretVision
  = SecretVisible
  | SecretHidden
  deriving stock (SecretVision -> SecretVision -> Bool
(SecretVision -> SecretVision -> Bool)
-> (SecretVision -> SecretVision -> Bool) -> Eq SecretVision
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecretVision -> SecretVision -> Bool
$c/= :: SecretVision -> SecretVision -> Bool
== :: SecretVision -> SecretVision -> Bool
$c== :: SecretVision -> SecretVision -> Bool
Eq, Eq SecretVision
Eq SecretVision
-> (SecretVision -> SecretVision -> Ordering)
-> (SecretVision -> SecretVision -> Bool)
-> (SecretVision -> SecretVision -> Bool)
-> (SecretVision -> SecretVision -> Bool)
-> (SecretVision -> SecretVision -> Bool)
-> (SecretVision -> SecretVision -> SecretVision)
-> (SecretVision -> SecretVision -> SecretVision)
-> Ord SecretVision
SecretVision -> SecretVision -> Bool
SecretVision -> SecretVision -> Ordering
SecretVision -> SecretVision -> SecretVision
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
min :: SecretVision -> SecretVision -> SecretVision
$cmin :: SecretVision -> SecretVision -> SecretVision
max :: SecretVision -> SecretVision -> SecretVision
$cmax :: SecretVision -> SecretVision -> SecretVision
>= :: SecretVision -> SecretVision -> Bool
$c>= :: SecretVision -> SecretVision -> Bool
> :: SecretVision -> SecretVision -> Bool
$c> :: SecretVision -> SecretVision -> Bool
<= :: SecretVision -> SecretVision -> Bool
$c<= :: SecretVision -> SecretVision -> Bool
< :: SecretVision -> SecretVision -> Bool
$c< :: SecretVision -> SecretVision -> Bool
compare :: SecretVision -> SecretVision -> Ordering
$ccompare :: SecretVision -> SecretVision -> Ordering
Ord, Int -> SecretVision -> ShowS
[SecretVision] -> ShowS
SecretVision -> String
(Int -> SecretVision -> ShowS)
-> (SecretVision -> String)
-> ([SecretVision] -> ShowS)
-> Show SecretVision
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecretVision] -> ShowS
$cshowList :: [SecretVision] -> ShowS
show :: SecretVision -> String
$cshow :: SecretVision -> String
showsPrec :: Int -> SecretVision -> ShowS
$cshowsPrec :: Int -> SecretVision -> ShowS
Show, ReadPrec [SecretVision]
ReadPrec SecretVision
Int -> ReadS SecretVision
ReadS [SecretVision]
(Int -> ReadS SecretVision)
-> ReadS [SecretVision]
-> ReadPrec SecretVision
-> ReadPrec [SecretVision]
-> Read SecretVision
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecretVision]
$creadListPrec :: ReadPrec [SecretVision]
readPrec :: ReadPrec SecretVision
$creadPrec :: ReadPrec SecretVision
readList :: ReadS [SecretVision]
$creadList :: ReadS [SecretVision]
readsPrec :: Int -> ReadS SecretVision
$creadsPrec :: Int -> ReadS SecretVision
Read, (forall x. SecretVision -> Rep SecretVision x)
-> (forall x. Rep SecretVision x -> SecretVision)
-> Generic SecretVision
forall x. Rep SecretVision x -> SecretVision
forall x. SecretVision -> Rep SecretVision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SecretVision x -> SecretVision
$cfrom :: forall x. SecretVision -> Rep SecretVision x
Generic)

instance Out SecretVision

instance (Out a) => Out (PrettyLog a) where
  docPrec :: Int -> PrettyLog a -> Doc
docPrec Int
n = \case
    PrettyLog a
x -> Int -> a -> Doc
forall a. Out a => Int -> a -> Doc
docPrec Int
n a
x
    SecretLog SecretVision
SecretVisible a
x -> Int -> a -> Doc
forall a. Out a => Int -> a -> Doc
docPrec Int
n a
x
    SecretLog SecretVision
SecretHidden a
_ -> Doc
"SECRET"
  doc :: PrettyLog a -> Doc
doc = \case
    PrettyLog a
x -> a -> Doc
forall a. Out a => a -> Doc
doc a
x
    SecretLog SecretVision
SecretVisible a
x -> a -> Doc
forall a. Out a => a -> Doc
doc a
x
    SecretLog SecretVision
SecretHidden a
_ -> Doc
"SECRET"