Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class PrimTagged a => PrimBytes a where
- data PrimTag a where
- PTagFloat :: PrimTag Float
- PTagDouble :: PrimTag Double
- PTagInt :: PrimTag Int
- PTagInt8 :: PrimTag Int8
- PTagInt16 :: PrimTag Int16
- PTagInt32 :: PrimTag Int32
- PTagInt64 :: PrimTag Int64
- PTagWord :: PrimTag Word
- PTagWord8 :: PrimTag Word8
- PTagWord16 :: PrimTag Word16
- PTagWord32 :: PrimTag Word32
- PTagWord64 :: PrimTag Word64
- PTagPtr :: PrimTag (Ptr a)
- PTagOther :: PrimTag a
- primTag :: PrimBytes a => a -> PrimTag a
Documentation
class PrimTagged a => PrimBytes a where Source #
Facilities to convert to and from raw byte array.
getBytes :: a -> ByteArray# Source #
Store content of a data type in a primitive byte array
Should be used together with byteOffset
function.
:: Int# | offset in bytes |
-> ByteArray# | |
-> a |
Load content of a data type from a primitive byte array
:: MutableByteArray# s | source array |
-> Int# | byte offset of the source array |
-> State# s | |
-> (#State# s, a#) |
Read data from a mutable byte array given an offset in bytes
:: MutableByteArray# s | destination array |
-> Int# | byte offset of the destination array |
-> a | data to write into array |
-> State# s | |
-> State# s |
Write data into a mutable byte array at a given position (offset in bytes)
readAddr :: Addr# -> State# s -> (#State# s, a#) Source #
Read data from a specified address
writeAddr :: a -> Addr# -> State# s -> State# s Source #
Write data to a specified address
byteSize :: a -> Int# Source #
Size of a data type in bytes
byteAlign :: a -> Int# Source #
Alignment of a data type in bytes.
byteOffset
should be multiple of this value.
byteOffset :: a -> Int# Source #
Offset of the data in a byte array used to store the data,
measured in bytes.
Should be used together with getBytes
function.
Unless in case of special data types represented by ByteArrays,
it is equal to zero.
indexArray :: ByteArray# -> Int# -> a Source #
Index array given an element offset.
indexArray arr i = fromBytes ( i *# byteSize t) arr
readArray :: MutableByteArray# s -> Int# -> State# s -> (#State# s, a#) Source #
Read a mutable array given an element offset.
readArray arr i = readBytes arr ( i *# byteSize t)
writeArray :: MutableByteArray# s -> Int# -> a -> State# s -> State# s Source #
Write a mutable array given an element offset.
writeArray arr i = writeBytes arr ( i *# byteSize t)
getBytes :: (Generic a, GPrimBytes (Rep a)) => a -> ByteArray# Source #
Store content of a data type in a primitive byte array
Should be used together with byteOffset
function.
:: (Generic a, GPrimBytes (Rep a)) | |
=> Int# | offset in bytes |
-> ByteArray# | |
-> a |
Load content of a data type from a primitive byte array
:: (Generic a, GPrimBytes (Rep a)) | |
=> MutableByteArray# s | source array |
-> Int# | byte offset of the source array |
-> State# s | |
-> (#State# s, a#) |
Read data from a mutable byte array given an offset in bytes
:: (Generic a, GPrimBytes (Rep a)) | |
=> MutableByteArray# s | destination array |
-> Int# | byte offset of the destination array |
-> a | data to write into array |
-> State# s | |
-> State# s |
Write data into a mutable byte array at a given position (offset in bytes)
readAddr :: (Generic a, GPrimBytes (Rep a)) => Addr# -> State# s -> (#State# s, a#) Source #
Read data from a specified address
writeAddr :: (Generic a, GPrimBytes (Rep a)) => a -> Addr# -> State# s -> State# s Source #
Write data to a specified address
byteSize :: (Generic a, GPrimBytes (Rep a)) => a -> Int# Source #
Size of a data type in bytes
byteAlign :: (Generic a, GPrimBytes (Rep a)) => a -> Int# Source #
Alignment of a data type in bytes.
byteOffset
should be multiple of this value.
byteOffset :: (Generic a, GPrimBytes (Rep a)) => a -> Int# Source #
Offset of the data in a byte array used to store the data,
measured in bytes.
Should be used together with getBytes
function.
Unless in case of special data types represented by ByteArrays,
it is equal to zero.
PrimBytes Double Source # | |
PrimBytes Float Source # | |
PrimBytes Int Source # | |
PrimBytes Int8 Source # | |
PrimBytes Int16 Source # | |
PrimBytes Int32 Source # | |
PrimBytes Int64 Source # | |
PrimBytes Word Source # | |
PrimBytes Word8 Source # | |
PrimBytes Word16 Source # | |
PrimBytes Word32 Source # | |
PrimBytes Word64 Source # | |
PrimBytes FloatX4 Source # | |
PrimBytes FloatX3 Source # | |
PrimBytes FloatX2 Source # | |
PrimBytes DoubleX4 Source # | |
PrimBytes DoubleX3 Source # | |
PrimBytes DoubleX2 Source # | |
PrimBytes a => PrimBytes [a] Source # | |
PrimBytes a => PrimBytes (Maybe a) Source # | |
PrimBytes (Ptr a) Source # | |
(RepresentableList * xs, All * PrimBytes xs) => PrimBytes (Tuple xs) Source # | |
(RepresentableList * xs, All * PrimBytes xs) => PrimBytes (Tuple xs) Source # | |
PrimBytes t => PrimBytes (ScalarBase t) Source # | |
(PrimBytes a, PrimBytes b) => PrimBytes (Either a b) Source # | |
PrimBytes (Idx * x) Source # | |
RepresentableList * xs => PrimBytes (Idxs * xs) Source # | |
(PrimBytes t, Dimensions Nat ds) => PrimBytes (ArrayBase t ds) Source # | |
PTagFloat :: PrimTag Float | |
PTagDouble :: PrimTag Double | |
PTagInt :: PrimTag Int | |
PTagInt8 :: PrimTag Int8 | |
PTagInt16 :: PrimTag Int16 | |
PTagInt32 :: PrimTag Int32 | |
PTagInt64 :: PrimTag Int64 | |
PTagWord :: PrimTag Word | |
PTagWord8 :: PrimTag Word8 | |
PTagWord16 :: PrimTag Word16 | |
PTagWord32 :: PrimTag Word32 | |
PTagWord64 :: PrimTag Word64 | |
PTagPtr :: PrimTag (Ptr a) | |
PTagOther :: PrimTag a |