License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- class Eq ty => PrimType ty where
- class (Functor m, Applicative m, Monad m) => PrimMonad (m :: * -> *) where
- class ByteSwap a
- newtype LE a :: * -> * = LE {
- unLE :: a
- toLE :: ByteSwap a => a -> LE a
- fromLE :: ByteSwap a => LE a -> a
- newtype BE a :: * -> * = BE {
- unBE :: a
- toBE :: ByteSwap a => a -> BE a
- fromBE :: ByteSwap a => BE a -> a
- class IntegralUpsize a b where
- class IntegralDownsize a b where
- class NormalForm a where
- force :: NormalForm a => a -> a
- deepseq :: NormalForm a => a -> b -> b
- data These a b :: * -> * -> *
- data Block ty :: * -> *
- data MutableBlock ty st :: * -> * -> *
- data Char7 :: *
- data AsciiString :: *
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
:: 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 #
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
class (Functor m, Applicative m, Monad m) => PrimMonad (m :: * -> *) where #
Primitive monad that can handle mutation.
For example: IO and ST.
type PrimState (m :: * -> *) :: * #
type of state token associated with the PrimMonad m
type PrimVar (m :: * -> *) :: * -> * #
type of variable associated with the PrimMonad m
primitive :: (State# (PrimState m) -> (#TupleRep ([] RuntimeRep), LiftedRep, State# (PrimState m), a#)) -> m a #
Unwrap the State# token to pass to a function a primitive function that returns an unboxed state and a value.
primThrow :: Exception e => e -> m a #
Throw Exception in the primitive monad
unPrimMonad :: m a -> State# (PrimState m) -> (#TupleRep ([] RuntimeRep), LiftedRep, State# (PrimState m), a#) #
Run a Prim monad from a dedicated state#
primVarNew :: a -> m (PrimVar m a) #
Build a new variable in the Prim Monad
primVarRead :: PrimVar m a -> m a #
Read the variable in the Prim Monad
primVarWrite :: PrimVar m a -> a -> m () #
Write the variable in the Prim Monad
endianess
Class of types that can be byte-swapped.
e.g. Word16, Word32, Word64
byteSwap
Little Endian value
Eq a => Eq (LE a) | |
(ByteSwap a, Ord a) => Ord (LE a) | |
Show a => Show (LE a) | |
Bits a => Bits (LE a) | |
NormalForm a => NormalForm (LE a) | |
PrimType a => PrimType (LE a) | |
PrimMemoryComparable a => PrimMemoryComparable (LE a) | |
StorableFixed (LE Word16) Source # | |
StorableFixed (LE Word32) Source # | |
StorableFixed (LE Word64) Source # | |
StorableFixed (LE Word256) Source # | |
StorableFixed (LE Word128) Source # | |
Storable (LE Word16) Source # | |
Storable (LE Word32) Source # | |
Storable (LE Word64) Source # | |
Storable (LE Word256) Source # | |
Storable (LE Word128) Source # | |
type PrimSize (LE a) | |
Big Endian value
Eq a => Eq (BE a) | |
(ByteSwap a, Ord a) => Ord (BE a) | |
Show a => Show (BE a) | |
Bits a => Bits (BE a) | |
NormalForm a => NormalForm (BE a) | |
PrimType a => PrimType (BE a) | |
PrimMemoryComparable a => PrimMemoryComparable (BE a) | |
StorableFixed (BE Word16) Source # | |
StorableFixed (BE Word32) Source # | |
StorableFixed (BE Word64) Source # | |
StorableFixed (BE Word256) Source # | |
StorableFixed (BE Word128) Source # | |
Storable (BE Word16) Source # | |
Storable (BE Word32) Source # | |
Storable (BE Word64) Source # | |
Storable (BE Word256) Source # | |
Storable (BE Word128) Source # | |
type PrimSize (BE a) | |
Integral convertion
class IntegralUpsize a b where #
Upsize an integral value
The destination type b
size need to be greater or equal
than the size type of a
integralUpsize :: a -> b #
class IntegralDownsize a b where #
Downsize an integral value
integralDownsize :: a -> b #
integralDownsizeCheck :: a -> Maybe b #
Evaluation
class NormalForm a where #
Data that can be fully evaluated in Normal Form
toNormalForm :: a -> () #
force :: NormalForm a => a -> a #
deepseq :: NormalForm a => a -> b -> b #
These
Block of memory
A block of memory containing unpacked bytes representing values of type ty
PrimType ty => IsList (Block ty) | |
(PrimType ty, Eq ty) => Eq (Block ty) | |
Data ty => Data (Block ty) | |
(PrimType ty, Ord ty) => Ord (Block ty) | |
(PrimType ty, Show ty) => Show (Block ty) | |
PrimType ty => Semigroup (Block ty) | |
PrimType ty => Monoid (Block ty) | |
NormalForm (Block ty) | |
PrimType ty => Copy (Block ty) Source # | |
PrimType ty => Collection (Block ty) Source # | |
PrimType ty => Fold1able (Block ty) Source # | |
PrimType ty => Foldable (Block ty) Source # | |
PrimType ty => IndexedCollection (Block ty) Source # | |
PrimType ty => Sequential (Block ty) Source # | |
PrimType ty => From (Array ty) (Block ty) | |
PrimType ty => From (UArray ty) (Block ty) | |
PrimType ty => From (Block ty) (UArray ty) | |
Cast (Block a) (Block Word8) | |
(NatWithinBound (CountOf ty) n, KnownNat n, PrimType ty) => TryFrom (Block ty) (BlockN n ty) | |
From (BlockN n ty) (Block ty) | |
type Item (Block ty) | |
type Element (Block ty) Source # | |
data MutableBlock ty st :: * -> * -> * #
A Mutable block of memory containing unpacked bytes representing values of type ty
PrimType ty => MutableCollection (MutableBlock ty) Source # | |
type MutableFreezed (MutableBlock ty) Source # | |
type MutableKey (MutableBlock ty) Source # | |
type MutableValue (MutableBlock ty) Source # | |
Ascii
ASCII value between 0x0 and 0x7f
data AsciiString :: * #
Opaque packed array of characters in the ASCII encoding