diff options
-rw-r--r-- | libraries/base/Data/Bits.hs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs index 92e94dfd39..9600bb1654 100644 --- a/libraries/base/Data/Bits.hs +++ b/libraries/base/Data/Bits.hs @@ -53,6 +53,8 @@ module Data.Bits ( popCountDefault, toIntegralSized, oneBits, + (.^.), + (.>>.), (.<<.), (!>>.), (!<<.), -- * Newtypes And(..), Ior(..), Xor(..), Iff(..) ) where @@ -87,6 +89,46 @@ oneBits :: (FiniteBits a) => a oneBits = complement zeroBits {-# INLINE oneBits #-} +-- | Infix version of 'xor'. +-- +-- @since 4.17 +(.^.) :: (Bits a) => a -> a -> a +(.^.) = xor + +infixl 6 .^. + +-- | Infix version of 'shiftR'. +-- +-- @since 4.17 +(.>>.) :: (Bits a) => a -> Int -> a +(.>>.) = shiftR + +infixl 8 .>>. + +-- | Infix version of 'shiftL'. +-- +-- @since 4.17 +(.<<.) :: (Bits a) => a -> Int -> a +(.<<.) = shiftL + +infixl 8 .<<. + +-- | Infix version of 'unsafeShiftR'. +-- +-- @since 4.17 +(!>>.) :: (Bits a) => a -> Int -> a +(!>>.) = unsafeShiftR + +infixl 8 !>>. + +-- | Infix version of 'unsafeShiftL'. +-- +-- @since 4.17 +(!<<.) :: (Bits a) => a -> Int -> a +(!<<.) = unsafeShiftL + +infixl 8 !<<. + -- | Monoid under bitwise AND. -- -- >>> getAnd (And 0xab <> And 0x12) :: Word8 |