This module defines bitwise operations for signed and unsigned integers.
class Num a => Bits a where |
Minimal complete definition: .&., .|., xor, complement, (shift or (shiftL and shiftR)), (rotate or (rotateL and rotateR)), bitSize and isSigned.
Methods
(.&.) :: a -> a -> a |
(.|.) :: a -> a -> a |
xor :: a -> a -> a |
complement :: a -> a |
shift :: a -> Int -> a |
An instance can define either this unified shift or shiftL and shiftR, depending on which is more convenient for the type in question.
rotate :: a -> Int -> a |
For unbounded types like Integer, rotate is equivalent to shift.
An instance can define either this unified rotate or rotateL and rotateR, depending on which is more convenient for the type in question.
bit :: Int -> a |
setBit :: a -> Int -> a |
clearBit :: a -> Int -> a |
complementBit :: a -> Int -> a |
testBit :: a -> Int -> Bool |
bitSize :: a -> Int |
isSigned :: a -> Bool |
shiftL :: a -> Int -> a |
An instance can define either this and shiftR or the unified shift, depending on which is more convenient for the type in question.
shiftR :: a -> Int -> a |
An instance can define either this and shiftL or the unified shift, depending on which is more convenient for the type in question.
instance Bits Int |
instance Bits Int8 |
instance Bits Int16 |
instance Bits Int32 |
instance Bits Int64 |
instance Bits Integer |
instance Bits Word |
instance Bits Word8 |
instance Bits Word16 |
instance Bits Word32 |
instance Bits Word64 |
instance Bits WordPtr |
instance Bits IntPtr |
instance Bits CChar |
instance Bits CSChar |
instance Bits CUChar |
instance Bits CShort |
instance Bits CUShort |
instance Bits CInt |
instance Bits CUInt |
instance Bits CLong |
instance Bits CULong |
instance Bits CLLong |
instance Bits CULLong |
instance Bits CPtrdiff |
instance Bits CSize |
instance Bits CWchar |
instance Bits CSigAtomic |
instance Bits CIntPtr |
instance Bits CUIntPtr |
instance Bits CIntMax |
instance Bits CUIntMax |