Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- class Prim a => Prim' a where
- type SizeOf a :: Natural
- indexWord8ByteArrayAs# :: ByteArray# -> Int# -> a
- readWord8ByteArrayAs# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, a #)
- writeWord8ByteArrayAs# :: MutableByteArray# s -> Int# -> a -> State# s -> State# s
- indexWord8OffAddrAs# :: Addr# -> Int# -> a
- readWord8OffAddrAs# :: Addr# -> Int# -> State# s -> (# State# s, a #)
- writeWord8OffAddrAs# :: Addr# -> Int# -> a -> State# s -> State# s
- class Prim a where
- sizeOf# :: a -> Int#
- alignment# :: a -> Int#
- indexByteArray# :: ByteArray# -> Int# -> a
- readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, a #)
- writeByteArray# :: MutableByteArray# s -> Int# -> a -> State# s -> State# s
- setByteArray# :: MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s
- indexOffAddr# :: Addr# -> Int# -> a
- readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, a #)
- writeOffAddr# :: Addr# -> Int# -> a -> State# s -> State# s
- setOffAddr# :: Addr# -> Int# -> Int# -> a -> State# s -> State# s
- sizeOf :: Prim a => a -> Int
Documentation
class Prim a => Prim' a where Source #
Prim
extension class providing unaligned accesses
hoping to get this merged in https://github.com/haskell/primitive/issues/409
(also includes Addr# primops which that issue/PR may not)
Also includes an associated type for size in bytes. Another thing that maybe primitive could provide. (Wouldn't be hard!)
indexWord8ByteArrayAs# :: ByteArray# -> Int# -> a Source #
Read a value from the array. The offset is in bytes.
readWord8ByteArrayAs# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) Source #
writeWord8ByteArrayAs# :: MutableByteArray# s -> Int# -> a -> State# s -> State# s Source #
indexWord8OffAddrAs# :: Addr# -> Int# -> a Source #
readWord8OffAddrAs# :: Addr# -> Int# -> State# s -> (# State# s, a #) Source #
writeWord8OffAddrAs# :: Addr# -> Int# -> a -> State# s -> State# s Source #
Instances
Class of types supporting primitive array operations. This includes
interfacing with GC-managed memory (functions suffixed with ByteArray#
)
and interfacing with unmanaged memory (functions suffixed with Addr#
).
Endianness is platform-dependent.
Size of values of type a
. The argument is not used.
alignment# :: a -> Int# #
Alignment of values of type a
. The argument is not used.
indexByteArray# :: ByteArray# -> Int# -> a #
Read a value from the array. The offset is in elements of type
a
rather than in bytes.
readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) #
Read a value from the mutable array. The offset is in elements of type
a
rather than in bytes.
writeByteArray# :: MutableByteArray# s -> Int# -> a -> State# s -> State# s #
Write a value to the mutable array. The offset is in elements of type
a
rather than in bytes.
:: MutableByteArray# s | |
-> Int# | offset |
-> Int# | length |
-> a | |
-> State# s | |
-> State# s |
Fill a slice of the mutable array with a value. The offset and length
of the chunk are in elements of type a
rather than in bytes.
indexOffAddr# :: Addr# -> Int# -> a #
Read a value from a memory position given by an address and an offset.
The memory block the address refers to must be immutable. The offset is in
elements of type a
rather than in bytes.
readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, a #) #
Read a value from a memory position given by an address and an offset.
The offset is in elements of type a
rather than in bytes.
writeOffAddr# :: Addr# -> Int# -> a -> State# s -> State# s #
Write a value to a memory position given by an address and an offset.
The offset is in elements of type a
rather than in bytes.
Fill a memory block given by an address, an offset and a length.
The offset and length are in elements of type a
rather than in bytes.