ptr-poker-0.1.2.14: Pointer poking action construction and composition toolkit
Safe HaskellSafe-Inferred
LanguageHaskell2010

PtrPoker.Poke

Synopsis

Documentation

newtype Poke Source #

Abstraction over an IO action, which takes a pointer, populates it and produces a pointer right after the populated data.

Constructors

Poke 

Fields

Instances

Instances details
IsString Poke Source #

Reuses the IsString instance of ByteString.

Instance details

Defined in PtrPoker.Poke

Methods

fromString :: String -> Poke #

Monoid Poke Source # 
Instance details

Defined in PtrPoker.Poke

Methods

mempty :: Poke #

mappend :: Poke -> Poke -> Poke #

mconcat :: [Poke] -> Poke #

Semigroup Poke Source # 
Instance details

Defined in PtrPoker.Poke

Methods

(<>) :: Poke -> Poke -> Poke #

sconcat :: NonEmpty Poke -> Poke #

stimes :: Integral b => b -> Poke -> Poke #

concat :: Foldable f => f Poke -> Poke Source #

Concatenate a foldable of pokes.

byteString :: ByteString -> Poke Source #

Efficiently copy the contents of ByteString using memcpy.

word8 :: Word8 -> Poke Source #

Encode Word8 as byte, incrementing the pointer by 1.

lWord16 :: Word16 -> Poke Source #

Encode Word16 in Little-endian.

bWord16 :: Word16 -> Poke Source #

Encode Word16 in Big-endian.

lWord32 :: Word32 -> Poke Source #

Encode Word32 in Little-endian.

bWord32 :: Word32 -> Poke Source #

Encode Word32 in Big-endian.

lWord64 :: Word64 -> Poke Source #

Encode Word64 in Little-endian.

bWord64 :: Word64 -> Poke Source #

Encode Word64 in Big-endian.

lInt16 :: Int16 -> Poke Source #

Encode Int16 in Little-endian.

bInt16 :: Int16 -> Poke Source #

Encode Int16 in Big-endian.

lInt32 :: Int32 -> Poke Source #

Encode Int32 in Little-endian.

bInt32 :: Int32 -> Poke Source #

Encode Int32 in Big-endian.

lInt64 :: Int64 -> Poke Source #

Encode Int64 in Little-endian.

bInt64 :: Int64 -> Poke Source #

Encode Int64 in Big-endian.

textUtf8 :: Text -> Poke Source #

Encode Text in UTF8.

ASCII integers

int8AsciiDec :: Int8 -> Poke Source #

Encode Int8 as a signed ASCII decimal.

int16AsciiDec :: Int16 -> Poke Source #

Encode Int16 as a signed ASCII decimal.

int32AsciiDec :: Int32 -> Poke Source #

Encode Int32 as a signed ASCII decimal.

int64AsciiDec :: Int64 -> Poke Source #

Encode Int64 as a signed ASCII decimal.

intAsciiDec :: Int -> Poke Source #

Encode Int as a signed ASCII decimal.

word8AsciiDec :: Word8 -> Poke Source #

Encode Word8 as an unsigned ASCII decimal.

word16AsciiDec :: Word16 -> Poke Source #

Encode Word16 as an unsigned ASCII decimal.

word32AsciiDec :: Word32 -> Poke Source #

Encode Word32 as an unsigned ASCII decimal.

word64AsciiDec :: Word64 -> Poke Source #

Encode Word64 as an unsigned ASCII decimal.

wordAsciiDec :: Word -> Poke Source #

Encode Word as an unsigned ASCII decimal.

doubleAsciiDec :: Double -> Poke Source #

Encode Double as a signed ASCII decimal.

Low level

sizedReverse :: Int -> (Ptr Word8 -> IO a) -> Poke Source #

Having the amount of bytes to be written precomputed, executes an action, which fills the pointer going downward, starting from the pointer that follows the chunk. I.e., you have to decrement the pointer before writing the first byte, decrement it again before writing the second byte and so on.