network-byte-order-0.1.6: Network byte order utilities
Safe HaskellNone
LanguageHaskell2010

Network.ByteOrder

Description

Peek and poke functions for network byte order.

Synopsis

Types

type Buffer = Ptr Word8 Source #

A pointer to Word8.

type Offset = Int Source #

Offset from the current pointer.

type BufferSize = Int Source #

Size of a buffer.

data BufferOverrun Source #

Buffer overrun exception.

Constructors

BufferOverrun

The buffer size is not enough

Instances

Instances details
Eq BufferOverrun Source # 
Instance details

Defined in Network.ByteOrder

Show BufferOverrun Source # 
Instance details

Defined in Network.ByteOrder

Methods

showsPrec :: Int -> BufferOverrun -> ShowS

show :: BufferOverrun -> String

showList :: [BufferOverrun] -> ShowS

Exception BufferOverrun Source # 
Instance details

Defined in Network.ByteOrder

Methods

toException :: BufferOverrun -> SomeException

fromException :: SomeException -> Maybe BufferOverrun

displayException :: BufferOverrun -> String

Poking

poke8 :: Word8 -> Buffer -> Offset -> IO () Source #

>>> let buf = pack [1,2,3,4]
>>> unsafeWithByteString buf (poke8 0)
>>> unpack buf
[0,2,3,4]

poke16 :: Word16 -> Buffer -> Offset -> IO () Source #

>>> let buf = pack [1,2,3,4]
>>> unsafeWithByteString buf (poke16 (7*256 + 8))
>>> unpack buf
[7,8,3,4]

poke24 :: Word32 -> Buffer -> Offset -> IO () Source #

>>> 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 () Source #

>>> 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 () Source #

>>> 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 Source #

>>> let buf = pack [1,2,3,4]
>>> unsafeWithByteString buf peek8
1

peek16 :: Buffer -> Offset -> IO Word16 Source #

>>> let buf = pack [1,2,3,4]
>>> unsafeWithByteString buf peek16
258

peek24 :: Buffer -> Offset -> IO Word32 Source #

>>> let buf = pack [1,2,3,4]
>>> unsafeWithByteString buf peek24
66051

peek32 :: Buffer -> Offset -> IO Word32 Source #

>>> let buf = pack [1,2,3,4]
>>> unsafeWithByteString buf peek32
16909060

peek64 :: Buffer -> Offset -> IO Word64 Source #

>>> let buf = pack [1,2,3,4,5,6,7,8]
>>> unsafeWithByteString buf peek64
72623859790382856

From Word to ByteString

bytestring8 :: Word8 -> ByteString Source #

>>> let w = 5 :: Word8
>>> unpack $ bytestring8 w
[5]

bytestring16 :: Word16 -> ByteString Source #

>>> let w = foldl' (\x y -> x * 256 + y) 0 [5,6] :: Word16
>>> unpack $ bytestring16 w
[5,6]

bytestring32 :: Word32 -> ByteString Source #

>>> let w = foldl' (\x y -> x * 256 + y) 0 [5,6,7,8] :: Word32
>>> unpack $ bytestring32 w
[5,6,7,8]

bytestring64 :: Word64 -> ByteString Source #

>>> 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 Source #

>>> let buf = pack [1,2,3,4,5,6,7,8]
>>> word8 buf
1

word16 :: ByteString -> Word16 Source #

>>> let buf = pack [1,2,3,4,5,6,7,8]
>>> word16 buf
258

word32 :: ByteString -> Word32 Source #

>>> let buf = pack [1,2,3,4,5,6,7,8]
>>> word32 buf
16909060

word64 :: ByteString -> Word64 Source #

>>> let buf = pack [1,2,3,4,5,6,7,8]
>>> word64 buf
72623859790382856

Utilities

unsafeWithByteString :: ByteString -> (Buffer -> Offset -> IO a) -> IO a Source #

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 Source #

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 Source #

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

class Readable a where Source #

Methods

read8 :: a -> IO Word8 Source #

