basement-0.0.12: 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.

Associated Types

type PrimSize ty :: Nat #

type level size of the given ty

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 #

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

primMbaUWrite #

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 #

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

Instances details
PrimType Char # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Char :: Nat #

PrimType Double # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Double :: Nat #

PrimType Float # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Float :: Nat #

PrimType Int # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Int :: Nat #

PrimType Int8 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Int8 :: Nat #

PrimType Int16 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Int16 :: Nat #

PrimType Int32 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Int32 :: Nat #

PrimType Int64 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Int64 :: Nat #

PrimType Word # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Word :: Nat #

PrimType Word8 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Word8 :: Nat #

PrimType Word16 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Word16 :: Nat #

PrimType Word32 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Word32 :: Nat #

PrimType Word64 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Word64 :: Nat #

PrimType CChar # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize CChar :: Nat #

PrimType CUChar # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize CUChar :: Nat #

PrimType Char7 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Char7 :: Nat #

PrimType Word128 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Word128 :: Nat #

PrimType Word256 # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Word256 :: Nat #

PrimType a => PrimType (BE a) # 
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize (BE a) :: Nat #

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

Defined in Basement.PrimType

Associated Types

type PrimSize (LE a) :: Nat #

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

Instances

Instances details
PrimMemoryComparable Char # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Int # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Int8 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Int16 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Int32 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Int64 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Word # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Word8 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Word16 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Word32 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Word64 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable CChar # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable CUChar # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Word128 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable Word256 # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable a => PrimMemoryComparable (BE a) # 
Instance details

Defined in Basement.PrimType

PrimMemoryComparable a => PrimMemoryComparable (LE a) # 
Instance details

Defined in Basement.PrimType

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 #