Safe Haskell | None |
---|---|
Language | Haskell2010 |
Basement.PrimType
Synopsis
- class Eq ty => PrimType ty where
- type PrimSize ty :: Nat
- primSizeInBytes :: Proxy ty -> CountOf Word8
- primShiftToBytes :: Proxy ty -> Int
- primBaUIndex :: ByteArray# -> Offset ty -> ty
- primMbaURead :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset ty -> prim ty
- primMbaUWrite :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset ty -> ty -> prim ()
- primAddrIndex :: Addr# -> Offset ty -> ty
- primAddrRead :: PrimMonad prim => Addr# -> Offset ty -> prim ty
- primAddrWrite :: PrimMonad prim => Addr# -> Offset ty -> ty -> prim ()
- class PrimMemoryComparable ty
- primBaIndex :: PrimType ty => ByteArray# -> Offset ty -> ty
- primMbaRead :: (PrimType ty, PrimMonad prim) => MutableByteArray# (PrimState prim) -> Offset ty -> prim ty
- primMbaWrite :: (PrimType ty, PrimMonad prim) => MutableByteArray# (PrimState prim) -> Offset ty -> ty -> prim ()
- primArrayIndex :: Array# ty -> Offset ty -> ty
- primMutableArrayRead :: PrimMonad prim => MutableArray# (PrimState prim) ty -> Offset ty -> prim ty
- primMutableArrayWrite :: PrimMonad prim => MutableArray# (PrimState prim) ty -> Offset ty -> ty -> prim ()
- primOffsetOfE :: PrimType a => Offset a -> Offset Word8
- primOffsetRecast :: (PrimType a, PrimType b) => Offset a -> Offset b
- sizeRecast :: (PrimType a, PrimType b) => CountOf a -> CountOf b
- offsetAsSize :: Offset a -> CountOf a
- sizeAsOffset :: CountOf a -> Offset a
- sizeInBytes :: PrimType a => CountOf a -> CountOf Word8
- offsetInBytes :: PrimType a => Offset a -> Offset Word8
- offsetInElements :: PrimType a => Offset Word8 -> Offset a
- offsetIsAligned :: PrimType a => Proxy a -> Offset Word8 -> Bool
- primWordGetByteAndShift :: Word# -> (# Word#, Word# #)
- primWord64GetByteAndShift :: Word# -> (# Word#, Word# #)
- primWord64GetHiLo :: Word# -> (# Word#, Word# #)
Documentation
class Eq ty => PrimType ty where Source #
Represent the accessor for types that can be stored in the UArray and MUArray.
Types need to be a instance of storable and have fixed sized.
Methods
primSizeInBytes :: Proxy ty -> CountOf Word8 Source #
get the size in bytes of a ty element
primShiftToBytes :: Proxy ty -> Int Source #
get the shift size
primBaUIndex :: ByteArray# -> Offset ty -> ty Source #
return the element stored at a specific index
Arguments
:: PrimMonad prim | |
=> MutableByteArray# (PrimState prim) | mutable array to read from |
-> Offset ty | index of the element to retrieve |
-> prim ty | the element returned |
Read an element at an index in a mutable array
Arguments
:: PrimMonad prim | |
=> MutableByteArray# (PrimState prim) | mutable array to modify |
-> Offset ty | index of the element to modify |
-> ty | the new value to store |
-> prim () |
Write an element to a specific cell in a mutable array.
primAddrIndex :: Addr# -> Offset ty -> ty Source #
Read from Address, without a state. the value read should be considered a constant for all pratical purpose, otherwise bad thing will happens.
primAddrRead :: PrimMonad prim => Addr# -> Offset ty -> prim ty Source #
Read a value from Addr in a specific primitive monad
primAddrWrite :: PrimMonad prim => Addr# -> Offset ty -> ty -> prim () Source #
Write a value to Addr in a specific primitive monad
Instances
class PrimMemoryComparable ty Source #
A constraint class for serializable type that have an unique memory compare representation
e.g. Float and Double have -0.0 and 0.0 which are Eq individual, yet have a different memory representation which doesn't allow for memcmp operation
Instances
PrimMemoryComparable Word128 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Word256 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable CChar Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable CUChar Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Int16 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Int32 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Int64 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Int8 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Word16 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Word32 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Word64 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Word8 Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Char Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Int Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable Word Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable a => PrimMemoryComparable (BE a) Source # | |
Defined in Basement.PrimType | |
PrimMemoryComparable a => PrimMemoryComparable (LE a) Source # | |
Defined in Basement.PrimType |
primBaIndex :: PrimType ty => ByteArray# -> Offset ty -> ty Source #
primMbaRead :: (PrimType ty, PrimMonad prim) => MutableByteArray# (PrimState prim) -> Offset ty -> prim ty Source #
primMbaWrite :: (PrimType ty, PrimMonad prim) => MutableByteArray# (PrimState prim) -> Offset ty -> ty -> prim () Source #
primArrayIndex :: Array# ty -> Offset ty -> ty Source #
primMutableArrayRead :: PrimMonad prim => MutableArray# (PrimState prim) ty -> Offset ty -> prim ty Source #
primMutableArrayWrite :: PrimMonad prim => MutableArray# (PrimState prim) ty -> Offset ty -> ty -> prim () Source #
sizeRecast :: (PrimType a, PrimType b) => CountOf a -> CountOf b Source #
Cast a CountOf linked to type A (CountOf A) to a CountOf linked to type B (CountOf B)
offsetAsSize :: Offset a -> CountOf a Source #
sizeAsOffset :: CountOf a -> Offset a Source #