    {-|
      Copyright   :  (C) 2024, Martijn Bastiaan
      License     :  BSD2 (see the file LICENSE)
      Maintainer  :  QBayLogic B.V. <devops@qbaylogic.com>
    -}
    {-# LANGUAGE CPP #-}
    {-# LANGUAGE DeriveAnyClass #-}

    module Clash.Driver.Bool where

    import Control.DeepSeq (NFData)
    import Data.Hashable (Hashable)
    import GHC.Generics (Generic)

    #if MIN_VERSION_ghc(9,4,0)
    import qualified GHC.Data.Bool as Ghc
    #elif MIN_VERSION_ghc(9,0,0)
    import qualified GHC.Utils.Misc as Ghc
    #else
    import qualified Util as Ghc
    #endif

    data OverridingBool = Auto | Never | Always
      deriving (Int -> OverridingBool -> ShowS
    [OverridingBool] -> ShowS
    OverridingBool -> String
    (Int -> OverridingBool -> ShowS)
    -> (OverridingBool -> String)
    -> ([OverridingBool] -> ShowS)
    -> Show OverridingBool
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> OverridingBool -> ShowS
    showsPrec :: Int -> OverridingBool -> ShowS
    $cshow :: OverridingBool -> String
    show :: OverridingBool -> String
    $cshowList :: [OverridingBool] -> ShowS
    showList :: [OverridingBool] -> ShowS
    Show, ReadPrec [OverridingBool]
    ReadPrec OverridingBool
    Int -> ReadS OverridingBool
    ReadS [OverridingBool]
    (Int -> ReadS OverridingBool)
    -> ReadS [OverridingBool]
    -> ReadPrec OverridingBool
    -> ReadPrec [OverridingBool]
    -> Read OverridingBool
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS OverridingBool
    readsPrec :: Int -> ReadS OverridingBool
    $creadList :: ReadS [OverridingBool]
    readList :: ReadS [OverridingBool]
    $creadPrec :: ReadPrec OverridingBool
    readPrec :: ReadPrec OverridingBool
    $creadListPrec :: ReadPrec [OverridingBool]
    readListPrec :: ReadPrec [OverridingBool]
    Read, OverridingBool -> OverridingBool -> Bool
    (OverridingBool -> OverridingBool -> Bool)
    -> (OverridingBool -> OverridingBool -> Bool) -> Eq OverridingBool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: OverridingBool -> OverridingBool -> Bool
    == :: OverridingBool -> OverridingBool -> Bool
    $c/= :: OverridingBool -> OverridingBool -> Bool
    /= :: OverridingBool -> OverridingBool -> Bool
    Eq, Eq OverridingBool
    Eq OverridingBool =>
    (OverridingBool -> OverridingBool -> Ordering)
    -> (OverridingBool -> OverridingBool -> Bool)
    -> (OverridingBool -> OverridingBool -> Bool)
    -> (OverridingBool -> OverridingBool -> Bool)
    -> (OverridingBool -> OverridingBool -> Bool)
    -> (OverridingBool -> OverridingBool -> OverridingBool)
    -> (OverridingBool -> OverridingBool -> OverridingBool)
    -> Ord 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
    $ccompare :: OverridingBool -> OverridingBool -> Ordering
    compare :: OverridingBool -> OverridingBool -> Ordering
    $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
    >= :: OverridingBool -> OverridingBool -> Bool
    $cmax :: OverridingBool -> OverridingBool -> OverridingBool
    max :: OverridingBool -> OverridingBool -> OverridingBool
    $cmin :: OverridingBool -> OverridingBool -> OverridingBool
    min :: OverridingBool -> OverridingBool -> OverridingBool
    Ord, Int -> OverridingBool
    OverridingBool -> Int
    OverridingBool -> [OverridingBool]
    OverridingBool -> OverridingBool
    OverridingBool -> OverridingBool -> [OverridingBool]
    OverridingBool
    -> OverridingBool -> OverridingBool -> [OverridingBool]
    (OverridingBool -> OverridingBool)
    -> (OverridingBool -> OverridingBool)
    -> (Int -> OverridingBool)
    -> (OverridingBool -> Int)
    -> (OverridingBool -> [OverridingBool])
    -> (OverridingBool -> OverridingBool -> [OverridingBool])
    -> (OverridingBool -> OverridingBool -> [OverridingBool])
    -> (OverridingBool
        -> OverridingBool -> OverridingBool -> [OverridingBool])
    -> Enum 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
    $csucc :: OverridingBool -> OverridingBool
    succ :: OverridingBool -> OverridingBool
    $cpred :: OverridingBool -> OverridingBool
    pred :: OverridingBool -> OverridingBool
    $ctoEnum :: Int -> OverridingBool
    toEnum :: Int -> OverridingBool
    $cfromEnum :: OverridingBool -> Int
    fromEnum :: OverridingBool -> Int
    $cenumFrom :: OverridingBool -> [OverridingBool]
    enumFrom :: OverridingBool -> [OverridingBool]
    $cenumFromThen :: OverridingBool -> OverridingBool -> [OverridingBool]
    enumFromThen :: OverridingBool -> OverridingBool -> [OverridingBool]
    $cenumFromTo :: OverridingBool -> OverridingBool -> [OverridingBool]
    enumFromTo :: OverridingBool -> OverridingBool -> [OverridingBool]
    $cenumFromThenTo :: OverridingBool
    -> OverridingBool -> OverridingBool -> [OverridingBool]
    enumFromThenTo :: OverridingBool
    -> OverridingBool -> OverridingBool -> [OverridingBool]
    Enum, OverridingBool
    OverridingBool -> OverridingBool -> Bounded OverridingBool
    forall a. a -> a -> Bounded a
    $cminBound :: OverridingBool
    minBound :: OverridingBool
    $cmaxBound :: OverridingBool
    maxBound :: OverridingBool
    Bounded, Eq OverridingBool
    Eq OverridingBool =>
    (Int -> OverridingBool -> Int)
    -> (OverridingBool -> Int) -> Hashable OverridingBool
    Int -> OverridingBool -> Int
    OverridingBool -> Int
    forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
    $chashWithSalt :: Int -> OverridingBool -> Int
    hashWithSalt :: Int -> OverridingBool -> Int
    $chash :: OverridingBool -> Int
    hash :: OverridingBool -> Int
    Hashable, (forall x. OverridingBool -> Rep OverridingBool x)
    -> (forall x. Rep OverridingBool x -> OverridingBool)
    -> Generic OverridingBool
    forall x. Rep OverridingBool x -> OverridingBool
    forall x. OverridingBool -> Rep OverridingBool x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. OverridingBool -> Rep OverridingBool x
    from :: forall x. OverridingBool -> Rep OverridingBool x
    $cto :: forall x. Rep OverridingBool x -> OverridingBool
    to :: forall x. Rep OverridingBool x -> OverridingBool
    Generic, OverridingBool -> ()
    (OverridingBool -> ()) -> NFData OverridingBool
    forall a. (a -> ()) -> NFData a
    $crnf :: OverridingBool -> ()
    rnf :: OverridingBool -> ()
    NFData)

    toGhcOverridingBool :: OverridingBool -> Ghc.OverridingBool
    toGhcOverridingBool :: OverridingBool -> OverridingBool
    toGhcOverridingBool OverridingBool
    Auto = OverridingBool
    Ghc.Auto
    toGhcOverridingBool OverridingBool
    Never = OverridingBool
    Ghc.Never
    toGhcOverridingBool OverridingBool
    Always = OverridingBool
    Ghc.Always

    fromGhcOverridingBool :: Ghc.OverridingBool -> OverridingBool
    fromGhcOverridingBool :: OverridingBool -> OverridingBool
    fromGhcOverridingBool OverridingBool
    Ghc.Auto = OverridingBool
    Auto
    fromGhcOverridingBool OverridingBool
    Ghc.Never = OverridingBool
    Never
    fromGhcOverridingBool OverridingBool
    Ghc.Always = OverridingBool
    Always