{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE Trustworthy #-}
module Data.Bits (
Bits(
(.&.), (.|.), xor,
complement,
shift,
rotate,
zeroBits,
bit,
setBit,
clearBit,
complementBit,
testBit,
bitSizeMaybe,
bitSize,
isSigned,
shiftL, shiftR,
unsafeShiftL, unsafeShiftR,
rotateL, rotateR,
popCount
),
FiniteBits(
finiteBitSize,
countLeadingZeros,
countTrailingZeros
),
bitDefault,
testBitDefault,
popCountDefault,
toIntegralSized,
oneBits,
And(..), Ior(..), Xor(..), Iff(..)
) where
import GHC.Base
import GHC.Bits
import GHC.Enum
import GHC.Read
import GHC.Show
oneBits :: (FiniteBits a) => a
oneBits :: forall a. FiniteBits a => a
oneBits = a -> a
forall a. Bits a => a -> a
complement a
forall a. Bits a => a
zeroBits
{-# INLINE oneBits #-}
newtype And a = And { forall a. And a -> a
getAnd :: a }
deriving newtype (
And a
And a -> And a -> Bounded (And a)
forall a. a -> a -> Bounded a
forall a. Bounded a => And a
maxBound :: And a
$cmaxBound :: forall a. Bounded a => And a
minBound :: And a
$cminBound :: forall a. Bounded a => And a
Bounded,
Int -> And a
And a -> Int
And a -> [And a]
And a -> And a
And a -> And a -> [And a]
And a -> And a -> And a -> [And a]
(And a -> And a)
-> (And a -> And a)
-> (Int -> And a)
-> (And a -> Int)
-> (And a -> [And a])
-> (And a -> And a -> [And a])
-> (And a -> And a -> [And a])
-> (And a -> And a -> And a -> [And a])
-> Enum (And a)
forall a. Enum a => Int -> And a
forall a. Enum a => And a -> Int
forall a. Enum a => And a -> [And a]
forall a. Enum a => And a -> And a
forall a. Enum a => And a -> And a -> [And a]
forall a. Enum a => And a -> And a -> And a -> [And a]
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 :: And a -> And a -> And a -> [And a]
$cenumFromThenTo :: forall a. Enum a => And a -> And a -> And a -> [And a]
enumFromTo :: And a -> And a -> [And a]
$cenumFromTo :: forall a. Enum a => And a -> And a -> [And a]
enumFromThen :: And a -> And a -> [And a]
$cenumFromThen :: forall a. Enum a => And a -> And a -> [And a]
enumFrom :: And a -> [And a]
$cenumFrom :: forall a. Enum a => And a -> [And a]
fromEnum :: And a -> Int
$cfromEnum :: forall a. Enum a => And a -> Int
toEnum :: Int -> And a
$ctoEnum :: forall a. Enum a => Int -> And a
pred :: And a -> And a
$cpred :: forall a. Enum a => And a -> And a
succ :: And a -> And a
$csucc :: forall a. Enum a => And a -> And a
Enum,
Eq (And a)
And a
Eq (And a)
-> (And a -> And a -> And a)
-> (And a -> And a -> And a)
-> (And a -> And a -> And a)
-> (And a -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int -> And a)
-> And a
-> (Int -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int -> Bool)
-> (And a -> Maybe Int)
-> (And a -> Int)
-> (And a -> Bool)
-> (And a -> Int -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int -> And a)
-> (And a -> Int)
-> Bits (And a)
Int -> And a
And a -> Bool
And a -> Int
And a -> Maybe Int
And a -> And a
And a -> Int -> Bool
And a -> Int -> And a
And a -> And a -> And a
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
forall {a}. Bits a => Eq (And a)
forall a. Bits a => And a
forall a. Bits a => Int -> And a
forall a. Bits a => And a -> Bool
forall a. Bits a => And a -> Int
forall a. Bits a => And a -> Maybe Int
forall a. Bits a => And a -> And a
forall a. Bits a => And a -> Int -> Bool
forall a. Bits a => And a -> Int -> And a
forall a. Bits a => And a -> And a -> And a
popCount :: And a -> Int
$cpopCount :: forall a. Bits a => And a -> Int
rotateR :: And a -> Int -> And a
$crotateR :: forall a. Bits a => And a -> Int -> And a
rotateL :: And a -> Int -> And a
$crotateL :: forall a. Bits a => And a -> Int -> And a
unsafeShiftR :: And a -> Int -> And a
$cunsafeShiftR :: forall a. Bits a => And a -> Int -> And a
shiftR :: And a -> Int -> And a
$cshiftR :: forall a. Bits a => And a -> Int -> And a
unsafeShiftL :: And a -> Int -> And a
$cunsafeShiftL :: forall a. Bits a => And a -> Int -> And a
shiftL :: And a -> Int -> And a
$cshiftL :: forall a. Bits a => And a -> Int -> And a
isSigned :: And a -> Bool
$cisSigned :: forall a. Bits a => And a -> Bool
bitSize :: And a -> Int
$cbitSize :: forall a. Bits a => And a -> Int
bitSizeMaybe :: And a -> Maybe Int
$cbitSizeMaybe :: forall a. Bits a => And a -> Maybe Int
testBit :: And a -> Int -> Bool
$ctestBit :: forall a. Bits a => And a -> Int -> Bool
complementBit :: And a -> Int -> And a
$ccomplementBit :: forall a. Bits a => And a -> Int -> And a
clearBit :: And a -> Int -> And a
$cclearBit :: forall a. Bits a => And a -> Int -> And a
setBit :: And a -> Int -> And a
$csetBit :: forall a. Bits a => And a -> Int -> And a
bit :: Int -> And a
$cbit :: forall a. Bits a => Int -> And a
zeroBits :: And a
$czeroBits :: forall a. Bits a => And a
rotate :: And a -> Int -> And a
$crotate :: forall a. Bits a => And a -> Int -> And a
shift :: And a -> Int -> And a
$cshift :: forall a. Bits a => And a -> Int -> And a
complement :: And a -> And a
$ccomplement :: forall a. Bits a => And a -> And a
xor :: And a -> And a -> And a
$cxor :: forall a. Bits a => And a -> And a -> And a
.|. :: And a -> And a -> And a
$c.|. :: forall a. Bits a => And a -> And a -> And a
.&. :: And a -> And a -> And a
$c.&. :: forall a. Bits a => And a -> And a -> And a
Bits,
Bits (And a)
Bits (And a)
-> (And a -> Int)
-> (And a -> Int)
-> (And a -> Int)
-> FiniteBits (And a)
And a -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
forall {a}. FiniteBits a => Bits (And a)
forall a. FiniteBits a => And a -> Int
countTrailingZeros :: And a -> Int
$ccountTrailingZeros :: forall a. FiniteBits a => And a -> Int
countLeadingZeros :: And a -> Int
$ccountLeadingZeros :: forall a. FiniteBits a => And a -> Int
finiteBitSize :: And a -> Int
$cfiniteBitSize :: forall a. FiniteBits a => And a -> Int
FiniteBits,
And a -> And a -> Bool
(And a -> And a -> Bool) -> (And a -> And a -> Bool) -> Eq (And a)
forall a. Eq a => And a -> And a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: And a -> And a -> Bool
$c/= :: forall a. Eq a => And a -> And a -> Bool
== :: And a -> And a -> Bool
$c== :: forall a. Eq a => And a -> And a -> Bool
Eq
)
deriving stock (
Int -> And a -> ShowS
[And a] -> ShowS
And a -> String
(Int -> And a -> ShowS)
-> (And a -> String) -> ([And a] -> ShowS) -> Show (And a)
forall a. Show a => Int -> And a -> ShowS
forall a. Show a => [And a] -> ShowS
forall a. Show a => And a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [And a] -> ShowS
$cshowList :: forall a. Show a => [And a] -> ShowS
show :: And a -> String
$cshow :: forall a. Show a => And a -> String
showsPrec :: Int -> And a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> And a -> ShowS
Show,
ReadPrec [And a]
ReadPrec (And a)
Int -> ReadS (And a)
ReadS [And a]
(Int -> ReadS (And a))
-> ReadS [And a]
-> ReadPrec (And a)
-> ReadPrec [And a]
-> Read (And a)
forall a. Read a => ReadPrec [And a]
forall a. Read a => ReadPrec (And a)
forall a. Read a => Int -> ReadS (And a)
forall a. Read a => ReadS [And a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [And a]
$creadListPrec :: forall a. Read a => ReadPrec [And a]
readPrec :: ReadPrec (And a)
$creadPrec :: forall a. Read a => ReadPrec (And a)
readList :: ReadS [And a]
$creadList :: forall a. Read a => ReadS [And a]
readsPrec :: Int -> ReadS (And a)
$creadsPrec :: forall a. Read a => Int -> ReadS (And a)
Read
)
instance (Bits a) => Semigroup (And a) where
And a
x <> :: And a -> And a -> And a
<> And a
y = a -> And a
forall a. a -> And a
And (a
x a -> a -> a
forall a. Bits a => a -> a -> a
.&. a
y)
instance (FiniteBits a) => Monoid (And a) where
mempty :: And a
mempty = a -> And a
forall a. a -> And a
And a
forall a. FiniteBits a => a
oneBits
newtype Ior a = Ior { forall a. Ior a -> a
getIor :: a }
deriving newtype (
Ior a
Ior a -> Ior a -> Bounded (Ior a)
forall a. a -> a -> Bounded a
forall a. Bounded a => Ior a
maxBound :: Ior a
$cmaxBound :: forall a. Bounded a => Ior a
minBound :: Ior a
$cminBound :: forall a. Bounded a => Ior a
Bounded,
Int -> Ior a
Ior a -> Int
Ior a -> [Ior a]
Ior a -> Ior a
Ior a -> Ior a -> [Ior a]
Ior a -> Ior a -> Ior a -> [Ior a]
(Ior a -> Ior a)
-> (Ior a -> Ior a)
-> (Int -> Ior a)
-> (Ior a -> Int)
-> (Ior a -> [Ior a])
-> (Ior a -> Ior a -> [Ior a])
-> (Ior a -> Ior a -> [Ior a])
-> (Ior a -> Ior a -> Ior a -> [Ior a])
-> Enum (Ior a)
forall a. Enum a => Int -> Ior a
forall a. Enum a => Ior a -> Int
forall a. Enum a => Ior a -> [Ior a]
forall a. Enum a => Ior a -> Ior a
forall a. Enum a => Ior a -> Ior a -> [Ior a]
forall a. Enum a => Ior a -> Ior a -> Ior a -> [Ior a]
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 :: Ior a -> Ior a -> Ior a -> [Ior a]
$cenumFromThenTo :: forall a. Enum a => Ior a -> Ior a -> Ior a -> [Ior a]
enumFromTo :: Ior a -> Ior a -> [Ior a]
$cenumFromTo :: forall a. Enum a => Ior a -> Ior a -> [Ior a]
enumFromThen :: Ior a -> Ior a -> [Ior a]
$cenumFromThen :: forall a. Enum a => Ior a -> Ior a -> [Ior a]
enumFrom :: Ior a -> [Ior a]
$cenumFrom :: forall a. Enum a => Ior a -> [Ior a]
fromEnum :: Ior a -> Int
$cfromEnum :: forall a. Enum a => Ior a -> Int
toEnum :: Int -> Ior a
$ctoEnum :: forall a. Enum a => Int -> Ior a
pred :: Ior a -> Ior a
$cpred :: forall a. Enum a => Ior a -> Ior a
succ :: Ior a -> Ior a
$csucc :: forall a. Enum a => Ior a -> Ior a
Enum,
Eq (Ior a)
Ior a
Eq (Ior a)
-> (Ior a -> Ior a -> Ior a)
-> (Ior a -> Ior a -> Ior a)
-> (Ior a -> Ior a -> Ior a)
-> (Ior a -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> Ior a
-> (Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Bool)
-> (Ior a -> Maybe Int)
-> (Ior a -> Int)
-> (Ior a -> Bool)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int -> Ior a)
-> (Ior a -> Int)
-> Bits (Ior a)
Int -> Ior a
Ior a -> Bool
Ior a -> Int
Ior a -> Maybe Int
Ior a -> Ior a
Ior a -> Int -> Bool
Ior a -> Int -> Ior a
Ior a -> Ior a -> Ior a
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
forall {a}. Bits a => Eq (Ior a)
forall a. Bits a => Ior a
forall a. Bits a => Int -> Ior a
forall a. Bits a => Ior a -> Bool
forall a. Bits a => Ior a -> Int
forall a. Bits a => Ior a -> Maybe Int
forall a. Bits a => Ior a -> Ior a
forall a. Bits a => Ior a -> Int -> Bool
forall a. Bits a => Ior a -> Int -> Ior a
forall a. Bits a => Ior a -> Ior a -> Ior a
popCount :: Ior a -> Int
$cpopCount :: forall a. Bits a => Ior a -> Int
rotateR :: Ior a -> Int -> Ior a
$crotateR :: forall a. Bits a => Ior a -> Int -> Ior a
rotateL :: Ior a -> Int -> Ior a
$crotateL :: forall a. Bits a => Ior a -> Int -> Ior a
unsafeShiftR :: Ior a -> Int -> Ior a
$cunsafeShiftR :: forall a. Bits a => Ior a -> Int -> Ior a
shiftR :: Ior a -> Int -> Ior a
$cshiftR :: forall a. Bits a => Ior a -> Int -> Ior a
unsafeShiftL :: Ior a -> Int -> Ior a
$cunsafeShiftL :: forall a. Bits a => Ior a -> Int -> Ior a
shiftL :: Ior a -> Int -> Ior a
$cshiftL :: forall a. Bits a => Ior a -> Int -> Ior a
isSigned :: Ior a -> Bool
$cisSigned :: forall a. Bits a => Ior a -> Bool
bitSize :: Ior a -> Int
$cbitSize :: forall a. Bits a => Ior a -> Int
bitSizeMaybe :: Ior a -> Maybe Int
$cbitSizeMaybe :: forall a. Bits a => Ior a -> Maybe Int
testBit :: Ior a -> Int -> Bool
$ctestBit :: forall a. Bits a => Ior a -> Int -> Bool
complementBit :: Ior a -> Int -> Ior a
$ccomplementBit :: forall a. Bits a => Ior a -> Int -> Ior a
clearBit :: Ior a -> Int -> Ior a
$cclearBit :: forall a. Bits a => Ior a -> Int -> Ior a
setBit :: Ior a -> Int -> Ior a
$csetBit :: forall a. Bits a => Ior a -> Int -> Ior a
bit :: Int -> Ior a
$cbit :: forall a. Bits a => Int -> Ior a
zeroBits :: Ior a
$czeroBits :: forall a. Bits a => Ior a
rotate :: Ior a -> Int -> Ior a
$crotate :: forall a. Bits a => Ior a -> Int -> Ior a
shift :: Ior a -> Int -> Ior a
$cshift :: forall a. Bits a => Ior a -> Int -> Ior a
complement :: Ior a -> Ior a
$ccomplement :: forall a. Bits a => Ior a -> Ior a
xor :: Ior a -> Ior a -> Ior a
$cxor :: forall a. Bits a => Ior a -> Ior a -> Ior a
.|. :: Ior a -> Ior a -> Ior a
$c.|. :: forall a. Bits a => Ior a -> Ior a -> Ior a
.&. :: Ior a -> Ior a -> Ior a
$c.&. :: forall a. Bits a => Ior a -> Ior a -> Ior a
Bits,
Bits (Ior a)
Bits (Ior a)
-> (Ior a -> Int)
-> (Ior a -> Int)
-> (Ior a -> Int)
-> FiniteBits (Ior a)
Ior a -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
forall {a}. FiniteBits a => Bits (Ior a)
forall a. FiniteBits a => Ior a -> Int
countTrailingZeros :: Ior a -> Int
$ccountTrailingZeros :: forall a. FiniteBits a => Ior a -> Int
countLeadingZeros :: Ior a -> Int
$ccountLeadingZeros :: forall a. FiniteBits a => Ior a -> Int
finiteBitSize :: Ior a -> Int
$cfiniteBitSize :: forall a. FiniteBits a => Ior a -> Int
FiniteBits,
Ior a -> Ior a -> Bool
(Ior a -> Ior a -> Bool) -> (Ior a -> Ior a -> Bool) -> Eq (Ior a)
forall a. Eq a => Ior a -> Ior a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ior a -> Ior a -> Bool
$c/= :: forall a. Eq a => Ior a -> Ior a -> Bool
== :: Ior a -> Ior a -> Bool
$c== :: forall a. Eq a => Ior a -> Ior a -> Bool
Eq
)
deriving stock (
Int -> Ior a -> ShowS
[Ior a] -> ShowS
Ior a -> String
(Int -> Ior a -> ShowS)
-> (Ior a -> String) -> ([Ior a] -> ShowS) -> Show (Ior a)
forall a. Show a => Int -> Ior a -> ShowS
forall a. Show a => [Ior a] -> ShowS
forall a. Show a => Ior a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ior a] -> ShowS
$cshowList :: forall a. Show a => [Ior a] -> ShowS
show :: Ior a -> String
$cshow :: forall a. Show a => Ior a -> String
showsPrec :: Int -> Ior a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Ior a -> ShowS
Show,
ReadPrec [Ior a]
ReadPrec (Ior a)
Int -> ReadS (Ior a)
ReadS [Ior a]
(Int -> ReadS (Ior a))
-> ReadS [Ior a]
-> ReadPrec (Ior a)
-> ReadPrec [Ior a]
-> Read (Ior a)
forall a. Read a => ReadPrec [Ior a]
forall a. Read a => ReadPrec (Ior a)
forall a. Read a => Int -> ReadS (Ior a)
forall a. Read a => ReadS [Ior a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ior a]
$creadListPrec :: forall a. Read a => ReadPrec [Ior a]
readPrec :: ReadPrec (Ior a)
$creadPrec :: forall a. Read a => ReadPrec (Ior a)
readList :: ReadS [Ior a]
$creadList :: forall a. Read a => ReadS [Ior a]
readsPrec :: Int -> ReadS (Ior a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Ior a)
Read
)
instance (Bits a) => Semigroup (Ior a) where
Ior a
x <> :: Ior a -> Ior a -> Ior a
<> Ior a
y = a -> Ior a
forall a. a -> Ior a
Ior (a
x a -> a -> a
forall a. Bits a => a -> a -> a
.|. a
y)
instance (Bits a) => Monoid (Ior a) where
mempty :: Ior a
mempty = a -> Ior a
forall a. a -> Ior a
Ior a
forall a. Bits a => a
zeroBits
newtype Xor a = Xor { forall a. Xor a -> a
getXor :: a }
deriving newtype (
Xor a
Xor a -> Xor a -> Bounded (Xor a)
forall a. a -> a -> Bounded a
forall a. Bounded a => Xor a
maxBound :: Xor a
$cmaxBound :: forall a. Bounded a => Xor a
minBound :: Xor a
$cminBound :: forall a. Bounded a => Xor a
Bounded,
Int -> Xor a
Xor a -> Int
Xor a -> [Xor a]
Xor a -> Xor a
Xor a -> Xor a -> [Xor a]
Xor a -> Xor a -> Xor a -> [Xor a]
(Xor a -> Xor a)
-> (Xor a -> Xor a)
-> (Int -> Xor a)
-> (Xor a -> Int)
-> (Xor a -> [Xor a])
-> (Xor a -> Xor a -> [Xor a])
-> (Xor a -> Xor a -> [Xor a])
-> (Xor a -> Xor a -> Xor a -> [Xor a])
-> Enum (Xor a)
forall a. Enum a => Int -> Xor a
forall a. Enum a => Xor a -> Int
forall a. Enum a => Xor a -> [Xor a]
forall a. Enum a => Xor a -> Xor a
forall a. Enum a => Xor a -> Xor a -> [Xor a]
forall a. Enum a => Xor a -> Xor a -> Xor a -> [Xor a]
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 :: Xor a -> Xor a -> Xor a -> [Xor a]
$cenumFromThenTo :: forall a. Enum a => Xor a -> Xor a -> Xor a -> [Xor a]
enumFromTo :: Xor a -> Xor a -> [Xor a]
$cenumFromTo :: forall a. Enum a => Xor a -> Xor a -> [Xor a]
enumFromThen :: Xor a -> Xor a -> [Xor a]
$cenumFromThen :: forall a. Enum a => Xor a -> Xor a -> [Xor a]
enumFrom :: Xor a -> [Xor a]
$cenumFrom :: forall a. Enum a => Xor a -> [Xor a]
fromEnum :: Xor a -> Int
$cfromEnum :: forall a. Enum a => Xor a -> Int
toEnum :: Int -> Xor a
$ctoEnum :: forall a. Enum a => Int -> Xor a
pred :: Xor a -> Xor a
$cpred :: forall a. Enum a => Xor a -> Xor a
succ :: Xor a -> Xor a
$csucc :: forall a. Enum a => Xor a -> Xor a
Enum,
Eq (Xor a)
Xor a
Eq (Xor a)
-> (Xor a -> Xor a -> Xor a)
-> (Xor a -> Xor a -> Xor a)
-> (Xor a -> Xor a -> Xor a)
-> (Xor a -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> Xor a
-> (Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Bool)
-> (Xor a -> Maybe Int)
-> (Xor a -> Int)
-> (Xor a -> Bool)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int -> Xor a)
-> (Xor a -> Int)
-> Bits (Xor a)
Int -> Xor a
Xor a -> Bool
Xor a -> Int
Xor a -> Maybe Int
Xor a -> Xor a
Xor a -> Int -> Bool
Xor a -> Int -> Xor a
Xor a -> Xor a -> Xor a
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
forall {a}. Bits a => Eq (Xor a)
forall a. Bits a => Xor a
forall a. Bits a => Int -> Xor a
forall a. Bits a => Xor a -> Bool
forall a. Bits a => Xor a -> Int
forall a. Bits a => Xor a -> Maybe Int
forall a. Bits a => Xor a -> Xor a
forall a. Bits a => Xor a -> Int -> Bool
forall a. Bits a => Xor a -> Int -> Xor a
forall a. Bits a => Xor a -> Xor a -> Xor a
popCount :: Xor a -> Int
$cpopCount :: forall a. Bits a => Xor a -> Int
rotateR :: Xor a -> Int -> Xor a
$crotateR :: forall a. Bits a => Xor a -> Int -> Xor a
rotateL :: Xor a -> Int -> Xor a
$crotateL :: forall a. Bits a => Xor a -> Int -> Xor a
unsafeShiftR :: Xor a -> Int -> Xor a
$cunsafeShiftR :: forall a. Bits a => Xor a -> Int -> Xor a
shiftR :: Xor a -> Int -> Xor a
$cshiftR :: forall a. Bits a => Xor a -> Int -> Xor a
unsafeShiftL :: Xor a -> Int -> Xor a
$cunsafeShiftL :: forall a. Bits a => Xor a -> Int -> Xor a
shiftL :: Xor a -> Int -> Xor a
$cshiftL :: forall a. Bits a => Xor a -> Int -> Xor a
isSigned :: Xor a -> Bool
$cisSigned :: forall a. Bits a => Xor a -> Bool
bitSize :: Xor a -> Int
$cbitSize :: forall a. Bits a => Xor a -> Int
bitSizeMaybe :: Xor a -> Maybe Int
$cbitSizeMaybe :: forall a. Bits a => Xor a -> Maybe Int
testBit :: Xor a -> Int -> Bool
$ctestBit :: forall a. Bits a => Xor a -> Int -> Bool
complementBit :: Xor a -> Int -> Xor a
$ccomplementBit :: forall a. Bits a => Xor a -> Int -> Xor a
clearBit :: Xor a -> Int -> Xor a
$cclearBit :: forall a. Bits a => Xor a -> Int -> Xor a
setBit :: Xor a -> Int -> Xor a
$csetBit :: forall a. Bits a => Xor a -> Int -> Xor a
bit :: Int -> Xor a
$cbit :: forall a. Bits a => Int -> Xor a
zeroBits :: Xor a
$czeroBits :: forall a. Bits a => Xor a
rotate :: Xor a -> Int -> Xor a
$crotate :: forall a. Bits a => Xor a -> Int -> Xor a
shift :: Xor a -> Int -> Xor a
$cshift :: forall a. Bits a => Xor a -> Int -> Xor a
complement :: Xor a -> Xor a
$ccomplement :: forall a. Bits a => Xor a -> Xor a
xor :: Xor a -> Xor a -> Xor a
$cxor :: forall a. Bits a => Xor a -> Xor a -> Xor a
.|. :: Xor a -> Xor a -> Xor a
$c.|. :: forall a. Bits a => Xor a -> Xor a -> Xor a
.&. :: Xor a -> Xor a -> Xor a
$c.&. :: forall a. Bits a => Xor a -> Xor a -> Xor a
Bits,
Bits (Xor a)
Bits (Xor a)
-> (Xor a -> Int)
-> (Xor a -> Int)
-> (Xor a -> Int)
-> FiniteBits (Xor a)
Xor a -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
forall {a}. FiniteBits a => Bits (Xor a)
forall a. FiniteBits a => Xor a -> Int
countTrailingZeros :: Xor a -> Int
$ccountTrailingZeros :: forall a. FiniteBits a => Xor a -> Int
countLeadingZeros :: Xor a -> Int
$ccountLeadingZeros :: forall a. FiniteBits a => Xor a -> Int
finiteBitSize :: Xor a -> Int
$cfiniteBitSize :: forall a. FiniteBits a => Xor a -> Int
FiniteBits,
Xor a -> Xor a -> Bool
(Xor a -> Xor a -> Bool) -> (Xor a -> Xor a -> Bool) -> Eq (Xor a)
forall a. Eq a => Xor a -> Xor a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Xor a -> Xor a -> Bool
$c/= :: forall a. Eq a => Xor a -> Xor a -> Bool
== :: Xor a -> Xor a -> Bool
$c== :: forall a. Eq a => Xor a -> Xor a -> Bool
Eq
)
deriving stock (
Int -> Xor a -> ShowS
[Xor a] -> ShowS
Xor a -> String
(Int -> Xor a -> ShowS)
-> (Xor a -> String) -> ([Xor a] -> ShowS) -> Show (Xor a)
forall a. Show a => Int -> Xor a -> ShowS
forall a. Show a => [Xor a] -> ShowS
forall a. Show a => Xor a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Xor a] -> ShowS
$cshowList :: forall a. Show a => [Xor a] -> ShowS
show :: Xor a -> String
$cshow :: forall a. Show a => Xor a -> String
showsPrec :: Int -> Xor a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Xor a -> ShowS
Show,
ReadPrec [Xor a]
ReadPrec (Xor a)
Int -> ReadS (Xor a)
ReadS [Xor a]
(Int -> ReadS (Xor a))
-> ReadS [Xor a]
-> ReadPrec (Xor a)
-> ReadPrec [Xor a]
-> Read (Xor a)
forall a. Read a => ReadPrec [Xor a]
forall a. Read a => ReadPrec (Xor a)
forall a. Read a => Int -> ReadS (Xor a)
forall a. Read a => ReadS [Xor a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Xor a]
$creadListPrec :: forall a. Read a => ReadPrec [Xor a]
readPrec :: ReadPrec (Xor a)
$creadPrec :: forall a. Read a => ReadPrec (Xor a)
readList :: ReadS [Xor a]
$creadList :: forall a. Read a => ReadS [Xor a]
readsPrec :: Int -> ReadS (Xor a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Xor a)
Read
)
instance (Bits a) => Semigroup (Xor a) where
Xor a
x <> :: Xor a -> Xor a -> Xor a
<> Xor a
y = a -> Xor a
forall a. a -> Xor a
Xor (a
x a -> a -> a
forall a. Bits a => a -> a -> a
`xor` a
y)
instance (Bits a) => Monoid (Xor a) where
mempty :: Xor a
mempty = a -> Xor a
forall a. a -> Xor a
Xor a
forall a. Bits a => a
zeroBits
newtype Iff a = Iff { forall a. Iff a -> a
getIff :: a }
deriving newtype (
Iff a
Iff a -> Iff a -> Bounded (Iff a)
forall a. a -> a -> Bounded a
forall a. Bounded a => Iff a
maxBound :: Iff a
$cmaxBound :: forall a. Bounded a => Iff a
minBound :: Iff a
$cminBound :: forall a. Bounded a => Iff a
Bounded,
Int -> Iff a
Iff a -> Int
Iff a -> [Iff a]
Iff a -> Iff a
Iff a -> Iff a -> [Iff a]
Iff a -> Iff a -> Iff a -> [Iff a]
(Iff a -> Iff a)
-> (Iff a -> Iff a)
-> (Int -> Iff a)
-> (Iff a -> Int)
-> (Iff a -> [Iff a])
-> (Iff a -> Iff a -> [Iff a])
-> (Iff a -> Iff a -> [Iff a])
-> (Iff a -> Iff a -> Iff a -> [Iff a])
-> Enum (Iff a)
forall a. Enum a => Int -> Iff a
forall a. Enum a => Iff a -> Int
forall a. Enum a => Iff a -> [Iff a]
forall a. Enum a => Iff a -> Iff a
forall a. Enum a => Iff a -> Iff a -> [Iff a]
forall a. Enum a => Iff a -> Iff a -> Iff a -> [Iff a]
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 :: Iff a -> Iff a -> Iff a -> [Iff a]
$cenumFromThenTo :: forall a. Enum a => Iff a -> Iff a -> Iff a -> [Iff a]
enumFromTo :: Iff a -> Iff a -> [Iff a]
$cenumFromTo :: forall a. Enum a => Iff a -> Iff a -> [Iff a]
enumFromThen :: Iff a -> Iff a -> [Iff a]
$cenumFromThen :: forall a. Enum a => Iff a -> Iff a -> [Iff a]
enumFrom :: Iff a -> [Iff a]
$cenumFrom :: forall a. Enum a => Iff a -> [Iff a]
fromEnum :: Iff a -> Int
$cfromEnum :: forall a. Enum a => Iff a -> Int
toEnum :: Int -> Iff a
$ctoEnum :: forall a. Enum a => Int -> Iff a
pred :: Iff a -> Iff a
$cpred :: forall a. Enum a => Iff a -> Iff a
succ :: Iff a -> Iff a
$csucc :: forall a. Enum a => Iff a -> Iff a
Enum,
Eq (Iff a)
Iff a
Eq (Iff a)
-> (Iff a -> Iff a -> Iff a)
-> (Iff a -> Iff a -> Iff a)
-> (Iff a -> Iff a -> Iff a)
-> (Iff a -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> Iff a
-> (Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Bool)
-> (Iff a -> Maybe Int)
-> (Iff a -> Int)
-> (Iff a -> Bool)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int -> Iff a)
-> (Iff a -> Int)
-> Bits (Iff a)
Int -> Iff a
Iff a -> Bool
Iff a -> Int
Iff a -> Maybe Int
Iff a -> Iff a
Iff a -> Int -> Bool
Iff a -> Int -> Iff a
Iff a -> Iff a -> Iff a
forall a.
Eq a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> a
-> (Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> Bool)
-> (a -> Maybe Int)
-> (a -> Int)
-> (a -> Bool)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int -> a)
-> (a -> Int)
-> Bits a
forall {a}. Bits a => Eq (Iff a)
forall a. Bits a => Iff a
forall a. Bits a => Int -> Iff a
forall a. Bits a => Iff a -> Bool
forall a. Bits a => Iff a -> Int
forall a. Bits a => Iff a -> Maybe Int
forall a. Bits a => Iff a -> Iff a
forall a. Bits a => Iff a -> Int -> Bool
forall a. Bits a => Iff a -> Int -> Iff a
forall a. Bits a => Iff a -> Iff a -> Iff a
popCount :: Iff a -> Int
$cpopCount :: forall a. Bits a => Iff a -> Int
rotateR :: Iff a -> Int -> Iff a
$crotateR :: forall a. Bits a => Iff a -> Int -> Iff a
rotateL :: Iff a -> Int -> Iff a
$crotateL :: forall a. Bits a => Iff a -> Int -> Iff a
unsafeShiftR :: Iff a -> Int -> Iff a
$cunsafeShiftR :: forall a. Bits a => Iff a -> Int -> Iff a
shiftR :: Iff a -> Int -> Iff a
$cshiftR :: forall a. Bits a => Iff a -> Int -> Iff a
unsafeShiftL :: Iff a -> Int -> Iff a
$cunsafeShiftL :: forall a. Bits a => Iff a -> Int -> Iff a
shiftL :: Iff a -> Int -> Iff a
$cshiftL :: forall a. Bits a => Iff a -> Int -> Iff a
isSigned :: Iff a -> Bool
$cisSigned :: forall a. Bits a => Iff a -> Bool
bitSize :: Iff a -> Int
$cbitSize :: forall a. Bits a => Iff a -> Int
bitSizeMaybe :: Iff a -> Maybe Int
$cbitSizeMaybe :: forall a. Bits a => Iff a -> Maybe Int
testBit :: Iff a -> Int -> Bool
$ctestBit :: forall a. Bits a => Iff a -> Int -> Bool
complementBit :: Iff a -> Int -> Iff a
$ccomplementBit :: forall a. Bits a => Iff a -> Int -> Iff a
clearBit :: Iff a -> Int -> Iff a
$cclearBit :: forall a. Bits a => Iff a -> Int -> Iff a
setBit :: Iff a -> Int -> Iff a
$csetBit :: forall a. Bits a => Iff a -> Int -> Iff a
bit :: Int -> Iff a
$cbit :: forall a. Bits a => Int -> Iff a
zeroBits :: Iff a
$czeroBits :: forall a. Bits a => Iff a
rotate :: Iff a -> Int -> Iff a
$crotate :: forall a. Bits a => Iff a -> Int -> Iff a
shift :: Iff a -> Int -> Iff a
$cshift :: forall a. Bits a => Iff a -> Int -> Iff a
complement :: Iff a -> Iff a
$ccomplement :: forall a. Bits a => Iff a -> Iff a
xor :: Iff a -> Iff a -> Iff a
$cxor :: forall a. Bits a => Iff a -> Iff a -> Iff a
.|. :: Iff a -> Iff a -> Iff a
$c.|. :: forall a. Bits a => Iff a -> Iff a -> Iff a
.&. :: Iff a -> Iff a -> Iff a
$c.&. :: forall a. Bits a => Iff a -> Iff a -> Iff a
Bits,
Bits (Iff a)
Bits (Iff a)
-> (Iff a -> Int)
-> (Iff a -> Int)
-> (Iff a -> Int)
-> FiniteBits (Iff a)
Iff a -> Int
forall b.
Bits b -> (b -> Int) -> (b -> Int) -> (b -> Int) -> FiniteBits b
forall {a}. FiniteBits a => Bits (Iff a)
forall a. FiniteBits a => Iff a -> Int
countTrailingZeros :: Iff a -> Int
$ccountTrailingZeros :: forall a. FiniteBits a => Iff a -> Int
countLeadingZeros :: Iff a -> Int
$ccountLeadingZeros :: forall a. FiniteBits a => Iff a -> Int
finiteBitSize :: Iff a -> Int
$cfiniteBitSize :: forall a. FiniteBits a => Iff a -> Int
FiniteBits,
Iff a -> Iff a -> Bool
(Iff a -> Iff a -> Bool) -> (Iff a -> Iff a -> Bool) -> Eq (Iff a)
forall a. Eq a => Iff a -> Iff a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Iff a -> Iff a -> Bool
$c/= :: forall a. Eq a => Iff a -> Iff a -> Bool
== :: Iff a -> Iff a -> Bool
$c== :: forall a. Eq a => Iff a -> Iff a -> Bool
Eq
)
deriving stock (
Int -> Iff a -> ShowS
[Iff a] -> ShowS
Iff a -> String
(Int -> Iff a -> ShowS)
-> (Iff a -> String) -> ([Iff a] -> ShowS) -> Show (Iff a)
forall a. Show a => Int -> Iff a -> ShowS
forall a. Show a => [Iff a] -> ShowS
forall a. Show a => Iff a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Iff a] -> ShowS
$cshowList :: forall a. Show a => [Iff a] -> ShowS
show :: Iff a -> String
$cshow :: forall a. Show a => Iff a -> String
showsPrec :: Int -> Iff a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Iff a -> ShowS
Show,
ReadPrec [Iff a]
ReadPrec (Iff a)
Int -> ReadS (Iff a)
ReadS [Iff a]
(Int -> ReadS (Iff a))
-> ReadS [Iff a]
-> ReadPrec (Iff a)
-> ReadPrec [Iff a]
-> Read (Iff a)
forall a. Read a => ReadPrec [Iff a]
forall a. Read a => ReadPrec (Iff a)
forall a. Read a => Int -> ReadS (Iff a)
forall a. Read a => ReadS [Iff a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Iff a]
$creadListPrec :: forall a. Read a => ReadPrec [Iff a]
readPrec :: ReadPrec (Iff a)
$creadPrec :: forall a. Read a => ReadPrec (Iff a)
readList :: ReadS [Iff a]
$creadList :: forall a. Read a => ReadS [Iff a]
readsPrec :: Int -> ReadS (Iff a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Iff a)
Read
)
instance (FiniteBits a) => Semigroup (Iff a) where
Iff a
x <> :: Iff a -> Iff a -> Iff a
<> Iff a
y = a -> Iff a
forall a. a -> Iff a
Iff (a -> Iff a) -> (a -> a) -> a -> Iff a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a
forall a. Bits a => a -> a
complement (a -> Iff a) -> a -> Iff a
forall a b. (a -> b) -> a -> b
$ (a
x a -> a -> a
forall a. Bits a => a -> a -> a
`xor` a
y)
instance (FiniteBits a) => Monoid (Iff a) where
mempty :: Iff a
mempty = a -> Iff a
forall a. a -> Iff a
Iff a
forall a. FiniteBits a => a
oneBits