basement-0.0.2: Foundation scrap box of array & string

Safe HaskellNone
LanguageHaskell2010

Basement.PrimType

Synopsis

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.

Methods

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

Instances

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) # 

Methods

primSizeInBytes :: Proxy * (BE a) -> CountOf Word8 #

primShiftToBytes :: Proxy * (BE a) -> Int #

primBaUIndex :: ByteArray# -> Offset (BE a) -> BE a #

primMbaURead :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset (BE a) -> prim (BE a) #

primMbaUWrite :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset (BE a) -> BE a -> prim () #

primAddrIndex :: Addr# -> Offset (BE a) -> BE a #

primAddrRead :: PrimMonad prim => Addr# -> Offset (BE a) -> prim (BE a) #

primAddrWrite :: PrimMonad prim => Addr# -> Offset (BE a) -> BE a -> prim () #

PrimType a => PrimType (LE a) # 

Methods

primSizeInBytes :: Proxy * (LE a) -> CountOf Word8 #

primShiftToBytes :: Proxy * (LE a) -> Int #

primBaUIndex :: ByteArray# -> Offset (LE a) -> LE a #

primMbaURead :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset (LE a) -> prim (LE a) #

primMbaUWrite :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset (LE a) -> LE a -> prim () #

primAddrIndex :: Addr# -> Offset (LE a) -> LE a #

primAddrRead :: PrimMonad prim => Addr# -> Offset (LE a) -> prim (LE a) #

primAddrWrite :: PrimMonad prim => Addr# -> Offset (LE a) -> LE a -> prim () #

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 () #

primOffsetOfE :: forall a. PrimType a => Offset a -> Offset Word8 #

Deprecated: use offsetInBytes

primOffsetRecast :: forall a b. (PrimType a, PrimType b) => Offset a -> Offset b #

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)

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 #