Reading one byte as Word8 and ff one byte.

readInt8 :: a -> IO Int Source #

Reading one byte as Int and ff one byte. If buffer overrun occurs, -1 is returned.

ff :: a -> Offset -> IO () Source #

Fast forward the offset pointer. The boundary is not checked.

remainingSize :: a -> IO Int Source #

Returning the length of the remaining

withCurrentOffSet :: a -> (Buffer -> IO b) -> IO b Source #

Executing an action on the current offset pointer.

save :: a -> IO () Source #

Memorizing the current offset pointer.

savingSize :: a -> IO Int Source #

Getting how many bytes from the saved offset pinter.

goBack :: a -> IO () Source #

Moving the offset point to the saved point.

Instances

Instances details
Readable ReadBuffer Source # 
Instance details

Defined in Network.ByteOrder

Readable WriteBuffer Source # 
Instance details

Defined in Network.ByteOrder

Reading from buffer

data ReadBuffer Source #

Read only buffer. To ensure that the internal is not modified, this is an abstract data type.

Instances

Instances details
Readable ReadBuffer Source # 
Instance details

Defined in Network.ByteOrder

newReadBuffer :: Buffer -> BufferSize -> IO ReadBuffer Source #

Creating a read buffer with the given buffer.

withReadBuffer :: ByteString -> (ReadBuffer -> IO a) -> IO a Source #

Converting ByteString to ReadBuffer and run the action with it.

read16 :: Readable a => a -> IO Word16 Source #

Reading two bytes as Word16 and ff two bytes.

>>> withReadBuffer "\x0\x1\x2\x3" $ read16
1

read24 :: Readable a => a -> IO Word32 Source #

Reading three bytes as Word32 and ff three bytes.

>>> withReadBuffer "\x0\x1\x2\x3" $ read24
258

read32 :: Readable a => a -> IO Word32 Source #

Reading four bytes as Word32 and ff four bytes.

>>> withReadBuffer "\x0\x1\x2\x3" $ read32
66051

read64 :: Readable a => a -> IO Word64 Source #

Reading four bytes as Word64 and ff four bytes.

extractByteString :: Readable a => a -> Int -> IO ByteString Source #

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 Source #

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 Source #

Read and write buffer.

Constructors

WriteBuffer 

Fields

Instances

Instances details
Readable WriteBuffer Source # 
Instance details

Defined in Network.ByteOrder

newWriteBuffer :: Buffer -> BufferSize -> IO WriteBuffer Source #

Creating a write buffer with the given buffer.

clearWriteBuffer :: WriteBuffer -> IO () Source #

Reseting a write buffer.

withWriteBuffer :: BufferSize -> (WriteBuffer -> IO ()) -> IO ByteString Source #

Allocate a temporary buffer and copy the result to ByteString.

withWriteBuffer' :: BufferSize -> (WriteBuffer -> IO a) -> IO (ByteString, a) Source #

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 () Source #

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 () Source #

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 () Source #

Write three bytes and ff one byte. If buffer overrun occurs, BufferOverrun is thrown.

>>> withWriteBuffer 3 $ \wbuf -> write24 wbuf (65 * 256^2 + 66 * 256 + 67)
"ABC"

write32 :: WriteBuffer -> Word32 -> IO () Source #

Write four bytes and ff one byte. If buffer overrun occurs, BufferOverrun is thrown.

>>> withWriteBuffer 4 $ \wbuf -> write32 wbuf (65 * 256^3 + 66 * 256^2 + 67 * 256 + 68)
"ABCD"

write64 :: WriteBuffer -> Word64 -> IO () Source #

Write four bytes and ff one byte. If buffer overrun occurs, BufferOverrun is thrown.

copyByteString :: WriteBuffer -> ByteString -> IO () Source #

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 () Source #

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 () Source #

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 Source #

Copy the area from start to the current pointer to ByteString.

toShortByteString :: WriteBuffer -> IO ShortByteString Source #

Copy the area from start to the current pointer to ShortByteString.

