Data.Word

base-4.12.0.0: Basic libraries

Copyright | (c) The University of Glasgow 2001
License | BSD-style (see the file libraries/base/LICENSE)
Maintainer | libraries@haskell.org
Stability | experimental
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Data.Word

Contents

- Unsigned integral types
- byte swapping
- Notes

Description

Unsigned integer types.

Synopsis

- data Word
- data Word8
- data Word16
- data Word32
- data Word64
- byteSwap16 :: Word16 -> Word16
- byteSwap32 :: Word32 -> Word32
- byteSwap64 :: Word64 -> Word64

# Unsigned integral types

data Word Source #

A `Word` is an unsigned integral type, with the same size as `Int`.

Instances

Bounded Word # | Since: base-2.1
Instance details Defined in GHC.Enum Methods minBound :: Word # maxBound :: Word #
Enum Word # | Since: base-2.1
Instance details Defined in GHC.Enum Methods succ :: Word -> Word # pred :: Word -> Word # toEnum :: Int -> Word # fromEnum :: Word -> Int # enumFrom :: Word -> [Word] # enumFromThen :: Word -> Word -> [Word] # enumFromTo :: Word -> Word -> [Word] # enumFromThenTo :: Word -> Word -> Word -> [Word] #
Eq Word |
Instance details Defined in GHC.Classes Methods (==) :: Word -> Word -> Bool Source # (/=) :: Word -> Word -> Bool Source #
Integral Word # | Since: base-2.1
Instance details Defined in GHC.Real Methods quot :: Word -> Word -> Word # rem :: Word -> Word -> Word # div :: Word -> Word -> Word # mod :: Word -> Word -> Word # quotRem :: Word -> Word -> (Word, Word) # divMod :: Word -> Word -> (Word, Word) # toInteger :: Word -> Integer #
Data Word # | Since: base-4.0.0.0
Instance details Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word -> c Word # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word # toConstr :: Word -> Constr # dataTypeOf :: Word -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word) # gmapT :: (forall b. Data b => b -> b) -> Word -> Word # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r # gmapQ :: (forall d. Data d => d -> u) -> Word -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word -> m Word # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word #
Num Word # | Since: base-2.1
Instance details Defined in GHC.Num Methods (+) :: Word -> Word -> Word # (-) :: Word -> Word -> Word # (*) :: Word -> Word -> Word # negate :: Word -> Word # abs :: Word -> Word # signum :: Word -> Word # fromInteger :: Integer -> Word #
Ord Word |
Instance details Defined in GHC.Classes Methods compare :: Word -> Word -> Ordering Source # (<) :: Word -> Word -> Bool Source # (<=) :: Word -> Word -> Bool Source # (>) :: Word -> Word -> Bool Source # (>=) :: Word -> Word -> Bool Source # max :: Word -> Word -> Word Source # min :: Word -> Word -> Word Source #
Read Word # | Since: base-4.5.0.0
Instance details Defined in GHC.Read Methods readsPrec :: Int -> ReadS Word # readList :: ReadS [Word] # readPrec :: ReadPrec Word # readListPrec :: ReadPrec [Word] #
Real Word # | Since: base-2.1
Instance details Defined in GHC.Real Methods toRational :: Word -> Rational #
Show Word # | Since: base-2.1
Instance details Defined in GHC.Show Methods showsPrec :: Int -> Word -> ShowS # show :: Word -> String # showList :: [Word] -> ShowS #
Ix Word # | Since: base-4.6.0.0
Instance details Defined in GHC.Arr Methods range :: (Word, Word) -> [Word] # index :: (Word, Word) -> Word -> Int # unsafeIndex :: (Word, Word) -> Word -> Int inRange :: (Word, Word) -> Word -> Bool # rangeSize :: (Word, Word) -> Int # unsafeRangeSize :: (Word, Word) -> Int
FiniteBits Word # | Since: base-4.6.0.0
Instance details Defined in Data.Bits Methods finiteBitSize :: Word -> Int # countLeadingZeros :: Word -> Int # countTrailingZeros :: Word -> Int #
Bits Word # | Since: base-2.1
Instance details Defined in Data.Bits Methods (.&.) :: Word -> Word -> Word # (.|.) :: Word -> Word -> Word # xor :: Word -> Word -> Word # complement :: Word -> Word # shift :: Word -> Int -> Word # rotate :: Word -> Int -> Word # zeroBits :: Word # bit :: Int -> Word # setBit :: Word -> Int -> Word # clearBit :: Word -> Int -> Word # complementBit :: Word -> Int -> Word # testBit :: Word -> Int -> Bool # bitSizeMaybe :: Word -> Maybe Int # bitSize :: Word -> Int # isSigned :: Word -> Bool # shiftL :: Word -> Int -> Word # unsafeShiftL :: Word -> Int -> Word # shiftR :: Word -> Int -> Word # unsafeShiftR :: Word -> Int -> Word # rotateL :: Word -> Int -> Word # rotateR :: Word -> Int -> Word # popCount :: Word -> Int #
Storable Word # | Since: base-2.1
Instance details Defined in Foreign.Storable Methods sizeOf :: Word -> Int # alignment :: Word -> Int # peekElemOff :: Ptr Word -> Int -> IO Word # pokeElemOff :: Ptr Word -> Int -> Word -> IO () # peekByteOff :: Ptr b -> Int -> IO Word # pokeByteOff :: Ptr b -> Int -> Word -> IO () # peek :: Ptr Word -> IO Word # poke :: Ptr Word -> Word -> IO () #
PrintfArg Word # | Since: base-2.1
Instance details Defined in Text.Printf Methods formatArg :: Word -> FieldFormatter # parseFormat :: Word -> ModifierParser #
Generic1 (URec Word :: k -> Type) # |
Instance details Defined in GHC.Generics Associated Types type Rep1 (URec Word) :: k -> Type # Methods from1 :: URec Word a -> Rep1 (URec Word) a # to1 :: Rep1 (URec Word) a -> URec Word a #
Functor (URec Word :: Type -> Type) # | Since: base-4.9.0.0
Instance details Defined in GHC.Generics Methods fmap :: (a -> b) -> URec Word a -> URec Word b # (<$) :: a -> URec Word b -> URec Word a #
Foldable (URec Word :: Type -> Type) # | Since: base-4.9.0.0
Instance details Defined in Data.Foldable Methods fold :: Monoid m => URec Word m -> m # foldMap :: Monoid m => (a -> m) -> URec Word a -> m # foldr :: (a -> b -> b) -> b -> URec Word a -> b # foldr' :: (a -> b -> b) -> b -> URec Word a -> b # foldl :: (b -> a -> b) -> b -> URec Word a -> b # foldl' :: (b -> a -> b) -> b -> URec Word a -> b # foldr1 :: (a -> a -> a) -> URec Word a -> a # foldl1 :: (a -> a -> a) -> URec Word a -> a # toList :: URec Word a -> [a] # null :: URec Word a -> Bool # length :: URec Word a -> Int # elem :: Eq a => a -> URec Word a -> Bool # maximum :: Ord a => URec Word a -> a # minimum :: Ord a => URec Word a -> a # sum :: Num a => URec Word a -> a # product :: Num a => URec Word a -> a #
Traversable (URec Word :: Type -> Type) # | Since: base-4.9.0.0
Instance details Defined in Data.Traversable Methods traverse :: Applicative f => (a -> f b) -> URec Word a -> f (URec Word b) # sequenceA :: Applicative f => URec Word (f a) -> f (URec Word a) # mapM :: Monad m => (a -> m b) -> URec Word a -> m (URec Word b) # sequence :: Monad m => URec Word (m a) -> m (URec Word a) #
Eq (URec Word p) # | Since: base-4.9.0.0
Instance details Defined in GHC.Generics Methods (==) :: URec Word p -> URec Word p -> Bool Source # (/=) :: URec Word p -> URec Word p -> Bool Source #
Ord (URec Word p) # | Since: base-4.9.0.0
Instance details Defined in GHC.Generics Methods compare :: URec Word p -> URec Word p -> Ordering Source # (<) :: URec Word p -> URec Word p -> Bool Source # (<=) :: URec Word p -> URec Word p -> Bool Source # (>) :: URec Word p -> URec Word p -> Bool Source # (>=) :: URec Word p -> URec Word p -> Bool Source # max :: URec Word p -> URec Word p -> URec Word p Source # min :: URec Word p -> URec Word p -> URec Word p Source #
Show (URec Word p) # | Since: base-4.9.0.0
Instance details Defined in GHC.Generics Methods showsPrec :: Int -> URec Word p -> ShowS # show :: URec Word p -> String # showList :: [URec Word p] -> ShowS #
Generic (URec Word p) # |
Instance details Defined in GHC.Generics Associated Types type Rep (URec Word p) :: Type -> Type # Methods from :: URec Word p -> Rep (URec Word p) x # to :: Rep (URec Word p) x -> URec Word p #
data URec Word (p :: k) # | Used for marking occurrences of `Word#` Since: base-4.9.0.0
Instance details Defined in GHC.Generics data URec Word (p :: k) = UWord { uWord# :: Word# }
type Rep1 (URec Word :: k -> Type) # | Since: base-4.9.0.0
Instance details Defined in GHC.Generics type Rep1 (URec Word :: k -> Type) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UWord" PrefixI True) (S1 (MetaSel (Just "uWord#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UWord :: k -> Type)))
type Rep (URec Word p) # | Since: base-4.9.0.0
Instance details Defined in GHC.Generics type Rep (URec Word p) = D1 (MetaData "URec" "GHC.Generics" "base" False) (C1 (MetaCons "UWord" PrefixI True) (S1 (MetaSel (Just "uWord#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UWord :: Type -> Type)))

data Word8 #

8-bit unsigned integer type

Instances

Bounded Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods minBound :: Word8 # maxBound :: Word8 #
Enum Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods succ :: Word8 -> Word8 # pred :: Word8 -> Word8 # toEnum :: Int -> Word8 # fromEnum :: Word8 -> Int # enumFrom :: Word8 -> [Word8] # enumFromThen :: Word8 -> Word8 -> [Word8] # enumFromTo :: Word8 -> Word8 -> [Word8] # enumFromThenTo :: Word8 -> Word8 -> Word8 -> [Word8] #
Eq Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (==) :: Word8 -> Word8 -> Bool Source # (/=) :: Word8 -> Word8 -> Bool Source #
Integral Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods quot :: Word8 -> Word8 -> Word8 # rem :: Word8 -> Word8 -> Word8 # div :: Word8 -> Word8 -> Word8 # mod :: Word8 -> Word8 -> Word8 # quotRem :: Word8 -> Word8 -> (Word8, Word8) # divMod :: Word8 -> Word8 -> (Word8, Word8) # toInteger :: Word8 -> Integer #
Data Word8 # | Since: base-4.0.0.0
Instance details Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word8 -> c Word8 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word8 # toConstr :: Word8 -> Constr # dataTypeOf :: Word8 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word8) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word8) # gmapT :: (forall b. Data b => b -> b) -> Word8 -> Word8 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word8 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word8 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 #
Num Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (+) :: Word8 -> Word8 -> Word8 # (-) :: Word8 -> Word8 -> Word8 # (*) :: Word8 -> Word8 -> Word8 # negate :: Word8 -> Word8 # abs :: Word8 -> Word8 # signum :: Word8 -> Word8 # fromInteger :: Integer -> Word8 #
Ord Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods compare :: Word8 -> Word8 -> Ordering Source # (<) :: Word8 -> Word8 -> Bool Source # (<=) :: Word8 -> Word8 -> Bool Source # (>) :: Word8 -> Word8 -> Bool Source # (>=) :: Word8 -> Word8 -> Bool Source # max :: Word8 -> Word8 -> Word8 Source # min :: Word8 -> Word8 -> Word8 Source #
Read Word8 # | Since: base-2.1
Instance details Defined in GHC.Read Methods readsPrec :: Int -> ReadS Word8 # readList :: ReadS [Word8] # readPrec :: ReadPrec Word8 # readListPrec :: ReadPrec [Word8] #
Real Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods toRational :: Word8 -> Rational #
Show Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods showsPrec :: Int -> Word8 -> ShowS # show :: Word8 -> String # showList :: [Word8] -> ShowS #
Ix Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods range :: (Word8, Word8) -> [Word8] # index :: (Word8, Word8) -> Word8 -> Int # unsafeIndex :: (Word8, Word8) -> Word8 -> Int inRange :: (Word8, Word8) -> Word8 -> Bool # rangeSize :: (Word8, Word8) -> Int # unsafeRangeSize :: (Word8, Word8) -> Int
FiniteBits Word8 # | Since: base-4.6.0.0
Instance details Defined in GHC.Word Methods finiteBitSize :: Word8 -> Int # countLeadingZeros :: Word8 -> Int # countTrailingZeros :: Word8 -> Int #
Bits Word8 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (.&.) :: Word8 -> Word8 -> Word8 # (.|.) :: Word8 -> Word8 -> Word8 # xor :: Word8 -> Word8 -> Word8 # complement :: Word8 -> Word8 # shift :: Word8 -> Int -> Word8 # rotate :: Word8 -> Int -> Word8 # zeroBits :: Word8 # bit :: Int -> Word8 # setBit :: Word8 -> Int -> Word8 # clearBit :: Word8 -> Int -> Word8 # complementBit :: Word8 -> Int -> Word8 # testBit :: Word8 -> Int -> Bool # bitSizeMaybe :: Word8 -> Maybe Int # bitSize :: Word8 -> Int # isSigned :: Word8 -> Bool # shiftL :: Word8 -> Int -> Word8 # unsafeShiftL :: Word8 -> Int -> Word8 # shiftR :: Word8 -> Int -> Word8 # unsafeShiftR :: Word8 -> Int -> Word8 # rotateL :: Word8 -> Int -> Word8 # rotateR :: Word8 -> Int -> Word8 # popCount :: Word8 -> Int #
Storable Word8 # | Since: base-2.1
Instance details Defined in Foreign.Storable Methods sizeOf :: Word8 -> Int # alignment :: Word8 -> Int # peekElemOff :: Ptr Word8 -> Int -> IO Word8 # pokeElemOff :: Ptr Word8 -> Int -> Word8 -> IO () # peekByteOff :: Ptr b -> Int -> IO Word8 # pokeByteOff :: Ptr b -> Int -> Word8 -> IO () # peek :: Ptr Word8 -> IO Word8 # poke :: Ptr Word8 -> Word8 -> IO () #
PrintfArg Word8 # | Since: base-2.1
Instance details Defined in Text.Printf Methods formatArg :: Word8 -> FieldFormatter # parseFormat :: Word8 -> ModifierParser #

data Word16 #

16-bit unsigned integer type

Instances

Bounded Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods minBound :: Word16 # maxBound :: Word16 #
Enum Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods succ :: Word16 -> Word16 # pred :: Word16 -> Word16 # toEnum :: Int -> Word16 # fromEnum :: Word16 -> Int # enumFrom :: Word16 -> [Word16] # enumFromThen :: Word16 -> Word16 -> [Word16] # enumFromTo :: Word16 -> Word16 -> [Word16] # enumFromThenTo :: Word16 -> Word16 -> Word16 -> [Word16] #
Eq Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (==) :: Word16 -> Word16 -> Bool Source # (/=) :: Word16 -> Word16 -> Bool Source #
Integral Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods quot :: Word16 -> Word16 -> Word16 # rem :: Word16 -> Word16 -> Word16 # div :: Word16 -> Word16 -> Word16 # mod :: Word16 -> Word16 -> Word16 # quotRem :: Word16 -> Word16 -> (Word16, Word16) # divMod :: Word16 -> Word16 -> (Word16, Word16) # toInteger :: Word16 -> Integer #
Data Word16 # | Since: base-4.0.0.0
Instance details Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word16 -> c Word16 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word16 # toConstr :: Word16 -> Constr # dataTypeOf :: Word16 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word16) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word16) # gmapT :: (forall b. Data b => b -> b) -> Word16 -> Word16 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word16 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word16 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word16 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word16 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 #
Num Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (+) :: Word16 -> Word16 -> Word16 # (-) :: Word16 -> Word16 -> Word16 # (*) :: Word16 -> Word16 -> Word16 # negate :: Word16 -> Word16 # abs :: Word16 -> Word16 # signum :: Word16 -> Word16 # fromInteger :: Integer -> Word16 #
Ord Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods compare :: Word16 -> Word16 -> Ordering Source # (<) :: Word16 -> Word16 -> Bool Source # (<=) :: Word16 -> Word16 -> Bool Source # (>) :: Word16 -> Word16 -> Bool Source # (>=) :: Word16 -> Word16 -> Bool Source # max :: Word16 -> Word16 -> Word16 Source # min :: Word16 -> Word16 -> Word16 Source #
Read Word16 # | Since: base-2.1
Instance details Defined in GHC.Read Methods readsPrec :: Int -> ReadS Word16 # readList :: ReadS [Word16] # readPrec :: ReadPrec Word16 # readListPrec :: ReadPrec [Word16] #
Real Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods toRational :: Word16 -> Rational #
Show Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods showsPrec :: Int -> Word16 -> ShowS # show :: Word16 -> String # showList :: [Word16] -> ShowS #
Ix Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods range :: (Word16, Word16) -> [Word16] # index :: (Word16, Word16) -> Word16 -> Int # unsafeIndex :: (Word16, Word16) -> Word16 -> Int inRange :: (Word16, Word16) -> Word16 -> Bool # rangeSize :: (Word16, Word16) -> Int # unsafeRangeSize :: (Word16, Word16) -> Int
FiniteBits Word16 # | Since: base-4.6.0.0
Instance details Defined in GHC.Word Methods finiteBitSize :: Word16 -> Int # countLeadingZeros :: Word16 -> Int # countTrailingZeros :: Word16 -> Int #
Bits Word16 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (.&.) :: Word16 -> Word16 -> Word16 # (.|.) :: Word16 -> Word16 -> Word16 # xor :: Word16 -> Word16 -> Word16 # complement :: Word16 -> Word16 # shift :: Word16 -> Int -> Word16 # rotate :: Word16 -> Int -> Word16 # zeroBits :: Word16 # bit :: Int -> Word16 # setBit :: Word16 -> Int -> Word16 # clearBit :: Word16 -> Int -> Word16 # complementBit :: Word16 -> Int -> Word16 # testBit :: Word16 -> Int -> Bool # bitSizeMaybe :: Word16 -> Maybe Int # bitSize :: Word16 -> Int # isSigned :: Word16 -> Bool # shiftL :: Word16 -> Int -> Word16 # unsafeShiftL :: Word16 -> Int -> Word16 # shiftR :: Word16 -> Int -> Word16 # unsafeShiftR :: Word16 -> Int -> Word16 # rotateL :: Word16 -> Int -> Word16 # rotateR :: Word16 -> Int -> Word16 # popCount :: Word16 -> Int #
Storable Word16 # | Since: base-2.1
Instance details Defined in Foreign.Storable Methods sizeOf :: Word16 -> Int # alignment :: Word16 -> Int # peekElemOff :: Ptr Word16 -> Int -> IO Word16 # pokeElemOff :: Ptr Word16 -> Int -> Word16 -> IO () # peekByteOff :: Ptr b -> Int -> IO Word16 # pokeByteOff :: Ptr b -> Int -> Word16 -> IO () # peek :: Ptr Word16 -> IO Word16 # poke :: Ptr Word16 -> Word16 -> IO () #
PrintfArg Word16 # | Since: base-2.1
Instance details Defined in Text.Printf Methods formatArg :: Word16 -> FieldFormatter # parseFormat :: Word16 -> ModifierParser #

data Word32 #

32-bit unsigned integer type

Instances

Bounded Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods minBound :: Word32 # maxBound :: Word32 #
Enum Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods succ :: Word32 -> Word32 # pred :: Word32 -> Word32 # toEnum :: Int -> Word32 # fromEnum :: Word32 -> Int # enumFrom :: Word32 -> [Word32] # enumFromThen :: Word32 -> Word32 -> [Word32] # enumFromTo :: Word32 -> Word32 -> [Word32] # enumFromThenTo :: Word32 -> Word32 -> Word32 -> [Word32] #
Eq Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (==) :: Word32 -> Word32 -> Bool Source # (/=) :: Word32 -> Word32 -> Bool Source #
Integral Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods quot :: Word32 -> Word32 -> Word32 # rem :: Word32 -> Word32 -> Word32 # div :: Word32 -> Word32 -> Word32 # mod :: Word32 -> Word32 -> Word32 # quotRem :: Word32 -> Word32 -> (Word32, Word32) # divMod :: Word32 -> Word32 -> (Word32, Word32) # toInteger :: Word32 -> Integer #
Data Word32 # | Since: base-4.0.0.0
Instance details Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word32 -> c Word32 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word32 # toConstr :: Word32 -> Constr # dataTypeOf :: Word32 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word32) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word32) # gmapT :: (forall b. Data b => b -> b) -> Word32 -> Word32 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word32 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word32 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 #
Num Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (+) :: Word32 -> Word32 -> Word32 # (-) :: Word32 -> Word32 -> Word32 # (*) :: Word32 -> Word32 -> Word32 # negate :: Word32 -> Word32 # abs :: Word32 -> Word32 # signum :: Word32 -> Word32 # fromInteger :: Integer -> Word32 #
Ord Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods compare :: Word32 -> Word32 -> Ordering Source # (<) :: Word32 -> Word32 -> Bool Source # (<=) :: Word32 -> Word32 -> Bool Source # (>) :: Word32 -> Word32 -> Bool Source # (>=) :: Word32 -> Word32 -> Bool Source # max :: Word32 -> Word32 -> Word32 Source # min :: Word32 -> Word32 -> Word32 Source #
Read Word32 # | Since: base-2.1
Instance details Defined in GHC.Read Methods readsPrec :: Int -> ReadS Word32 # readList :: ReadS [Word32] # readPrec :: ReadPrec Word32 # readListPrec :: ReadPrec [Word32] #
Real Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods toRational :: Word32 -> Rational #
Show Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods showsPrec :: Int -> Word32 -> ShowS # show :: Word32 -> String # showList :: [Word32] -> ShowS #
Ix Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods range :: (Word32, Word32) -> [Word32] # index :: (Word32, Word32) -> Word32 -> Int # unsafeIndex :: (Word32, Word32) -> Word32 -> Int inRange :: (Word32, Word32) -> Word32 -> Bool # rangeSize :: (Word32, Word32) -> Int # unsafeRangeSize :: (Word32, Word32) -> Int
FiniteBits Word32 # | Since: base-4.6.0.0
Instance details Defined in GHC.Word Methods finiteBitSize :: Word32 -> Int # countLeadingZeros :: Word32 -> Int # countTrailingZeros :: Word32 -> Int #
Bits Word32 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (.&.) :: Word32 -> Word32 -> Word32 # (.|.) :: Word32 -> Word32 -> Word32 # xor :: Word32 -> Word32 -> Word32 # complement :: Word32 -> Word32 # shift :: Word32 -> Int -> Word32 # rotate :: Word32 -> Int -> Word32 # zeroBits :: Word32 # bit :: Int -> Word32 # setBit :: Word32 -> Int -> Word32 # clearBit :: Word32 -> Int -> Word32 # complementBit :: Word32 -> Int -> Word32 # testBit :: Word32 -> Int -> Bool # bitSizeMaybe :: Word32 -> Maybe Int # bitSize :: Word32 -> Int # isSigned :: Word32 -> Bool # shiftL :: Word32 -> Int -> Word32 # unsafeShiftL :: Word32 -> Int -> Word32 # shiftR :: Word32 -> Int -> Word32 # unsafeShiftR :: Word32 -> Int -> Word32 # rotateL :: Word32 -> Int -> Word32 # rotateR :: Word32 -> Int -> Word32 # popCount :: Word32 -> Int #
Storable Word32 # | Since: base-2.1
Instance details Defined in Foreign.Storable Methods sizeOf :: Word32 -> Int # alignment :: Word32 -> Int # peekElemOff :: Ptr Word32 -> Int -> IO Word32 # pokeElemOff :: Ptr Word32 -> Int -> Word32 -> IO () # peekByteOff :: Ptr b -> Int -> IO Word32 # pokeByteOff :: Ptr b -> Int -> Word32 -> IO () # peek :: Ptr Word32 -> IO Word32 # poke :: Ptr Word32 -> Word32 -> IO () #
PrintfArg Word32 # | Since: base-2.1
Instance details Defined in Text.Printf Methods formatArg :: Word32 -> FieldFormatter # parseFormat :: Word32 -> ModifierParser #

data Word64 #

64-bit unsigned integer type

Instances

Bounded Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods minBound :: Word64 # maxBound :: Word64 #
Enum Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods succ :: Word64 -> Word64 # pred :: Word64 -> Word64 # toEnum :: Int -> Word64 # fromEnum :: Word64 -> Int # enumFrom :: Word64 -> [Word64] # enumFromThen :: Word64 -> Word64 -> [Word64] # enumFromTo :: Word64 -> Word64 -> [Word64] # enumFromThenTo :: Word64 -> Word64 -> Word64 -> [Word64] #
Eq Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (==) :: Word64 -> Word64 -> Bool Source # (/=) :: Word64 -> Word64 -> Bool Source #
Integral Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods quot :: Word64 -> Word64 -> Word64 # rem :: Word64 -> Word64 -> Word64 # div :: Word64 -> Word64 -> Word64 # mod :: Word64 -> Word64 -> Word64 # quotRem :: Word64 -> Word64 -> (Word64, Word64) # divMod :: Word64 -> Word64 -> (Word64, Word64) # toInteger :: Word64 -> Integer #
Data Word64 # | Since: base-4.0.0.0
Instance details Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word64 -> c Word64 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word64 # toConstr :: Word64 -> Constr # dataTypeOf :: Word64 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word64) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word64) # gmapT :: (forall b. Data b => b -> b) -> Word64 -> Word64 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word64 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word64 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word64 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word64 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 #
Num Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (+) :: Word64 -> Word64 -> Word64 # (-) :: Word64 -> Word64 -> Word64 # (*) :: Word64 -> Word64 -> Word64 # negate :: Word64 -> Word64 # abs :: Word64 -> Word64 # signum :: Word64 -> Word64 # fromInteger :: Integer -> Word64 #
Ord Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods compare :: Word64 -> Word64 -> Ordering Source # (<) :: Word64 -> Word64 -> Bool Source # (<=) :: Word64 -> Word64 -> Bool Source # (>) :: Word64 -> Word64 -> Bool Source # (>=) :: Word64 -> Word64 -> Bool Source # max :: Word64 -> Word64 -> Word64 Source # min :: Word64 -> Word64 -> Word64 Source #
Read Word64 # | Since: base-2.1
Instance details Defined in GHC.Read Methods readsPrec :: Int -> ReadS Word64 # readList :: ReadS [Word64] # readPrec :: ReadPrec Word64 # readListPrec :: ReadPrec [Word64] #
Real Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods toRational :: Word64 -> Rational #
Show Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods showsPrec :: Int -> Word64 -> ShowS # show :: Word64 -> String # showList :: [Word64] -> ShowS #
Ix Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods range :: (Word64, Word64) -> [Word64] # index :: (Word64, Word64) -> Word64 -> Int # unsafeIndex :: (Word64, Word64) -> Word64 -> Int inRange :: (Word64, Word64) -> Word64 -> Bool # rangeSize :: (Word64, Word64) -> Int # unsafeRangeSize :: (Word64, Word64) -> Int
FiniteBits Word64 # | Since: base-4.6.0.0
Instance details Defined in GHC.Word Methods finiteBitSize :: Word64 -> Int # countLeadingZeros :: Word64 -> Int # countTrailingZeros :: Word64 -> Int #
Bits Word64 # | Since: base-2.1
Instance details Defined in GHC.Word Methods (.&.) :: Word64 -> Word64 -> Word64 # (.|.) :: Word64 -> Word64 -> Word64 # xor :: Word64 -> Word64 -> Word64 # complement :: Word64 -> Word64 # shift :: Word64 -> Int -> Word64 # rotate :: Word64 -> Int -> Word64 # zeroBits :: Word64 # bit :: Int -> Word64 # setBit :: Word64 -> Int -> Word64 # clearBit :: Word64 -> Int -> Word64 # complementBit :: Word64 -> Int -> Word64 # testBit :: Word64 -> Int -> Bool # bitSizeMaybe :: Word64 -> Maybe Int # bitSize :: Word64 -> Int # isSigned :: Word64 -> Bool # shiftL :: Word64 -> Int -> Word64 # unsafeShiftL :: Word64 -> Int -> Word64 # shiftR :: Word64 -> Int -> Word64 # unsafeShiftR :: Word64 -> Int -> Word64 # rotateL :: Word64 -> Int -> Word64 # rotateR :: Word64 -> Int -> Word64 # popCount :: Word64 -> Int #
Storable Word64 # | Since: base-2.1
Instance details Defined in Foreign.Storable Methods sizeOf :: Word64 -> Int # alignment :: Word64 -> Int # peekElemOff :: Ptr Word64 -> Int -> IO Word64 # pokeElemOff :: Ptr Word64 -> Int -> Word64 -> IO () # peekByteOff :: Ptr b -> Int -> IO Word64 # pokeByteOff :: Ptr b -> Int -> Word64 -> IO () # peek :: Ptr Word64 -> IO Word64 # poke :: Ptr Word64 -> Word64 -> IO () #
PrintfArg Word64 # | Since: base-2.1
Instance details Defined in Text.Printf Methods formatArg :: Word64 -> FieldFormatter # parseFormat :: Word64 -> ModifierParser #

# byte swapping

byteSwap16 :: Word16 -> Word16 #

Swap bytes in `Word16`.

Since: base-4.7.0.0

byteSwap32 :: Word32 -> Word32 #

Reverse order of bytes in `Word32`.

Since: base-4.7.0.0

byteSwap64 :: Word64 -> Word64 #

Reverse order of bytes in `Word64`.

Since: base-4.7.0.0

# Notes

- All arithmetic is performed modulo 2^n, where n is the number of bits in the type. One non-obvious consequence of this is that `negate` should not raise an error on negative arguments.
- For coercing between any two integer types, use `fromIntegral`, which is specialized for all the common cases so should be fast enough. Coercing word types to and from integer types preserves representation, not sign.
- An unbounded size unsigned integer type is available with `Natural`.
- The rules that hold for `Enum` instances over a bounded type such as `Int` (see the section of the Haskell report dealing with arithmetic sequences) also hold for the `Enum` instances over the various `Word` types defined here.
- Right and left shifts by amounts greater than or equal to the width of the type result in a zero result. This is contrary to the behaviour in C, which is undefined; a common interpretation is to truncate the shift count to the width of the type, for example `1 << 32 == 1` in some C implementations.