module GHC.Data.Bool
  ( OverridingBool(..)
  , overrideWith
  )
where

import GHC.Prelude.Basic

data OverridingBool
  = Auto
  | Never
  | Always
  deriving
    ( Int -> OverridingBool -> ShowS
[OverridingBool] -> ShowS
OverridingBool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OverridingBool] -> ShowS
$cshowList :: [OverridingBool] -> ShowS
show :: OverridingBool -> String
$cshow :: OverridingBool -> String
showsPrec :: Int -> OverridingBool -> ShowS
$cshowsPrec :: Int -> OverridingBool -> ShowS
Show
    , ReadPrec [OverridingBool]
ReadPrec OverridingBool
Int -> ReadS OverridingBool
ReadS [OverridingBool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OverridingBool]
$creadListPrec :: ReadPrec [OverridingBool]
readPrec :: ReadPrec OverridingBool
$creadPrec :: ReadPrec OverridingBool
readList :: ReadS [OverridingBool]
$creadList :: ReadS [OverridingBool]
readsPrec :: Int -> ReadS OverridingBool
$creadsPrec :: Int -> ReadS OverridingBool
Read    -- ^ @since 9.4.1
    , OverridingBool -> OverridingBool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OverridingBool -> OverridingBool -> Bool
$c/= :: OverridingBool -> OverridingBool -> Bool
== :: OverridingBool -> OverridingBool -> Bool
$c== :: OverridingBool -> OverridingBool -> Bool
Eq      -- ^ @since 9.4.1
    , Eq OverridingBool
OverridingBool -> OverridingBool -> Bool
OverridingBool -> OverridingBool -> Ordering
OverridingBool -> OverridingBool -> OverridingBool
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 :: OverridingBool -> OverridingBool -> OverridingBool
$cmin :: OverridingBool -> OverridingBool -> OverridingBool
max :: OverridingBool -> OverridingBool -> OverridingBool
$cmax :: OverridingBool -> OverridingBool -> OverridingBool
>= :: OverridingBool -> OverridingBool -> Bool
$c>= :: OverridingBool -> OverridingBool -> Bool
> :: OverridingBool -> OverridingBool -> Bool
$c> :: OverridingBool -> OverridingBool -> Bool
<= :: OverridingBool -> OverridingBool -> Bool
$c<= :: OverridingBool -> OverridingBool -> Bool
< :: OverridingBool -> OverridingBool -> Bool
$c< :: OverridingBool -> OverridingBool -> Bool
compare :: OverridingBool -> OverridingBool -> Ordering
$ccompare :: OverridingBool -> OverridingBool -> Ordering
Ord     -- ^ @since 9.4.1
    , Int -> OverridingBool
OverridingBool -> Int
OverridingBool -> [OverridingBool]
OverridingBool -> OverridingBool
OverridingBool -> OverridingBool -> [OverridingBool]
OverridingBool
-> OverridingBool -> OverridingBool -> [OverridingBool]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: OverridingBool
-> OverridingBool -> OverridingBool -> [OverridingBool]
$cenumFromThenTo :: OverridingBool
-> OverridingBool -> OverridingBool -> [OverridingBool]
enumFromTo :: OverridingBool -> OverridingBool -> [OverridingBool]
$cenumFromTo :: OverridingBool -> OverridingBool -> [OverridingBool]
enumFromThen :: OverridingBool -> OverridingBool -> [OverridingBool]
$cenumFromThen :: OverridingBool -> OverridingBool -> [OverridingBool]
enumFrom :: OverridingBool -> [OverridingBool]
$cenumFrom :: OverridingBool -> [OverridingBool]
fromEnum :: OverridingBool -> Int
$cfromEnum :: OverridingBool -> Int
toEnum :: Int -> OverridingBool
$ctoEnum :: Int -> OverridingBool
pred :: OverridingBool -> OverridingBool
$cpred :: OverridingBool -> OverridingBool
succ :: OverridingBool -> OverridingBool
$csucc :: OverridingBool -> OverridingBool
Enum    -- ^ @since 9.4.1
    , OverridingBool
forall a. a -> a -> Bounded a
maxBound :: OverridingBool
$cmaxBound :: OverridingBool
minBound :: OverridingBool
$cminBound :: OverridingBool
Bounded -- ^ @since 9.4.1
    )

overrideWith :: Bool -> OverridingBool -> Bool
overrideWith :: Bool -> OverridingBool -> Bool
overrideWith Bool
b OverridingBool
Auto   = Bool
b
overrideWith Bool
_ OverridingBool
Never  = Bool
False
overrideWith Bool
_ OverridingBool
Always = Bool
True