currentOffset :: WriteBuffer -> IO Buffer Source #

Getting the offset pointer.

Re-exporting

data Word8 #

Instances

Instances details
Bounded Word8 
Instance details

Defined in GHC.Word

Enum Word8 
Instance details

Defined in GHC.Word

Eq Word8 
Instance details

Defined in GHC.Word

Methods

(==) :: Word8 -> Word8 -> Bool

(/=) :: Word8 -> Word8 -> Bool

Integral Word8 
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

Num Word8 
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 
Instance details

Defined in GHC.Word

Methods

compare :: Word8 -> Word8 -> Ordering

(<) :: Word8 -> Word8 -> Bool

(<=) :: Word8 -> Word8 -> Bool

(>) :: Word8 -> Word8 -> Bool

(>=) :: Word8 -> Word8 -> Bool

max :: Word8 -> Word8 -> Word8

min :: Word8 -> Word8 -> Word8

Read Word8 
Instance details

Defined in GHC.Read

Methods

readsPrec :: Int -> ReadS Word8

readList :: ReadS [Word8]

readPrec :: ReadPrec Word8

readListPrec :: ReadPrec [Word8]

Real Word8 
Instance details

Defined in GHC.Word

Methods

toRational :: Word8 -> Rational

Show Word8 
Instance details

Defined in GHC.Word

Methods

showsPrec :: Int -> Word8 -> ShowS

show :: Word8 -> String

showList :: [Word8] -> ShowS

Ix Word8 
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

Bits Word8 
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

FiniteBits Word8 
Instance details

Defined in GHC.Word

Storable Word8 
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 ()

data Word16 #

Instances

Instances details
Bounded Word16 
Instance details

Defined in GHC.Word

Enum Word16 
Instance details

Defined in GHC.Word

Eq Word16 
Instance details

Defined in GHC.Word

Methods

(==) :: Word16 -> Word16 -> Bool

(/=) :: Word16 -> Word16 -> Bool

Integral Word16 
Instance details

Defined in GHC.Word

Num Word16 
Instance details

Defined in GHC.Word

Ord Word16 
Instance details

Defined in GHC.Word

Methods

compare :: Word16 -> Word16 -> Ordering

(<) :: Word16 -> Word16 -> Bool

(<=) :: Word16 -> Word16 -> Bool

(>) :: Word16 -> Word16 -> Bool

(>=) :: Word16 -> Word16 -> Bool

max :: Word16 -> Word16 -> Word16

min :: Word16 -> Word16 -> Word16

Read Word16 
Instance details

Defined in GHC.Read

Methods

readsPrec :: Int -> ReadS Word16

readList :: ReadS [Word16]

readPrec :: ReadPrec Word16

readListPrec :: ReadPrec [Word16]

Real Word16 
Instance details

Defined in GHC.Word

Methods

toRational :: Word16 -> Rational

Show Word16 
Instance details

Defined in GHC.Word

Methods

showsPrec :: Int -> Word16 -> ShowS

show :: Word16 -> String

showList :: [Word16] -> ShowS

Ix Word16 
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

Bits Word16 
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

FiniteBits Word16 
Instance details

Defined in GHC.Word

Storable Word16 
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 ()

data Word32 #

Instances

Instances details
Bounded Word32 
Instance details

Defined in GHC.Word

Enum Word32 
Instance details

Defined in GHC.Word

Eq Word32 
Instance details

Defined in GHC.Word

Methods

(==) :: Word32 -> Word32 -> Bool

(/=) :: Word32 -> Word32 -> Bool

Integral Word32 
Instance details

Defined in GHC.Word

Num Word32 
Instance details

Defined in GHC.Word

Ord Word32 
Instance details

Defined in GHC.Word

Methods

compare :: Word32 -> Word32 -> Ordering

(<) :: Word32 -> Word32 -> Bool

(<=) :: Word32 -> Word32 -> Bool

(>) :: Word32 -> Word32 -> Bool

(>=) :: Word32 -> Word32 -> Bool

max :: Word32 -> Word32 -> Word32

