basement-0.0.15: Foundation scrap box of array & string
Safe Haskell None
Language Haskell2010

Basement.PrimType

Synopsis

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.

Associated Types

type PrimSize ty :: Nat Source #

type level size of the given ty

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

primMbaURead Source #

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

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

Instances details
PrimType Char Source #
Instance details

Defined in Basement.PrimType

PrimType Double Source #
Instance details

Defined in Basement.PrimType

PrimType Float Source #
Instance details

Defined in Basement.PrimType

PrimType Int Source #
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize Int :: Nat Source #

PrimType Int8 Source #
Instance details

Defined in Basement.PrimType

PrimType Int16 Source #
Instance details

Defined in Basement.PrimType

PrimType Int32 Source #
Instance details

Defined in Basement.PrimType

PrimType Int64 Source #
Instance details

Defined in Basement.PrimType

PrimType Word Source #
Instance details

Defined in Basement.PrimType

PrimType Word8 Source #
Instance details

Defined in Basement.PrimType

PrimType Word16 Source #
Instance details

Defined in Basement.PrimType

PrimType Word32 Source #
Instance details

Defined in Basement.PrimType

PrimType Word64 Source #
Instance details

Defined in Basement.PrimType

PrimType CChar Source #
Instance details

Defined in Basement.PrimType

PrimType CUChar Source #
Instance details

Defined in Basement.PrimType

PrimType Char7 Source #
Instance details

Defined in Basement.PrimType

PrimType Word128 Source #
Instance details

Defined in Basement.PrimType

PrimType Word256 Source #
Instance details

Defined in Basement.PrimType

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

Defined in Basement.PrimType

Associated Types

type PrimSize ( BE a) :: Nat Source #

PrimType a => PrimType ( LE a) Source #
Instance details

Defined in Basement.PrimType

Associated Types

type PrimSize ( LE a) :: Nat Source #

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

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)