Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 :: 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 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.
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
:: 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
:: 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
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 #
primOffsetOfE :: forall a. PrimType a => Offset a -> Offset Word8 Source #
Deprecated: use offsetInBytes
sizeRecast :: forall a b. ( 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 #