min :: Word32 -> Word32 -> Word32

Read Word32 
Instance details

Defined in GHC.Read

Methods

readsPrec :: Int -> ReadS Word32

readList :: ReadS [Word32]

readPrec :: ReadPrec Word32

readListPrec :: ReadPrec [Word32]

Real Word32 
Instance details

Defined in GHC.Word

Methods

toRational :: Word32 -> Rational

Show Word32 
Instance details

Defined in GHC.Word

Methods

showsPrec :: Int -> Word32 -> ShowS

show :: Word32 -> String

showList :: [Word32] -> ShowS

Ix Word32 
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

Bits Word32 
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

FiniteBits Word32 
Instance details

Defined in GHC.Word

Storable Word32 
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 ()

data Word64 #

Instances

Instances details
Bounded Word64 
Instance details

Defined in GHC.Word

Enum Word64 
Instance details

Defined in GHC.Word

Eq Word64 
Instance details

Defined in GHC.Word

Methods

(==) :: Word64 -> Word64 -> Bool

(/=) :: Word64 -> Word64 -> Bool

Integral Word64 
Instance details

Defined in GHC.Word

Num Word64 
Instance details

Defined in GHC.Word

Ord Word64 
Instance details

Defined in GHC.Word

Methods

compare :: Word64 -> Word64 -> Ordering

(<) :: Word64 -> Word64 -> Bool

(<=) :: Word64 -> Word64 -> Bool

(>) :: Word64 -> Word64 -> Bool

(>=) :: Word64 -> Word64 -> Bool

max :: Word64 -> Word64 -> Word64

min :: Word64 -> Word64 -> Word64

Read Word64 
Instance details

Defined in GHC.Read

Methods

readsPrec :: Int -> ReadS Word64

readList :: ReadS [Word64]

readPrec :: ReadPrec Word64

readListPrec :: ReadPrec [Word64]

Real Word64 
Instance details

Defined in GHC.Word

Methods

toRational :: Word64 -> Rational

Show Word64 
Instance details

Defined in GHC.Word

Methods

showsPrec :: Int -> Word64 -> ShowS

show :: Word64 -> String

showList :: [Word64] -> ShowS

Ix Word64 
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

Bits Word64 
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

FiniteBits Word64 
Instance details

Defined in GHC.Word

Storable Word64 
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 ()

data ByteString #

Instances

Instances details
IsList ByteString 
Instance details

Defined in Data.ByteString.Internal

Associated Types

type Item ByteString

Methods

fromList :: [Item ByteString] -> ByteString

fromListN :: Int -> [Item ByteString] -> ByteString

toList :: ByteString -> [Item ByteString]

Eq ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

(==) :: ByteString -> ByteString -> Bool

(/=) :: ByteString -> ByteString -> Bool

Data ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteString -> c ByteString

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteString

toConstr :: ByteString -> Constr

dataTypeOf :: ByteString -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ByteString)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteString)

gmapT :: (forall b. Data b => b -> b) -> ByteString -> ByteString

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r

gmapQ :: (forall d. Data d => d -> u) -> ByteString -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteString -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString

Ord ByteString 
Instance details

Defined in Data.ByteString.Internal

Read ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

readsPrec :: Int -> ReadS ByteString

readList :: ReadS [ByteString]

readPrec :: ReadPrec ByteString

readListPrec :: ReadPrec [ByteString]

Show ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

showsPrec :: Int -> ByteString -> ShowS

show :: ByteString -> String

showList :: [ByteString] -> ShowS

IsString ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

fromString :: String -> ByteString

Semigroup ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

(<>) :: ByteString -> ByteString -> ByteString

sconcat :: NonEmpty ByteString -> ByteString

stimes :: Integral b => b -> ByteString -> ByteString

Monoid ByteString 
Instance details

Defined in Data.ByteString.Internal

NFData ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

rnf :: ByteString -> ()

type Item ByteString 
Instance details

Defined in Data.ByteString.Internal

type Item ByteString = Word8