{-# OPTIONS_GHC -fno-omit-interface-pragmas #-}
module PlutusTx.Bool (Bool(..), (&&), (||), not, otherwise) where

{-
We export off-chain Haskell's Bool type as on-chain Plutus's Bool type since they are the same.
-}

import Prelude (Bool (..), otherwise)

{- HLINT ignore -}

{-# INLINABLE (&&) #-}
-- | Logical AND
--
--   >>> True && False
--   False
--
infixr 3 &&
(&&) :: Bool -> Bool -> Bool
&& :: Bool -> Bool -> Bool
(&&) Bool
l Bool
r = if Bool
l then Bool
r else Bool
False

{-# INLINABLE (||) #-}
-- | Logical OR
--
--   >>> True || False
--   True
--
infixr 2 ||
(||) :: Bool -> Bool -> Bool
|| :: Bool -> Bool -> Bool
(||) Bool
l Bool
r = if Bool
l then Bool
True else Bool
r

{-# INLINABLE not #-}
-- | Logical negation
--
--   >>> not True
--   False
--
not :: Bool -> Bool
not :: Bool -> Bool
not Bool
a = if Bool
a then Bool
False else Bool
True