Safe Haskell | None |
---|---|
Language | Haskell2010 |
Network.ByteOrder
Description
Peek and poke functions for network byte order.
Synopsis
- type Buffer = Ptr Word8
- type Offset = Int
- type BufferSize = Int
- data BufferOverrun = BufferOverrun
- poke8 :: Word8 -> Buffer -> Offset -> IO ()
- poke16 :: Word16 -> Buffer -> Offset -> IO ()
- poke24 :: Word32 -> Buffer -> Offset -> IO ()
- poke32 :: Word32 -> Buffer -> Offset -> IO ()
- poke64 :: Word64 -> Buffer -> Offset -> IO ()
- peek8 :: Buffer -> Offset -> IO Word8
- peek16 :: Buffer -> Offset -> IO Word16
- peek24 :: Buffer -> Offset -> IO Word32
- peek32 :: Buffer -> Offset -> IO Word32
- peek64 :: Buffer -> Offset -> IO Word64
- peekByteString :: Buffer -> Int -> IO ByteString
- bytestring8 :: Word8 -> ByteString
- bytestring16 :: Word16 -> ByteString
- bytestring32 :: Word32 -> ByteString
- bytestring64 :: Word64 -> ByteString
- word8 :: ByteString -> Word8
- word16 :: ByteString -> Word16
- word32 :: ByteString -> Word32
- word64 :: ByteString -> Word64
- unsafeWithByteString :: ByteString -> (Buffer -> Offset -> IO a) -> IO a
- copy :: Buffer -> ByteString -> IO Buffer
- bufferIO :: Buffer -> Int -> (ByteString -> IO a) -> IO a
- class Readable a where
- data ReadBuffer
- newReadBuffer :: Buffer -> BufferSize -> IO ReadBuffer
- withReadBuffer :: ByteString -> (ReadBuffer -> IO a) -> IO a
- read16 :: Readable a => a -> IO Word16
- read24 :: Readable a => a -> IO Word32
- read32 :: Readable a => a -> IO Word32
- read64 :: Readable a => a -> IO Word64
- extractByteString :: Readable a => a -> Int -> IO ByteString
- extractShortByteString :: Readable a => a -> Int -> IO ShortByteString
- data WriteBuffer = WriteBuffer {}
- newWriteBuffer :: Buffer -> BufferSize -> IO WriteBuffer
- clearWriteBuffer :: WriteBuffer -> IO ()
- withWriteBuffer :: BufferSize -> (WriteBuffer -> IO ()) -> IO ByteString
- withWriteBuffer' :: BufferSize -> (WriteBuffer -> IO a) -> IO (ByteString, a)
- write8 :: WriteBuffer -> Word8 -> IO ()
- write16 :: WriteBuffer -> Word16 -> IO ()
- write24 :: WriteBuffer -> Word32 -> IO ()
- write32 :: WriteBuffer -> Word32 -> IO ()
- write64 :: WriteBuffer -> Word64 -> IO ()
- copyByteString :: WriteBuffer -> ByteString -> IO ()
- copyShortByteString :: WriteBuffer -> ShortByteString -> IO ()
- shiftLastN :: WriteBuffer -> Int -> Int -> IO ()
- toByteString :: WriteBuffer -> IO ByteString
- toShortByteString :: WriteBuffer -> IO ShortByteString
- currentOffset :: WriteBuffer -> IO Buffer
- data Word8
- data Word16
- data Word32
- data Word64
- data ByteString
Types
type BufferSize = Int #
Size of a buffer.
data BufferOverrun #
Buffer overrun exception.
Constructors
BufferOverrun | The buffer size is not enough |
Instances
Exception BufferOverrun # | |
Defined in Network.ByteOrder Methods toException :: BufferOverrun -> SomeException # fromException :: SomeException -> Maybe BufferOverrun # displayException :: BufferOverrun -> String # | |
Show BufferOverrun # | |
Defined in Network.ByteOrder Methods showsPrec :: Int -> BufferOverrun -> ShowS # show :: BufferOverrun -> String # showList :: [BufferOverrun] -> ShowS # | |
Eq BufferOverrun # | |
Defined in Network.ByteOrder Methods (==) :: BufferOverrun -> BufferOverrun -> Bool # (/=) :: BufferOverrun -> BufferOverrun -> Bool # |
Poking
poke8 :: Word8 -> Buffer -> Offset -> IO () #
>>>
let buf = pack [1,2,3,4]
>>>
unsafeWithByteString buf (poke8 0)
>>>
unpack buf
[0,2,3,4]
poke16 :: Word16 -> Buffer -> Offset -> IO () #
>>>
let buf = pack [1,2,3,4]
>>>
unsafeWithByteString buf (poke16 (7*256 + 8))
>>>
unpack buf
[7,8,3,4]
poke24 :: Word32 -> Buffer -> Offset -> IO () #
>>>
let buf = pack [1,2,3,4]
>>>
unsafeWithByteString buf (poke24 (6*65536 + 7*256 + 8))
>>>
unpack buf
[6,7,8,4]
poke32 :: Word32 -> Buffer -> Offset -> IO () #
>>>
let buf = pack [1,2,3,4]
>>>
unsafeWithByteString buf (poke32 (6*65536 + 7*256 + 8))
>>>
unpack buf
[0,6,7,8]
poke64 :: Word64 -> Buffer -> Offset -> IO () #
>>>
let buf = pack [1,2,3,4,5,6,7,8]
>>>
unsafeWithByteString buf (poke64 (6*65536 + 7*256 + 8))
>>>
unpack buf
[0,0,0,0,0,6,7,8]
Peeking
peek8 :: Buffer -> Offset -> IO Word8 #
>>>
let buf = pack [1,2,3,4]
>>>
unsafeWithByteString buf peek8
1
peek16 :: Buffer -> Offset -> IO Word16 #
>>>
let buf = pack [1,2,3,4]
>>>
unsafeWithByteString buf peek16
258
peek24 :: Buffer -> Offset -> IO Word32 #
>>>
let buf = pack [1,2,3,4]
>>>
unsafeWithByteString buf peek24
66051
peek32 :: Buffer -> Offset -> IO Word32 #
>>>
let buf = pack [1,2,3,4]
>>>
unsafeWithByteString buf peek32
16909060
peek64 :: Buffer -> Offset -> IO Word64 #
>>>
let buf = pack [1,2,3,4,5,6,7,8]
>>>
unsafeWithByteString buf peek64
72623859790382856
peekByteString :: Buffer -> Int -> IO ByteString #
From Word to ByteString
bytestring8 :: Word8 -> ByteString #
>>>
let w = 5 :: Word8
>>>
unpack $ bytestring8 w
[5]
bytestring16 :: Word16 -> ByteString #
>>>
let w = foldl' (\x y -> x * 256 + y) 0 [5,6] :: Word16
>>>
unpack $ bytestring16 w
[5,6]
bytestring32 :: Word32 -> ByteString #
>>>
let w = foldl' (\x y -> x * 256 + y) 0 [5,6,7,8] :: Word32
>>>
unpack $ bytestring32 w
[5,6,7,8]
bytestring64 :: Word64 -> ByteString #
>>>
let w = foldl' (\x y -> x * 256 + y) 0 [1,2,3,4,5,6,7,8] :: Word64
>>>
unpack $ bytestring64 w
[1,2,3,4,5,6,7,8]
From ByteString to Word
word8 :: ByteString -> Word8 #
>>>
let buf = pack [1,2,3,4,5,6,7,8]
>>>
word8 buf
1
word16 :: ByteString -> Word16 #
>>>
let buf = pack [1,2,3,4,5,6,7,8]
>>>
word16 buf
258
word32 :: ByteString -> Word32 #
>>>
let buf = pack [1,2,3,4,5,6,7,8]
>>>
word32 buf
16909060
word64 :: ByteString -> Word64 #
>>>
let buf = pack [1,2,3,4,5,6,7,8]
>>>
word64 buf
72623859790382856
Utilities
unsafeWithByteString :: ByteString -> (Buffer -> Offset -> IO a) -> IO a #
Using ByteString
as Buffer
and call the IO
action
of the second argument by passing the start point and the offset
of the ByteString
.
Note that if a ByteString
is created newly, its offset is 0.
copy :: Buffer -> ByteString -> IO Buffer #
Copying the bytestring to the buffer. This function returns the point where the next copy should start.
>>>
let buf = "abc" :: ByteString
>>>
unsafeWithByteString buf $ \ptr _ -> Network.ByteOrder.copy ptr "ABC" >> return buf
"ABC"
bufferIO :: Buffer -> Int -> (ByteString -> IO a) -> IO a #
Converting the part of buffer to ByteString
and executing the
action with it.
>>>
let buf = "abcdef" :: ByteString
>>>
unsafeWithByteString buf $ \ptr _-> bufferIO ptr 2 return
"ab"
Class to read a buffer
Methods
Reading one byte as Word8
and ff one byte.
Reading one byte as Int
and ff one byte. If buffer overrun occurs, -1 is returned.
Fast forward the offset pointer. The boundary is not checked.
remainingSize :: a -> IO Int #
Returning the length of the remaining
Executing an action on the current offset pointer.
withCurrentOffSet :: a -> (Buffer -> IO b) -> IO b #
Memorizing the current offset pointer.
savingSize :: a -> IO Int #
Getting how many bytes from the saved offset pinter.
Moving the offset point to the saved point.
Instances
Readable ReadBuffer # | |
Defined in Network.ByteOrder Methods read8 :: ReadBuffer -> IO Word8 # readInt8 :: ReadBuffer -> IO Int # ff :: ReadBuffer -> Offset -> IO () # remainingSize :: ReadBuffer -> IO Int # position :: ReadBuffer -> IO Int # withCurrentOffSet :: ReadBuffer -> (Buffer -> IO b) -> IO b # save :: ReadBuffer -> IO () # savingSize :: ReadBuffer -> IO Int # goBack :: ReadBuffer -> IO () # | |
Readable WriteBuffer # | |
Defined in Network.ByteOrder Methods read8 :: WriteBuffer -> IO Word8 # readInt8 :: WriteBuffer -> IO Int # ff :: WriteBuffer -> Offset -> IO () # remainingSize :: WriteBuffer -> IO Int # position :: WriteBuffer -> IO Int # withCurrentOffSet :: WriteBuffer -> (Buffer -> IO b) -> IO b # save :: WriteBuffer -> IO () # savingSize :: WriteBuffer -> IO Int # goBack :: WriteBuffer -> IO () # |
Reading from buffer
data ReadBuffer #
Read only buffer. To ensure that the internal is not modified, this is an abstract data type.
Instances
Readable ReadBuffer # | |
Defined in Network.ByteOrder Methods read8 :: ReadBuffer -> IO Word8 # readInt8 :: ReadBuffer -> IO Int # ff :: ReadBuffer -> Offset -> IO () # remainingSize :: ReadBuffer -> IO Int # position :: ReadBuffer -> IO Int # withCurrentOffSet :: ReadBuffer -> (Buffer -> IO b) -> IO b # save :: ReadBuffer -> IO () # savingSize :: ReadBuffer -> IO Int # goBack :: ReadBuffer -> IO () # |
newReadBuffer :: Buffer -> BufferSize -> IO ReadBuffer #
Creating a read buffer with the given buffer.
withReadBuffer :: ByteString -> (ReadBuffer -> IO a) -> IO a #
Converting ByteString
to ReadBuffer
and run the action
with it.
read16 :: Readable a => a -> IO Word16 #
Reading two bytes as Word16
and ff two bytes.
>>>
withReadBuffer "\x0\x1\x2\x3" $ read16
1
read24 :: Readable a => a -> IO Word32 #
Reading three bytes as Word32
and ff three bytes.
>>>
withReadBuffer "\x0\x1\x2\x3" $ read24
258
read32 :: Readable a => a -> IO Word32 #
Reading four bytes as Word32
and ff four bytes.
>>>
withReadBuffer "\x0\x1\x2\x3" $ read32
66051
extractByteString :: Readable a => a -> Int -> IO ByteString #
Extracting ByteString
from the current offset.
The contents is copied, not shared.
Its length is specified by the 2nd argument.
If the length is positive, the area after the current pointer is extracted and FF the length finally.
If the length is negative, the area before the current pointer is extracted and does not FF.
>>>
withReadBuffer "abcdefg" $ \rbuf -> ff rbuf 1 >> extractByteString rbuf 2
"bc"
extractShortByteString :: Readable a => a -> Int -> IO ShortByteString #
Extracting ShortByteString
from the current offset.
The contents is copied, not shared.
Its length is specified by the 2nd argument.
If the length is positive, the area after the current pointer is extracted and FF the length finally.
If the length is negative, the area before the current pointer is extracted and does not FF.
>>>
withReadBuffer "abcdefg" $ \rbuf -> ff rbuf 2 >> extractShortByteString rbuf 3
"cde"
Writing to buffer
data WriteBuffer #
Read and write buffer.
Constructors
WriteBuffer | |
Instances
Readable WriteBuffer # | |
Defined in Network.ByteOrder Methods read8 :: WriteBuffer -> IO Word8 # readInt8 :: WriteBuffer -> IO Int # ff :: WriteBuffer -> Offset -> IO () # remainingSize :: WriteBuffer -> IO Int # position :: WriteBuffer -> IO Int # withCurrentOffSet :: WriteBuffer -> (Buffer -> IO b) -> IO b # save :: WriteBuffer -> IO () # savingSize :: WriteBuffer -> IO Int # goBack :: WriteBuffer -> IO () # |
newWriteBuffer :: Buffer -> BufferSize -> IO WriteBuffer #
Creating a write buffer with the given buffer.
clearWriteBuffer :: WriteBuffer -> IO () #
Reseting a write buffer.
withWriteBuffer :: BufferSize -> (WriteBuffer -> IO ()) -> IO ByteString #
Allocate a temporary buffer and copy the result to ByteString
.
withWriteBuffer' :: BufferSize -> (WriteBuffer -> IO a) -> IO (ByteString, a) #
Allocate a temporary buffer and copy the result to ByteString
with
an additional value.
>>>
withWriteBuffer' 1 $ \wbuf -> write8 wbuf 65 >> return 'a'
("A",'a')
write8 :: WriteBuffer -> Word8 -> IO () #
Write one byte and ff one byte.
If buffer overrun occurs, BufferOverrun
is thrown.
>>>
withWriteBuffer 1 $ \wbuf -> write8 wbuf 65
"A"
write16 :: WriteBuffer -> Word16 -> IO () #
Write two bytes and ff one byte.
If buffer overrun occurs, BufferOverrun
is thrown.
>>>
withWriteBuffer 2 $ \wbuf -> write16 wbuf (65 * 256 + 66)
"AB"
write24 :: WriteBuffer -> Word32 -> IO () #
Write three bytes and ff one byte.
If buffer overrun occurs, BufferOverrun
is thrown.
>>>
withWriteBuffer 3 $ \wbuf -> write24 wbuf (65 * 256^(2 :: Int) + 66 * 256 + 67)
"ABC"
write32 :: WriteBuffer -> Word32 -> IO () #
Write four bytes and ff one byte.
If buffer overrun occurs, BufferOverrun
is thrown.
>>>
withWriteBuffer 4 $ \wbuf -> write32 wbuf (65 * 256^(3 :: Int) + 66 * 256^(2 :: Int) + 67 * 256 + 68)
"ABCD"
write64 :: WriteBuffer -> Word64 -> IO () #
Write four bytes and ff one byte.
If buffer overrun occurs, BufferOverrun
is thrown.
copyByteString :: WriteBuffer -> ByteString -> IO () #
Copy the content of ByteString
and ff its length.
If buffer overrun occurs, BufferOverrun
is thrown.
>>>
withWriteBuffer 3 $ \wbuf -> copyByteString wbuf "ABC"
"ABC"
copyShortByteString :: WriteBuffer -> ShortByteString -> IO () #
Copy the content of ShortByteString
and ff its length.
If buffer overrun occurs, BufferOverrun
is thrown.
>>>
withWriteBuffer 5 $ \wbuf -> copyShortByteString wbuf "ABCEF"
"ABCEF"
shiftLastN :: WriteBuffer -> Int -> Int -> IO () #
Shifting the N-bytes area just before the current pointer (the 3rd argument).
If the second argument is positive, shift it to right.
If it is negative, shift it to left.
offset
moves as if it is sticky to the area.
>>>
withWriteBuffer 16 $ \wbuf -> copyByteString wbuf "ABCD" >> shiftLastN wbuf 1 3
"ABBCD">>>
withWriteBuffer 16 $ \wbuf -> copyByteString wbuf "ABCD" >> shiftLastN wbuf 2 3
"ABCBCD">>>
withWriteBuffer 16 $ \wbuf -> copyByteString wbuf "ABCDE" >> shiftLastN wbuf (-2) 3 >> ff wbuf 2
"CDEDE"
toByteString :: WriteBuffer -> IO ByteString #
Copy the area from start
to the current pointer to ByteString
.
toShortByteString :: WriteBuffer -> IO ShortByteString #
Copy the area from start
to the current pointer to ShortByteString
.
currentOffset :: WriteBuffer -> IO Buffer #
Getting the offset pointer.
Re-exporting
8-bit unsigned integer type
Instances
Data Word8 | Since: base-4.0.0.0 |
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 # 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 :: forall r r'. (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 # | |
Storable Word8 | Since: base-2.1 |
Bits Word8 | Since: base-2.1 |
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 # setBit :: Word8 -> Int -> Word8 # clearBit :: Word8 -> Int -> Word8 # complementBit :: Word8 -> Int -> Word8 # testBit :: Word8 -> Int -> Bool # bitSizeMaybe :: Word8 -> Maybe Int # shiftL :: Word8 -> Int -> Word8 # unsafeShiftL :: Word8 -> Int -> Word8 # shiftR :: Word8 -> Int -> Word8 # unsafeShiftR :: Word8 -> Int -> Word8 # rotateL :: Word8 -> Int -> Word8 # | |
FiniteBits Word8 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word8 -> Int # countLeadingZeros :: Word8 -> Int # countTrailingZeros :: Word8 -> Int # | |
Bounded Word8 | Since: base-2.1 |
Enum Word8 | Since: base-2.1 |
Ix Word8 | Since: base-2.1 |
Num Word8 | Since: base-2.1 |
Read Word8 | Since: base-2.1 |
Integral Word8 | Since: base-2.1 |
Real Word8 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word8 -> Rational # | |
Show Word8 | Since: base-2.1 |
PrintfArg Word8 | Since: base-2.1 |
Defined in Text.Printf | |
Eq Word8 | Since: base-2.1 |
Ord Word8 | Since: base-2.1 |
16-bit unsigned integer type
Instances
Data Word16 | Since: base-4.0.0.0 |
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 :: forall r r'. (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 # | |
Storable Word16 | Since: base-2.1 |
Bits Word16 | Since: base-2.1 |
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 # setBit :: Word16 -> Int -> Word16 # clearBit :: Word16 -> Int -> Word16 # complementBit :: Word16 -> Int -> Word16 # testBit :: Word16 -> Int -> Bool # bitSizeMaybe :: Word16 -> Maybe Int # shiftL :: Word16 -> Int -> Word16 # unsafeShiftL :: Word16 -> Int -> Word16 # shiftR :: Word16 -> Int -> Word16 # unsafeShiftR :: Word16 -> Int -> Word16 # rotateL :: Word16 -> Int -> Word16 # | |
FiniteBits Word16 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word16 -> Int # countLeadingZeros :: Word16 -> Int # countTrailingZeros :: Word16 -> Int # | |
Bounded Word16 | Since: base-2.1 |
Enum Word16 | Since: base-2.1 |
Defined in GHC.Word | |
Ix Word16 | Since: base-2.1 |
Num Word16 | Since: base-2.1 |
Read Word16 | Since: base-2.1 |
Integral Word16 | Since: base-2.1 |
Real Word16 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word16 -> Rational # | |
Show Word16 | Since: base-2.1 |
PrintfArg Word16 | Since: base-2.1 |
Defined in Text.Printf | |
Eq Word16 | Since: base-2.1 |
Ord Word16 | Since: base-2.1 |
32-bit unsigned integer type
Instances
Data Word32 | Since: base-4.0.0.0 |
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 :: forall r r'. (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 # | |
Storable Word32 | Since: base-2.1 |
Bits Word32 | Since: base-2.1 |
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 # setBit :: Word32 -> Int -> Word32 # clearBit :: Word32 -> Int -> Word32 # complementBit :: Word32 -> Int -> Word32 # testBit :: Word32 -> Int -> Bool # bitSizeMaybe :: Word32 -> Maybe Int # shiftL :: Word32 -> Int -> Word32 # unsafeShiftL :: Word32 -> Int -> Word32 # shiftR :: Word32 -> Int -> Word32 # unsafeShiftR :: Word32 -> Int -> Word32 # rotateL :: Word32 -> Int -> Word32 # | |
FiniteBits Word32 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word32 -> Int # countLeadingZeros :: Word32 -> Int # countTrailingZeros :: Word32 -> Int # | |
Bounded Word32 | Since: base-2.1 |
Enum Word32 | Since: base-2.1 |
Defined in GHC.Word | |
Ix Word32 | Since: base-2.1 |
Num Word32 | Since: base-2.1 |
Read Word32 | Since: base-2.1 |
Integral Word32 | Since: base-2.1 |
Real Word32 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word32 -> Rational # | |
Show Word32 | Since: base-2.1 |
PrintfArg Word32 | Since: base-2.1 |
Defined in Text.Printf | |
Eq Word32 | Since: base-2.1 |
Ord Word32 | Since: base-2.1 |
64-bit unsigned integer type
Instances
Data Word64 | Since: base-4.0.0.0 |
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 :: forall r r'. (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 # | |
Storable Word64 | Since: base-2.1 |
Bits Word64 | Since: base-2.1 |
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 # setBit :: Word64 -> Int -> Word64 # clearBit :: Word64 -> Int -> Word64 # complementBit :: Word64 -> Int -> Word64 # testBit :: Word64 -> Int -> Bool # bitSizeMaybe :: Word64 -> Maybe Int # shiftL :: Word64 -> Int -> Word64 # unsafeShiftL :: Word64 -> Int -> Word64 # shiftR :: Word64 -> Int -> Word64 # unsafeShiftR :: Word64 -> Int -> Word64 # rotateL :: Word64 -> Int -> Word64 # | |
FiniteBits Word64 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word64 -> Int # countLeadingZeros :: Word64 -> Int # countTrailingZeros :: Word64 -> Int # | |
Bounded Word64 | Since: base-2.1 |
Enum Word64 | Since: base-2.1 |
Defined in GHC.Word | |
Ix Word64 | Since: base-2.1 |
Num Word64 | Since: base-2.1 |
Read Word64 | Since: base-2.1 |
Integral Word64 | Since: base-2.1 |
Real Word64 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word64 -> Rational # | |
Show Word64 | Since: base-2.1 |
PrintfArg Word64 | Since: base-2.1 |
Defined in Text.Printf | |
Eq Word64 | Since: base-2.1 |
Ord Word64 | Since: base-2.1 |
data ByteString #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A ByteString
contains 8-bit bytes, or by using the operations from
Data.ByteString.Char8 it can be interpreted as containing 8-bit
characters.