base-compat-0.12.2: A compatibility layer for base
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Bits.Compat

Synopsis

Documentation

bitDefault :: (Bits a, Num a) => Int -> a #

testBitDefault :: (Bits a, Num a) => a -> Int -> Bool #

popCountDefault :: (Bits a, Num a) => a -> Int #

(.^.) :: Bits a => a -> a -> a infixl 6 Source #

Infix version of xor.

Since: 4.17

(.>>.) :: Bits a => a -> Int -> a infixl 8 Source #

Infix version of shiftR.

Since: 4.17

(.<<.) :: Bits a => a -> Int -> a infixl 8 Source #

Infix version of shiftL.

Since: 4.17

(!>>.) :: Bits a => a -> Int -> a infixl 8 Source #

Infix version of unsafeShiftR.

Since: 4.17

(!<<.) :: Bits a => a -> Int -> a infixl 8 Source #

Infix version of unsafeShiftL.

Since: 4.17

toIntegralSized :: (Integral a, Integral b, Bits a, Bits b) => a -> Maybe b #

oneBits :: FiniteBits a => a Source #

A more concise version of complement zeroBits.

>>> complement (zeroBits :: Word) == (oneBits :: Word)
True
>>> complement (oneBits :: Word) == (zeroBits :: Word)
True

Note

The constraint on oneBits is arguably too strong. However, as some types (such as Natural) have undefined complement, this is the only safe choice.

Since: 4.16