{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE UnboxedTuples #-}

module Data.Semiring where

import Data.Bits
import Data.Primitive

newtype MaxPlus a = MaxPlus {forall a. MaxPlus a -> a
getMaxPlus :: a}
  deriving newtype (MaxPlus a -> MaxPlus a -> Bool
(MaxPlus a -> MaxPlus a -> Bool)
-> (MaxPlus a -> MaxPlus a -> Bool) -> Eq (MaxPlus a)
forall a. Eq a => MaxPlus a -> MaxPlus a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => MaxPlus a -> MaxPlus a -> Bool
== :: MaxPlus a -> MaxPlus a -> Bool
$c/= :: forall a. Eq a => MaxPlus a -> MaxPlus a -> Bool
/= :: MaxPlus a -> MaxPlus a -> Bool
Eq, Eq (MaxPlus a)
Eq (MaxPlus a) =>
(MaxPlus a -> MaxPlus a -> Ordering)
-> (MaxPlus a -> MaxPlus a -> Bool)
-> (MaxPlus a -> MaxPlus a -> Bool)
-> (MaxPlus a -> MaxPlus a -> Bool)
-> (MaxPlus a -> MaxPlus a -> Bool)
-> (MaxPlus a -> MaxPlus a -> MaxPlus a)
-> (MaxPlus a -> MaxPlus a -> MaxPlus a)
-> Ord (MaxPlus a)
MaxPlus a -> MaxPlus a -> Bool
MaxPlus a -> MaxPlus a -> Ordering
MaxPlus a -> MaxPlus a -> MaxPlus 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 (MaxPlus a)
forall a. Ord a => MaxPlus a -> MaxPlus a -> Bool
forall a. Ord a => MaxPlus a -> MaxPlus a -> Ordering
forall a. Ord a => MaxPlus a -> MaxPlus a -> MaxPlus a
$ccompare :: forall a. Ord a => MaxPlus a -> MaxPlus a -> Ordering
compare :: MaxPlus a -> MaxPlus a -> Ordering
$c< :: forall a. Ord a => MaxPlus a -> MaxPlus a -> Bool
< :: MaxPlus a -> MaxPlus a -> Bool
$c<= :: forall a. Ord a => MaxPlus a -> MaxPlus a -> Bool
<= :: MaxPlus a -> MaxPlus a -> Bool
$c> :: forall a. Ord a => MaxPlus a -> MaxPlus a -> Bool
> :: MaxPlus a -> MaxPlus a -> Bool
$c>= :: forall a. Ord a => MaxPlus a -> MaxPlus a -> Bool
>= :: MaxPlus a -> MaxPlus a -> Bool
$cmax :: forall a. Ord a => MaxPlus a -> MaxPlus a -> MaxPlus a
max :: MaxPlus a -> MaxPlus a -> MaxPlus a
$cmin :: forall a. Ord a => MaxPlus a -> MaxPlus a -> MaxPlus a
min :: MaxPlus a -> MaxPlus a -> MaxPlus a
Ord, Int -> MaxPlus a -> ShowS
[MaxPlus a] -> ShowS
MaxPlus a -> String
(Int -> MaxPlus a -> ShowS)
-> (MaxPlus a -> String)
-> ([MaxPlus a] -> ShowS)
-> Show (MaxPlus a)
forall a. Show a => Int -> MaxPlus a -> ShowS
forall a. Show a => [MaxPlus a] -> ShowS
forall a. Show a => MaxPlus a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> MaxPlus a -> ShowS
showsPrec :: Int -> MaxPlus a -> ShowS
$cshow :: forall a. Show a => MaxPlus a -> String
show :: MaxPlus a -> String
$cshowList :: forall a. Show a => [MaxPlus a] -> ShowS
showList :: [MaxPlus a] -> ShowS
Show, Addr# -> Int# -> MaxPlus a
ByteArray# -> Int# -> MaxPlus a
MaxPlus a -> Int#
(MaxPlus a -> Int#)
-> (MaxPlus a -> Int#)
-> (ByteArray# -> Int# -> MaxPlus a)
-> (forall s.
    MutableByteArray# s
    -> Int# -> State# s -> (# State# s, MaxPlus a #))
-> (forall s.
    MutableByteArray# s -> Int# -> MaxPlus a -> State# s -> State# s)
-> (forall s.
    MutableByteArray# s
    -> Int# -> Int# -> MaxPlus a -> State# s -> State# s)
-> (Addr# -> Int# -> MaxPlus a)
-> (forall s.
    Addr# -> Int# -> State# s -> (# State# s, MaxPlus a #))
-> (forall s. Addr# -> Int# -> MaxPlus a -> State# s -> State# s)
-> (forall s.
    Addr# -> Int# -> Int# -> MaxPlus a -> State# s -> State# s)
-> Prim (MaxPlus a)
forall s.
Addr# -> Int# -> Int# -> MaxPlus a -> State# s -> State# s
forall s. Addr# -> Int# -> State# s -> (# State# s, MaxPlus a #)
forall s. Addr# -> Int# -> MaxPlus a -> State# s -> State# s
forall s.
MutableByteArray# s
-> Int# -> Int# -> MaxPlus a -> State# s -> State# s
forall s.
MutableByteArray# s
-> Int# -> State# s -> (# State# s, MaxPlus a #)
forall s.
MutableByteArray# s -> Int# -> MaxPlus a -> State# s -> State# s
forall a. Prim a => Addr# -> Int# -> MaxPlus a
forall a. Prim a => ByteArray# -> Int# -> MaxPlus a
forall a. Prim a => MaxPlus a -> Int#
forall a s.
Prim a =>
Addr# -> Int# -> Int# -> MaxPlus a -> State# s -> State# s
forall a s.
Prim a =>
Addr# -> Int# -> State# s -> (# State# s, MaxPlus a #)
forall a s.
Prim a =>
Addr# -> Int# -> MaxPlus a -> State# s -> State# s
forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> Int# -> MaxPlus a -> State# s -> State# s
forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> State# s -> (# State# s, MaxPlus a #)
forall a s.
Prim a =>
MutableByteArray# s -> Int# -> MaxPlus a -> State# s -> State# s
forall a.
(a -> Int#)
-> (a -> Int#)
-> (ByteArray# -> Int# -> a)
-> (forall s.
    MutableByteArray# s -> Int# -> State# s -> (# State# s, a #))
-> (forall s.
    MutableByteArray# s -> Int# -> a -> State# s -> State# s)
-> (forall s.
    MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s)
-> (Addr# -> Int# -> a)
-> (forall s. Addr# -> Int# -> State# s -> (# State# s, a #))
-> (forall s. Addr# -> Int# -> a -> State# s -> State# s)
-> (forall s. Addr# -> Int# -> Int# -> a -> State# s -> State# s)
-> Prim a
$csizeOf# :: forall a. Prim a => MaxPlus a -> Int#
sizeOf# :: MaxPlus a -> Int#
$calignment# :: forall a. Prim a => MaxPlus a -> Int#
alignment# :: MaxPlus a -> Int#
$cindexByteArray# :: forall a. Prim a => ByteArray# -> Int# -> MaxPlus a
indexByteArray# :: ByteArray# -> Int# -> MaxPlus a
$creadByteArray# :: forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> State# s -> (# State# s, MaxPlus a #)
readByteArray# :: forall s.
MutableByteArray# s
-> Int# -> State# s -> (# State# s, MaxPlus a #)
$cwriteByteArray# :: forall a s.
Prim a =>
MutableByteArray# s -> Int# -> MaxPlus a -> State# s -> State# s
writeByteArray# :: forall s.
MutableByteArray# s -> Int# -> MaxPlus a -> State# s -> State# s
$csetByteArray# :: forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> Int# -> MaxPlus a -> State# s -> State# s
setByteArray# :: forall s.
MutableByteArray# s
-> Int# -> Int# -> MaxPlus a -> State# s -> State# s
$cindexOffAddr# :: forall a. Prim a => Addr# -> Int# -> MaxPlus a
indexOffAddr# :: Addr# -> Int# -> MaxPlus a
$creadOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> State# s -> (# State# s, MaxPlus a #)
readOffAddr# :: forall s. Addr# -> Int# -> State# s -> (# State# s, MaxPlus a #)
$cwriteOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> MaxPlus a -> State# s -> State# s
writeOffAddr# :: forall s. Addr# -> Int# -> MaxPlus a -> State# s -> State# s
$csetOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> Int# -> MaxPlus a -> State# s -> State# s
setOffAddr# :: forall s.
Addr# -> Int# -> Int# -> MaxPlus a -> State# s -> State# s
Prim)

instance (Ord a, Bounded a, Num a) => Num (MaxPlus a) where
  {-# SPECIALIZE instance Num (MaxPlus Int) #-}
  + :: MaxPlus a -> MaxPlus a -> MaxPlus a
(+) = MaxPlus a -> MaxPlus a -> MaxPlus a
forall a. Ord a => a -> a -> a
max
  {-# INLINE (+) #-}
  (-) = MaxPlus a -> MaxPlus a -> MaxPlus a
forall a. HasCallStack => a
undefined
  {-# INLINE (-) #-}
  * :: MaxPlus a -> MaxPlus a -> MaxPlus a
(*) = MaxPlus a -> MaxPlus a -> MaxPlus a
forall a. Num a => a -> a -> a
(+)
  {-# INLINE (*) #-}
  negate :: MaxPlus a -> MaxPlus a
negate = MaxPlus a -> MaxPlus a
forall a. HasCallStack => a
undefined
  {-# INLINE negate #-}
  abs :: MaxPlus a -> MaxPlus a
abs = MaxPlus a -> MaxPlus a
forall a. a -> a
id
  {-# INLINE abs #-}
  signum :: MaxPlus a -> MaxPlus a
signum = MaxPlus a -> MaxPlus a
forall a. a -> a
id
  {-# INLINE signum #-}
  fromInteger :: Integer -> MaxPlus a
fromInteger Integer
0 = a -> MaxPlus a
forall a. a -> MaxPlus a
MaxPlus a
forall a. Bounded a => a
minBound
  fromInteger Integer
_ = a -> MaxPlus a
forall a. a -> MaxPlus a
MaxPlus a
0
  {-# INLINE fromInteger #-}

newtype MinPlus a = MinPlus {forall a. MinPlus a -> a
getMinPlus :: a}
  deriving newtype (MinPlus a -> MinPlus a -> Bool
(MinPlus a -> MinPlus a -> Bool)
-> (MinPlus a -> MinPlus a -> Bool) -> Eq (MinPlus a)
forall a. Eq a => MinPlus a -> MinPlus a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => MinPlus a -> MinPlus a -> Bool
== :: MinPlus a -> MinPlus a -> Bool
$c/= :: forall a. Eq a => MinPlus a -> MinPlus a -> Bool
/= :: MinPlus a -> MinPlus a -> Bool
Eq, Eq (MinPlus a)
Eq (MinPlus a) =>
(MinPlus a -> MinPlus a -> Ordering)
-> (MinPlus a -> MinPlus a -> Bool)
-> (MinPlus a -> MinPlus a -> Bool)
-> (MinPlus a -> MinPlus a -> Bool)
-> (MinPlus a -> MinPlus a -> Bool)
-> (MinPlus a -> MinPlus a -> MinPlus a)
-> (MinPlus a -> MinPlus a -> MinPlus a)
-> Ord (MinPlus a)
MinPlus a -> MinPlus a -> Bool
MinPlus a -> MinPlus a -> Ordering
MinPlus a -> MinPlus a -> MinPlus 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 (MinPlus a)
forall a. Ord a => MinPlus a -> MinPlus a -> Bool
forall a. Ord a => MinPlus a -> MinPlus a -> Ordering
forall a. Ord a => MinPlus a -> MinPlus a -> MinPlus a
$ccompare :: forall a. Ord a => MinPlus a -> MinPlus a -> Ordering
compare :: MinPlus a -> MinPlus a -> Ordering
$c< :: forall a. Ord a => MinPlus a -> MinPlus a -> Bool
< :: MinPlus a -> MinPlus a -> Bool
$c<= :: forall a. Ord a => MinPlus a -> MinPlus a -> Bool
<= :: MinPlus a -> MinPlus a -> Bool
$c> :: forall a. Ord a => MinPlus a -> MinPlus a -> Bool
> :: MinPlus a -> MinPlus a -> Bool
$c>= :: forall a. Ord a => MinPlus a -> MinPlus a -> Bool
>= :: MinPlus a -> MinPlus a -> Bool
$cmax :: forall a. Ord a => MinPlus a -> MinPlus a -> MinPlus a
max :: MinPlus a -> MinPlus a -> MinPlus a
$cmin :: forall a. Ord a => MinPlus a -> MinPlus a -> MinPlus a
min :: MinPlus a -> MinPlus a -> MinPlus a
Ord, Int -> MinPlus a -> ShowS
[MinPlus a] -> ShowS
MinPlus a -> String
(Int -> MinPlus a -> ShowS)
-> (MinPlus a -> String)
-> ([MinPlus a] -> ShowS)
-> Show (MinPlus a)
forall a. Show a => Int -> MinPlus a -> ShowS
forall a. Show a => [MinPlus a] -> ShowS
forall a. Show a => MinPlus a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> MinPlus a -> ShowS
showsPrec :: Int -> MinPlus a -> ShowS
$cshow :: forall a. Show a => MinPlus a -> String
show :: MinPlus a -> String
$cshowList :: forall a. Show a => [MinPlus a] -> ShowS
showList :: [MinPlus a] -> ShowS
Show, Addr# -> Int# -> MinPlus a
ByteArray# -> Int# -> MinPlus a
MinPlus a -> Int#
(MinPlus a -> Int#)
-> (MinPlus a -> Int#)
-> (ByteArray# -> Int# -> MinPlus a)
-> (forall s.
    MutableByteArray# s
    -> Int# -> State# s -> (# State# s, MinPlus a #))
-> (forall s.
    MutableByteArray# s -> Int# -> MinPlus a -> State# s -> State# s)
-> (forall s.
    MutableByteArray# s
    -> Int# -> Int# -> MinPlus a -> State# s -> State# s)
-> (Addr# -> Int# -> MinPlus a)
-> (forall s.
    Addr# -> Int# -> State# s -> (# State# s, MinPlus a #))
-> (forall s. Addr# -> Int# -> MinPlus a -> State# s -> State# s)
-> (forall s.
    Addr# -> Int# -> Int# -> MinPlus a -> State# s -> State# s)
-> Prim (MinPlus a)
forall s.
Addr# -> Int# -> Int# -> MinPlus a -> State# s -> State# s
forall s. Addr# -> Int# -> State# s -> (# State# s, MinPlus a #)
forall s. Addr# -> Int# -> MinPlus a -> State# s -> State# s
forall s.
MutableByteArray# s
-> Int# -> Int# -> MinPlus a -> State# s -> State# s
forall s.
MutableByteArray# s
-> Int# -> State# s -> (# State# s, MinPlus a #)
forall s.
MutableByteArray# s -> Int# -> MinPlus a -> State# s -> State# s
forall a. Prim a => Addr# -> Int# -> MinPlus a
forall a. Prim a => ByteArray# -> Int# -> MinPlus a
forall a. Prim a => MinPlus a -> Int#
forall a s.
Prim a =>
Addr# -> Int# -> Int# -> MinPlus a -> State# s -> State# s
forall a s.
Prim a =>
Addr# -> Int# -> State# s -> (# State# s, MinPlus a #)
forall a s.
Prim a =>
Addr# -> Int# -> MinPlus a -> State# s -> State# s
forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> Int# -> MinPlus a -> State# s -> State# s
forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> State# s -> (# State# s, MinPlus a #)
forall a s.
Prim a =>
MutableByteArray# s -> Int# -> MinPlus a -> State# s -> State# s
forall a.
(a -> Int#)
-> (a -> Int#)
-> (ByteArray# -> Int# -> a)
-> (forall s.
    MutableByteArray# s -> Int# -> State# s -> (# State# s, a #))
-> (forall s.
    MutableByteArray# s -> Int# -> a -> State# s -> State# s)
-> (forall s.
    MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s)
-> (Addr# -> Int# -> a)
-> (forall s. Addr# -> Int# -> State# s -> (# State# s, a #))
-> (forall s. Addr# -> Int# -> a -> State# s -> State# s)
-> (forall s. Addr# -> Int# -> Int# -> a -> State# s -> State# s)
-> Prim a
$csizeOf# :: forall a. Prim a => MinPlus a -> Int#
sizeOf# :: MinPlus a -> Int#
$calignment# :: forall a. Prim a => MinPlus a -> Int#
alignment# :: MinPlus a -> Int#
$cindexByteArray# :: forall a. Prim a => ByteArray# -> Int# -> MinPlus a
indexByteArray# :: ByteArray# -> Int# -> MinPlus a
$creadByteArray# :: forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> State# s -> (# State# s, MinPlus a #)
readByteArray# :: forall s.
MutableByteArray# s
-> Int# -> State# s -> (# State# s, MinPlus a #)
$cwriteByteArray# :: forall a s.
Prim a =>
MutableByteArray# s -> Int# -> MinPlus a -> State# s -> State# s
writeByteArray# :: forall s.
MutableByteArray# s -> Int# -> MinPlus a -> State# s -> State# s
$csetByteArray# :: forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> Int# -> MinPlus a -> State# s -> State# s
setByteArray# :: forall s.
MutableByteArray# s
-> Int# -> Int# -> MinPlus a -> State# s -> State# s
$cindexOffAddr# :: forall a. Prim a => Addr# -> Int# -> MinPlus a
indexOffAddr# :: Addr# -> Int# -> MinPlus a
$creadOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> State# s -> (# State# s, MinPlus a #)
readOffAddr# :: forall s. Addr# -> Int# -> State# s -> (# State# s, MinPlus a #)
$cwriteOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> MinPlus a -> State# s -> State# s
writeOffAddr# :: forall s. Addr# -> Int# -> MinPlus a -> State# s -> State# s
$csetOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> Int# -> MinPlus a -> State# s -> State# s
setOffAddr# :: forall s.
Addr# -> Int# -> Int# -> MinPlus a -> State# s -> State# s
Prim)

instance (Ord a, Bounded a, Num a) => Num (MinPlus a) where
  {-# SPECIALIZE instance Num (MinPlus Int) #-}
  + :: MinPlus a -> MinPlus a -> MinPlus a
(+) = MinPlus a -> MinPlus a -> MinPlus a
forall a. Ord a => a -> a -> a
min
  {-# INLINE (+) #-}
  (-) = MinPlus a -> MinPlus a -> MinPlus a
forall a. HasCallStack => a
undefined
  {-# INLINE (-) #-}
  * :: MinPlus a -> MinPlus a -> MinPlus a
(*) = MinPlus a -> MinPlus a -> MinPlus a
forall a. Num a => a -> a -> a
(+)
  {-# INLINE (*) #-}
  negate :: MinPlus a -> MinPlus a
negate = MinPlus a -> MinPlus a
forall a. HasCallStack => a
undefined
  {-# INLINE negate #-}
  abs :: MinPlus a -> MinPlus a
abs = MinPlus a -> MinPlus a
forall a. a -> a
id
  {-# INLINE abs #-}
  signum :: MinPlus a -> MinPlus a
signum = MinPlus a -> MinPlus a
forall a. a -> a
id
  {-# INLINE signum #-}
  fromInteger :: Integer -> MinPlus a
fromInteger Integer
0 = a -> MinPlus a
forall a. a -> MinPlus a
MinPlus a
forall a. Bounded a => a
maxBound
  fromInteger Integer
_ = a -> MinPlus a
forall a. a -> MinPlus a
MinPlus a
0
  {-# INLINE fromInteger #-}

newtype XorAnd a = XorAnd {forall a. XorAnd a -> a
getXorAnd :: a}
  deriving newtype (XorAnd a -> XorAnd a -> Bool
(XorAnd a -> XorAnd a -> Bool)
-> (XorAnd a -> XorAnd a -> Bool) -> Eq (XorAnd a)
forall a. Eq a => XorAnd a -> XorAnd a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => XorAnd a -> XorAnd a -> Bool
== :: XorAnd a -> XorAnd a -> Bool
$c/= :: forall a. Eq a => XorAnd a -> XorAnd a -> Bool
/= :: XorAnd a -> XorAnd a -> Bool
Eq, Int -> XorAnd a -> ShowS
[XorAnd a] -> ShowS
XorAnd a -> String
(Int -> XorAnd a -> ShowS)
-> (XorAnd a -> String) -> ([XorAnd a] -> ShowS) -> Show (XorAnd a)
forall a. Show a => Int -> XorAnd a -> ShowS
forall a. Show a => [XorAnd a] -> ShowS
forall a. Show a => XorAnd a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> XorAnd a -> ShowS
showsPrec :: Int -> XorAnd a -> ShowS
$cshow :: forall a. Show a => XorAnd a -> String
show :: XorAnd a -> String
$cshowList :: forall a. Show a => [XorAnd a] -> ShowS
showList :: [XorAnd a] -> ShowS
Show, Eq (XorAnd a)
XorAnd a
Eq (XorAnd a) =>
(XorAnd a -> XorAnd a -> XorAnd a)
-> (XorAnd a -> XorAnd a -> XorAnd a)
-> (XorAnd a -> XorAnd a -> XorAnd a)
-> (XorAnd a -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> XorAnd a
-> (Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> Bool)
-> (XorAnd a -> Maybe Int)
-> (XorAnd a -> Int)
-> (XorAnd a -> Bool)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int -> XorAnd a)
-> (XorAnd a -> Int)
-> Bits (XorAnd a)
Int -> XorAnd a
XorAnd a -> Bool
XorAnd a -> Int
XorAnd a -> Maybe Int
XorAnd a -> XorAnd a
XorAnd a -> Int -> Bool
XorAnd a -> Int -> XorAnd a
XorAnd a -> XorAnd a -> XorAnd 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 (XorAnd a)
forall a. Bits a => XorAnd a
forall a. Bits a => Int -> XorAnd a
forall a. Bits a => XorAnd a -> Bool
forall a. Bits a => XorAnd a -> Int
forall a. Bits a => XorAnd a -> Maybe Int
forall a. Bits a => XorAnd a -> XorAnd a
forall a. Bits a => XorAnd a -> Int -> Bool
forall a. Bits a => XorAnd a -> Int -> XorAnd a
forall a. Bits a => XorAnd a -> XorAnd a -> XorAnd a
$c.&. :: forall a. Bits a => XorAnd a -> XorAnd a -> XorAnd a
.&. :: XorAnd a -> XorAnd a -> XorAnd a
$c.|. :: forall a. Bits a => XorAnd a -> XorAnd a -> XorAnd a
.|. :: XorAnd a -> XorAnd a -> XorAnd a
$cxor :: forall a. Bits a => XorAnd a -> XorAnd a -> XorAnd a
xor :: XorAnd a -> XorAnd a -> XorAnd a
$ccomplement :: forall a. Bits a => XorAnd a -> XorAnd a
complement :: XorAnd a -> XorAnd a
$cshift :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
shift :: XorAnd a -> Int -> XorAnd a
$crotate :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
rotate :: XorAnd a -> Int -> XorAnd a
$czeroBits :: forall a. Bits a => XorAnd a
zeroBits :: XorAnd a
$cbit :: forall a. Bits a => Int -> XorAnd a
bit :: Int -> XorAnd a
$csetBit :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
setBit :: XorAnd a -> Int -> XorAnd a
$cclearBit :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
clearBit :: XorAnd a -> Int -> XorAnd a
$ccomplementBit :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
complementBit :: XorAnd a -> Int -> XorAnd a
$ctestBit :: forall a. Bits a => XorAnd a -> Int -> Bool
testBit :: XorAnd a -> Int -> Bool
$cbitSizeMaybe :: forall a. Bits a => XorAnd a -> Maybe Int
bitSizeMaybe :: XorAnd a -> Maybe Int
$cbitSize :: forall a. Bits a => XorAnd a -> Int
bitSize :: XorAnd a -> Int
$cisSigned :: forall a. Bits a => XorAnd a -> Bool
isSigned :: XorAnd a -> Bool
$cshiftL :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
shiftL :: XorAnd a -> Int -> XorAnd a
$cunsafeShiftL :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
unsafeShiftL :: XorAnd a -> Int -> XorAnd a
$cshiftR :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
shiftR :: XorAnd a -> Int -> XorAnd a
$cunsafeShiftR :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
unsafeShiftR :: XorAnd a -> Int -> XorAnd a
$crotateL :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
rotateL :: XorAnd a -> Int -> XorAnd a
$crotateR :: forall a. Bits a => XorAnd a -> Int -> XorAnd a
rotateR :: XorAnd a -> Int -> XorAnd a
$cpopCount :: forall a. Bits a => XorAnd a -> Int
popCount :: XorAnd a -> Int
Bits, Addr# -> Int# -> XorAnd a
ByteArray# -> Int# -> XorAnd a
XorAnd a -> Int#
(XorAnd a -> Int#)
-> (XorAnd a -> Int#)
-> (ByteArray# -> Int# -> XorAnd a)
-> (forall s.
    MutableByteArray# s
    -> Int# -> State# s -> (# State# s, XorAnd a #))
-> (forall s.
    MutableByteArray# s -> Int# -> XorAnd a -> State# s -> State# s)
-> (forall s.
    MutableByteArray# s
    -> Int# -> Int# -> XorAnd a -> State# s -> State# s)
-> (Addr# -> Int# -> XorAnd a)
-> (forall s.
    Addr# -> Int# -> State# s -> (# State# s, XorAnd a #))
-> (forall s. Addr# -> Int# -> XorAnd a -> State# s -> State# s)
-> (forall s.
    Addr# -> Int# -> Int# -> XorAnd a -> State# s -> State# s)
-> Prim (XorAnd a)
forall s. Addr# -> Int# -> Int# -> XorAnd a -> State# s -> State# s
forall s. Addr# -> Int# -> State# s -> (# State# s, XorAnd a #)
forall s. Addr# -> Int# -> XorAnd a -> State# s -> State# s
forall s.
MutableByteArray# s
-> Int# -> Int# -> XorAnd a -> State# s -> State# s
forall s.
MutableByteArray# s -> Int# -> State# s -> (# State# s, XorAnd a #)
forall s.
MutableByteArray# s -> Int# -> XorAnd a -> State# s -> State# s
forall a. Prim a => Addr# -> Int# -> XorAnd a
forall a. Prim a => ByteArray# -> Int# -> XorAnd a
forall a. Prim a => XorAnd a -> Int#
forall a s.
Prim a =>
Addr# -> Int# -> Int# -> XorAnd a -> State# s -> State# s
forall a s.
Prim a =>
Addr# -> Int# -> State# s -> (# State# s, XorAnd a #)
forall a s.
Prim a =>
Addr# -> Int# -> XorAnd a -> State# s -> State# s
forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> Int# -> XorAnd a -> State# s -> State# s
forall a s.
Prim a =>
MutableByteArray# s -> Int# -> State# s -> (# State# s, XorAnd a #)
forall a s.
Prim a =>
MutableByteArray# s -> Int# -> XorAnd a -> State# s -> State# s
forall a.
(a -> Int#)
-> (a -> Int#)
-> (ByteArray# -> Int# -> a)
-> (forall s.
    MutableByteArray# s -> Int# -> State# s -> (# State# s, a #))
-> (forall s.
    MutableByteArray# s -> Int# -> a -> State# s -> State# s)
-> (forall s.
    MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s)
-> (Addr# -> Int# -> a)
-> (forall s. Addr# -> Int# -> State# s -> (# State# s, a #))
-> (forall s. Addr# -> Int# -> a -> State# s -> State# s)
-> (forall s. Addr# -> Int# -> Int# -> a -> State# s -> State# s)
-> Prim a
$csizeOf# :: forall a. Prim a => XorAnd a -> Int#
sizeOf# :: XorAnd a -> Int#
$calignment# :: forall a. Prim a => XorAnd a -> Int#
alignment# :: XorAnd a -> Int#
$cindexByteArray# :: forall a. Prim a => ByteArray# -> Int# -> XorAnd a
indexByteArray# :: ByteArray# -> Int# -> XorAnd a
$creadByteArray# :: forall a s.
Prim a =>
MutableByteArray# s -> Int# -> State# s -> (# State# s, XorAnd a #)
readByteArray# :: forall s.
MutableByteArray# s -> Int# -> State# s -> (# State# s, XorAnd a #)
$cwriteByteArray# :: forall a s.
Prim a =>
MutableByteArray# s -> Int# -> XorAnd a -> State# s -> State# s
writeByteArray# :: forall s.
MutableByteArray# s -> Int# -> XorAnd a -> State# s -> State# s
$csetByteArray# :: forall a s.
Prim a =>
MutableByteArray# s
-> Int# -> Int# -> XorAnd a -> State# s -> State# s
setByteArray# :: forall s.
MutableByteArray# s
-> Int# -> Int# -> XorAnd a -> State# s -> State# s
$cindexOffAddr# :: forall a. Prim a => Addr# -> Int# -> XorAnd a
indexOffAddr# :: Addr# -> Int# -> XorAnd a
$creadOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> State# s -> (# State# s, XorAnd a #)
readOffAddr# :: forall s. Addr# -> Int# -> State# s -> (# State# s, XorAnd a #)
$cwriteOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> XorAnd a -> State# s -> State# s
writeOffAddr# :: forall s. Addr# -> Int# -> XorAnd a -> State# s -> State# s
$csetOffAddr# :: forall a s.
Prim a =>
Addr# -> Int# -> Int# -> XorAnd a -> State# s -> State# s
setOffAddr# :: forall s. Addr# -> Int# -> Int# -> XorAnd a -> State# s -> State# s
Prim)

instance (Bits a) => Num (XorAnd a) where
  {-# SPECIALIZE instance Num (XorAnd Int) #-}
  + :: XorAnd a -> XorAnd a -> XorAnd a
(+) = XorAnd a -> XorAnd a -> XorAnd a
forall a. Bits a => a -> a -> a
xor
  {-# INLINE (+) #-}
  (-) = XorAnd a -> XorAnd a -> XorAnd a
forall a. Bits a => a -> a -> a
xor
  {-# INLINE (-) #-}
  * :: XorAnd a -> XorAnd a -> XorAnd a
(*) = XorAnd a -> XorAnd a -> XorAnd a
forall a. Bits a => a -> a -> a
(.&.)
  {-# INLINE (*) #-}
  negate :: XorAnd a -> XorAnd a
negate = XorAnd a -> XorAnd a
forall a. a -> a
id
  {-# INLINE negate #-}
  abs :: XorAnd a -> XorAnd a
abs = XorAnd a -> XorAnd a
forall a. a -> a
id
  {-# INLINE abs #-}
  signum :: XorAnd a -> XorAnd a
signum = XorAnd a -> XorAnd a
forall a. a -> a
id
  {-# INLINE signum #-}
  fromInteger :: Integer -> XorAnd a
fromInteger Integer
x
    | Integer
x Integer -> Integer -> Integer
forall a. Bits a => a -> a -> a
.&. Integer
1 Integer -> Integer -> Bool
forall a. Eq a => a -> a -> Bool
== Integer
0 = XorAnd a
forall a. Bits a => a
zeroBits
    | Bool
otherwise = XorAnd a -> XorAnd a
forall a. Bits a => a -> a
complement XorAnd a
forall a. Bits a => a
zeroBits
  {-# INLINE fromInteger #-}