Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class Eq ty => PrimType ty where
- 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 :: forall a. PrimType a => Offset a -> Offset Word8
- primOffsetRecast :: forall a b. (PrimType a, PrimType b) => Offset a -> Offset b
- sizeRecast :: forall a b. (PrimType a, PrimType b) => CountOf a -> CountOf b
- offsetAsSize :: Offset a -> CountOf a
- sizeAsOffset :: CountOf a -> Offset a
- sizeInBytes :: forall a. PrimType a => CountOf a -> CountOf Word8
- offsetInBytes :: forall a. PrimType a => Offset a -> Offset Word8
- offsetInElements :: forall a. PrimType a => Offset Word8 -> Offset a
- offsetIsAligned :: forall a. 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 #
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.
primSizeInBytes, primShiftToBytes, primBaUIndex, primMbaURead, primMbaUWrite, primAddrIndex, primAddrRead, primAddrWrite
primSizeInBytes :: Proxy ty -> CountOf Word8 #
get the size in bytes of a ty element
primShiftToBytes :: Proxy ty -> Int #
get the shift size
primBaUIndex :: ByteArray# -> Offset ty -> ty #
return the element stored at a specific index
primMbaURead :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset ty -> prim ty #
Read an element at an index in a mutable array
primMbaUWrite :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset ty -> ty -> prim () #
Write an element to a specific cell in a mutable array.
primAddrIndex :: Addr# -> Offset ty -> ty #
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 #
Read a value from Addr in a specific primitive monad
primAddrWrite :: PrimMonad prim => Addr# -> Offset ty -> ty -> prim () #
Write a value to Addr in a specific primitive monad
PrimType Char # | |
PrimType Double # | |
PrimType Float # | |
PrimType Int # | |
PrimType Int8 # | |
PrimType Int16 # | |
PrimType Int32 # | |
PrimType Int64 # | |
PrimType Word # | |
PrimType Word8 # | |
PrimType Word16 # | |
PrimType Word32 # | |
PrimType Word64 # | |
PrimType CChar # | |
PrimType CUChar # | |
PrimType Char7 # | |
PrimType Word128 # | |
PrimType Word256 # | |
PrimType a => PrimType (BE a) # | |
PrimType a => PrimType (LE a) # | |
class PrimMemoryComparable ty #
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
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 () #
sizeRecast :: forall a b. (PrimType a, PrimType b) => CountOf a -> CountOf b #
Cast a CountOf linked to type A (CountOf A) to a CountOf linked to type B (CountOf B)
offsetAsSize :: Offset a -> CountOf a #
sizeAsOffset :: CountOf a -> Offset a #
primWordGetByteAndShift :: Word# -> (#Word#, Word##) #
primWord64GetByteAndShift :: Word# -> (#Word#, Word##) #
primWord64GetHiLo :: Word# -> (#Word#, Word##) #