Copyright | (c) Mateusz Kłoczko 2016 |
---|---|
License | MIT |
Maintainer | mateusz.p.kloczko@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- class GStorable' f where
- class GStorable a where
- internalSizeOf :: forall f p. GStorable' f => f p -> Int
- internalAlignment :: forall f p. GStorable' f => f p -> Alignment
- internalPeekByteOff :: forall f p b. GStorable' f => Ptr b -> Offset -> IO (f p)
- internalPokeByteOff :: forall f p b. GStorable' f => Ptr b -> Offset -> f p -> IO ()
- internalOffsets :: forall f p. GStorable' f => f p -> [Offset]
Documentation
class GStorable' f where Source #
gpeekByteOff' :: [Int] -> Int -> Ptr b -> Int -> IO (f a) Source #
Read the element at a given offset. Additional information about the offests of the subfields are needed.
gpokeByteOff' :: [Int] -> Int -> Ptr b -> Int -> f a -> IO () Source #
gnumberOf' :: f a -> Int Source #
Calculates the number of type's/struct's fields.
glistSizeOf' :: f a -> [Size] Source #
Calculates the sizes of type's/struct's fields.
glistAlignment' :: f a -> [Alignment] Source #
Calculates the alignments of type's/struct's fields.
GStorable a => GStorable' (K1 i a) Source # | |
(GStorable' f, GStorable' g) => GStorable' ((:*:) f g) Source # | |
GStorable' f => GStorable' (M1 i t f) Source # | |
class GStorable a where Source #
The class uses the default Generic based implementations to provide Storable instances for types made from primitive types. Does not work on Algebraic Data Types with more than one constructor.
Calculate the size of the type.
gsizeOf :: (Generic a, GStorable' (Rep a)) => a -> Int Source #
Calculate the size of the type.
galignment :: a -> Int Source #
Calculate the alignment of the type.
galignment :: (Generic a, GStorable' (Rep a)) => a -> Int Source #
Calculate the alignment of the type.
gpeekByteOff :: Ptr b -> Int -> IO a Source #
Read the variable from a given pointer.
gpeekByteOff :: (Generic a, GStorable' (Rep a)) => Ptr b -> Int -> IO a Source #
Read the variable from a given pointer.
gpokeByteOff :: Ptr b -> Int -> a -> IO () Source #
Write the variable to a pointer.
gpokeByteOff :: (Generic a, GStorable' (Rep a)) => Ptr b -> Int -> a -> IO () Source #
Write the variable to a pointer.
:: GStorable' f | |
=> f p | Generic representation |
-> Int | Resulting size |
Calculates the size of generic data-type.
:: GStorable' f | |
=> f p | Generic representation |
-> Alignment | Resulting alignment |
Calculates the alignment of generic data-type.
:: GStorable' f | |
=> Ptr b | Pointer to peek |
-> Offset | Offset |
-> IO (f p) | Resulting generic representation |
View the variable under a pointer, with offset.
:: GStorable' f | |
=> Ptr b | Pointer to write to |
-> Offset | Offset |
-> f p | Written generic representation |
-> IO () |
Write the variable under the pointer, with offset.
internalOffsets :: forall f p. GStorable' f => f p -> [Offset] Source #
Obtain the list of offsets