C-structs-0.1.0.1: C-Structs implementation for Haskell

Copyright(c) Simon Plakolb 2020
LicenseMIT
Maintainers.plakolb@gmail.com
Stabilitybeta
Safe HaskellNone
LanguageHaskell2010

Foreign.C.Structs

Description

The Foreign.C.Structs module allows you to construct C structs of arbitrary Storable types.

Synopsis

Documentation

data Struct2 a b Source #

A Struct2 can hold two records of any Storable types a and b. It is itself an instance of Storable and can be used inside a Ptr. The Struct2 constructor takes two arguments. The record functions s21st and s22nd provide access to the fields values.

Constructors

Struct2 

Fields

Instances
(Eq a, Eq b) => Eq (Struct2 a b) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

(==) :: Struct2 a b -> Struct2 a b -> Bool #

(/=) :: Struct2 a b -> Struct2 a b -> Bool #

(Show a, Show b) => Show (Struct2 a b) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

showsPrec :: Int -> Struct2 a b -> ShowS #

show :: Struct2 a b -> String #

showList :: [Struct2 a b] -> ShowS #

(Storable a, Storable b) => Storable (Struct2 a b) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct2 a b -> Int #

alignment :: Struct2 a b -> Int #

peekElemOff :: Ptr (Struct2 a b) -> Int -> IO (Struct2 a b) #

pokeElemOff :: Ptr (Struct2 a b) -> Int -> Struct2 a b -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct2 a b) #

pokeByteOff :: Ptr b0 -> Int -> Struct2 a b -> IO () #

peek :: Ptr (Struct2 a b) -> IO (Struct2 a b) #

poke :: Ptr (Struct2 a b) -> Struct2 a b -> IO () #

data Struct3 a b c Source #

A Struct3 can hold three records of any Storable types a, b and c. It is itself an instance of Storable and can be used inside a Ptr. The Struct3 constructor takes three arguments. The record functions s31st, s32nd and s33rd provide access to the fields values.

Constructors

Struct3 

Fields

Instances
(Eq a, Eq b, Eq c) => Eq (Struct3 a b c) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

(==) :: Struct3 a b c -> Struct3 a b c -> Bool #

(/=) :: Struct3 a b c -> Struct3 a b c -> Bool #

(Show a, Show b, Show c) => Show (Struct3 a b c) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

showsPrec :: Int -> Struct3 a b c -> ShowS #

show :: Struct3 a b c -> String #

showList :: [Struct3 a b c] -> ShowS #

(Storable a, Storable b, Storable c) => Storable (Struct3 a b c) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct3 a b c -> Int #

alignment :: Struct3 a b c -> Int #

peekElemOff :: Ptr (Struct3 a b c) -> Int -> IO (Struct3 a b c) #

pokeElemOff :: Ptr (Struct3 a b c) -> Int -> Struct3 a b c -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct3 a b c) #

pokeByteOff :: Ptr b0 -> Int -> Struct3 a b c -> IO () #

peek :: Ptr (Struct3 a b c) -> IO (Struct3 a b c) #

poke :: Ptr (Struct3 a b c) -> Struct3 a b c -> IO () #

data Struct4 a b c d Source #

A Struct4 can hold four records of any Storable types a, b, c and d. It is itself an instance of Storable and can be used inside a Ptr. The Struct4 constructor takes four arguments. The record functions s41st, s42nd, s43rd and s44th provide access to the fields values.

Constructors

Struct4 

Fields

Instances
(Eq a, Eq b, Eq c, Eq d) => Eq (Struct4 a b c d) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

(==) :: Struct4 a b c d -> Struct4 a b c d -> Bool #

(/=) :: Struct4 a b c d -> Struct4 a b c d -> Bool #

(Show a, Show b, Show c, Show d) => Show (Struct4 a b c d) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

showsPrec :: Int -> Struct4 a b c d -> ShowS #

show :: Struct4 a b c d -> String #

showList :: [Struct4 a b c d] -> ShowS #

(Storable a, Storable b, Storable c, Storable d) => Storable (Struct4 a b c d) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct4 a b c d -> Int #

alignment :: Struct4 a b c d -> Int #

peekElemOff :: Ptr (Struct4 a b c d) -> Int -> IO (Struct4 a b c d) #

pokeElemOff :: Ptr (Struct4 a b c d) -> Int -> Struct4 a b c d -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct4 a b c d) #

pokeByteOff :: Ptr b0 -> Int -> Struct4 a b c d -> IO () #

peek :: Ptr (Struct4 a b c d) -> IO (Struct4 a b c d) #

poke :: Ptr (Struct4 a b c d) -> Struct4 a b c d -> IO () #

data Struct5 a b c d e Source #

A Struct5 can hold five records of any Storable types a, b, c, d and e. It is itself an instance of Storable and can be used inside a Ptr. The Struct5 constructor takes five arguments. The record functions s51st, s52nd, s53rd, s54th and s55th provide access to the fields values.

Constructors

Struct5 

Fields

Instances
(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (Struct5 a b c d e) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

(==) :: Struct5 a b c d e -> Struct5 a b c d e -> Bool #

(/=) :: Struct5 a b c d e -> Struct5 a b c d e -> Bool #

(Show a, Show b, Show c, Show d, Show e) => Show (Struct5 a b c d e) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

showsPrec :: Int -> Struct5 a b c d e -> ShowS #

show :: Struct5 a b c d e -> String #

showList :: [Struct5 a b c d e] -> ShowS #

(Storable a, Storable b, Storable c, Storable d, Storable e) => Storable (Struct5 a b c d e) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct5 a b c d e -> Int #

alignment :: Struct5 a b c d e -> Int #

peekElemOff :: Ptr (Struct5 a b c d e) -> Int -> IO (Struct5 a b c d e) #

pokeElemOff :: Ptr (Struct5 a b c d e) -> Int -> Struct5 a b c d e -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct5 a b c d e) #

pokeByteOff :: Ptr b0 -> Int -> Struct5 a b c d e -> IO () #

peek :: Ptr (Struct5 a b c d e) -> IO (Struct5 a b c d e) #

poke :: Ptr (Struct5 a b c d e) -> Struct5 a b c d e -> IO () #

data Struct6 a b c d e f Source #

A Struct6 can hold six records of any Storable types a, b, c, d, e and f. It is itself an instance of Storable and can be used inside a Ptr. The Struct6 constructor takes six arguments. The record functions s61st, s62nd, s63rd, s64th, s65th and s66th provide access to the fields values.

Constructors

Struct6 

Fields

Instances
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (Struct6 a b c d e f) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

(==) :: Struct6 a b c d e f -> Struct6 a b c d e f -> Bool #

(/=) :: Struct6 a b c d e f -> Struct6 a b c d e f -> Bool #

(Show a, Show b, Show c, Show d, Show e, Show f) => Show (Struct6 a b c d e f) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

showsPrec :: Int -> Struct6 a b c d e f -> ShowS #

show :: Struct6 a b c d e f -> String #

showList :: [Struct6 a b c d e f] -> ShowS #

(Storable a, Storable b, Storable c, Storable d, Storable e, Storable f) => Storable (Struct6 a b c d e f) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct6 a b c d e f -> Int #

alignment :: Struct6 a b c d e f -> Int #

peekElemOff :: Ptr (Struct6 a b c d e f) -> Int -> IO (Struct6 a b c d e f) #

pokeElemOff :: Ptr (Struct6 a b c d e f) -> Int -> Struct6 a b c d e f -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct6 a b c d e f) #

pokeByteOff :: Ptr b0 -> Int -> Struct6 a b c d e f -> IO () #

peek :: Ptr (Struct6 a b c d e f) -> IO (Struct6 a b c d e f) #

poke :: Ptr (Struct6 a b c d e f) -> Struct6 a b c d e f -> IO () #

structT :: Int -> DecsQ Source #

All StructN types and their instances of Storable are declared using structT. It can theoretically create C structs with an infinite number of fields. The parameter of structT is the number of fields the struct type should have. Its constructor and type will both be named StructN where N is equal to the argument to structT.

acs :: Int -> Int -> ExpQ Source #

Access function for fields of a StructN where N is the number of fields in the struct. N is the first argument passed to acs, while the second is the field number. The first field has number 1, the second 2 and so on.

s = Struct4 1 2 3 4
$(acs 4 3) s

next :: (Storable a, Storable b, Storable c) => Ptr a -> b -> IO (Ptr c) Source #

Jumps to the next pointer location in the struct.

sizeof :: [Int] -> [Int] -> Int Source #

Due to alignment constraints the size of C structs is dependent on the order of fields and their respectible sizes. The function sizeof can calculate the resulting size given a list of all alignments and sizes.

fmax :: Integral a => [a] -> a Source #

Alias for foldr max 0.

class Storable a #

The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.

Memory addresses are represented as values of type Ptr a, for some a which is an instance of class Storable. The type argument to Ptr helps provide some valuable type safety in FFI code (you can't mix pointers of different types without an explicit cast), while helping the Haskell type system figure out which marshalling method is needed for a given pointer.

All marshalling between Haskell and a foreign language ultimately boils down to translating Haskell data structures into the binary representation of a corresponding data structure of the foreign language and vice versa. To code this marshalling in Haskell, it is necessary to manipulate primitive data types stored in unstructured memory blocks. The class Storable facilitates this manipulation on all types for which it is instantiated, which are the standard basic types of Haskell, the fixed size Int types (Int8, Int16, Int32, Int64), the fixed size Word types (Word8, Word16, Word32, Word64), StablePtr, all types from Foreign.C.Types, as well as Ptr.

Minimal complete definition

sizeOf, alignment, (peek | peekElemOff | peekByteOff), (poke | pokeElemOff | pokeByteOff)

Instances
Storable Bool

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Bool -> Int #

alignment :: Bool -> Int #

peekElemOff :: Ptr Bool -> Int -> IO Bool #

pokeElemOff :: Ptr Bool -> Int -> Bool -> IO () #

peekByteOff :: Ptr b -> Int -> IO Bool #

pokeByteOff :: Ptr b -> Int -> Bool -> IO () #

peek :: Ptr Bool -> IO Bool #

poke :: Ptr Bool -> Bool -> IO () #

Storable Char

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Char -> Int #

alignment :: Char -> Int #

peekElemOff :: Ptr Char -> Int -> IO Char #

pokeElemOff :: Ptr Char -> Int -> Char -> IO () #

peekByteOff :: Ptr b -> Int -> IO Char #

pokeByteOff :: Ptr b -> Int -> Char -> IO () #

peek :: Ptr Char -> IO Char #

poke :: Ptr Char -> Char -> IO () #

Storable Double

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Float

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Float -> Int #

alignment :: Float -> Int #

peekElemOff :: Ptr Float -> Int -> IO Float #

pokeElemOff :: Ptr Float -> Int -> Float -> IO () #

peekByteOff :: Ptr b -> Int -> IO Float #

pokeByteOff :: Ptr b -> Int -> Float -> IO () #

peek :: Ptr Float -> IO Float #

poke :: Ptr Float -> Float -> IO () #

Storable Int

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int -> Int #

alignment :: Int -> Int #

peekElemOff :: Ptr Int -> Int -> IO Int #

pokeElemOff :: Ptr Int -> Int -> Int -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int #

pokeByteOff :: Ptr b -> Int -> Int -> IO () #

peek :: Ptr Int -> IO Int #

poke :: Ptr Int -> Int -> IO () #

Storable Int8

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int8 -> Int #

alignment :: Int8 -> Int #

peekElemOff :: Ptr Int8 -> Int -> IO Int8 #

pokeElemOff :: Ptr Int8 -> Int -> Int8 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int8 #

pokeByteOff :: Ptr b -> Int -> Int8 -> IO () #

peek :: Ptr Int8 -> IO Int8 #

poke :: Ptr Int8 -> Int8 -> IO () #

Storable Int16

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int16 -> Int #

alignment :: Int16 -> Int #

peekElemOff :: Ptr Int16 -> Int -> IO Int16 #

pokeElemOff :: Ptr Int16 -> Int -> Int16 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int16 #

pokeByteOff :: Ptr b -> Int -> Int16 -> IO () #

peek :: Ptr Int16 -> IO Int16 #

poke :: Ptr Int16 -> Int16 -> IO () #

Storable Int32

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int32 -> Int #

alignment :: Int32 -> Int #

peekElemOff :: Ptr Int32 -> Int -> IO Int32 #

pokeElemOff :: Ptr Int32 -> Int -> Int32 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int32 #

pokeByteOff :: Ptr b -> Int -> Int32 -> IO () #

peek :: Ptr Int32 -> IO Int32 #

poke :: Ptr Int32 -> Int32 -> IO () #

Storable Int64

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Int64 -> Int #

alignment :: Int64 -> Int #

peekElemOff :: Ptr Int64 -> Int -> IO Int64 #

pokeElemOff :: Ptr Int64 -> Int -> Int64 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Int64 #

pokeByteOff :: Ptr b -> Int -> Int64 -> IO () #

peek :: Ptr Int64 -> IO Int64 #

poke :: Ptr Int64 -> Int64 -> IO () #

Storable Word

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Word -> Int #

alignment :: Word -> Int #

peekElemOff :: Ptr Word -> Int -> IO Word #

pokeElemOff :: Ptr Word -> Int -> Word -> IO () #

peekByteOff :: Ptr b -> Int -> IO Word #

pokeByteOff :: Ptr b -> Int -> Word -> IO () #

peek :: Ptr Word -> IO Word #

poke :: Ptr Word -> Word -> IO () #

Storable Word8

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Word8 -> Int #

alignment :: Word8 -> Int #

peekElemOff :: Ptr Word8 -> Int -> IO Word8 #

pokeElemOff :: Ptr Word8 -> Int -> Word8 -> IO () #

peekByteOff :: Ptr b -> Int -> IO Word8 #

pokeByteOff :: Ptr b -> Int -> Word8 -> IO () #

peek :: Ptr Word8 -> IO Word8 #

poke :: Ptr Word8 -> Word8 -> IO () #

Storable Word16

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Word32

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable Word64

Since: base-2.1

Instance details

Defined in Foreign.Storable

Storable ()

Since: base-4.9.0.0

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: () -> Int #

alignment :: () -> Int #

peekElemOff :: Ptr () -> Int -> IO () #

pokeElemOff :: Ptr () -> Int -> () -> IO () #

peekByteOff :: Ptr b -> Int -> IO () #

pokeByteOff :: Ptr b -> Int -> () -> IO () #

peek :: Ptr () -> IO () #

poke :: Ptr () -> () -> IO () #

Storable WordPtr 
Instance details

Defined in Foreign.Ptr

Storable IntPtr 
Instance details

Defined in Foreign.Ptr

Storable Fingerprint

Since: base-4.4.0.0

Instance details

Defined in Foreign.Storable

(Storable a, Integral a) => Storable (Ratio a)

Since: base-4.8.0.0

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Ratio a -> Int #

alignment :: Ratio a -> Int #

peekElemOff :: Ptr (Ratio a) -> Int -> IO (Ratio a) #

pokeElemOff :: Ptr (Ratio a) -> Int -> Ratio a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Ratio a) #

pokeByteOff :: Ptr b -> Int -> Ratio a -> IO () #

peek :: Ptr (Ratio a) -> IO (Ratio a) #

poke :: Ptr (Ratio a) -> Ratio a -> IO () #

Storable (StablePtr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: StablePtr a -> Int #

alignment :: StablePtr a -> Int #

peekElemOff :: Ptr (StablePtr a) -> Int -> IO (StablePtr a) #

pokeElemOff :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (StablePtr a) #

pokeByteOff :: Ptr b -> Int -> StablePtr a -> IO () #

peek :: Ptr (StablePtr a) -> IO (StablePtr a) #

poke :: Ptr (StablePtr a) -> StablePtr a -> IO () #

Storable (Ptr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Ptr a -> Int #

alignment :: Ptr a -> Int #

peekElemOff :: Ptr (Ptr a) -> Int -> IO (Ptr a) #

pokeElemOff :: Ptr (Ptr a) -> Int -> Ptr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Ptr a) #

pokeByteOff :: Ptr b -> Int -> Ptr a -> IO () #

peek :: Ptr (Ptr a) -> IO (Ptr a) #

poke :: Ptr (Ptr a) -> Ptr a -> IO () #

Storable (FunPtr a)

Since: base-2.1

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: FunPtr a -> Int #

alignment :: FunPtr a -> Int #

peekElemOff :: Ptr (FunPtr a) -> Int -> IO (FunPtr a) #

pokeElemOff :: Ptr (FunPtr a) -> Int -> FunPtr a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (FunPtr a) #

pokeByteOff :: Ptr b -> Int -> FunPtr a -> IO () #

peek :: Ptr (FunPtr a) -> IO (FunPtr a) #

poke :: Ptr (FunPtr a) -> FunPtr a -> IO () #

(Storable a, Storable b) => Storable (Struct2 a b) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct2 a b -> Int #

alignment :: Struct2 a b -> Int #

peekElemOff :: Ptr (Struct2 a b) -> Int -> IO (Struct2 a b) #

pokeElemOff :: Ptr (Struct2 a b) -> Int -> Struct2 a b -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct2 a b) #

pokeByteOff :: Ptr b0 -> Int -> Struct2 a b -> IO () #

peek :: Ptr (Struct2 a b) -> IO (Struct2 a b) #

poke :: Ptr (Struct2 a b) -> Struct2 a b -> IO () #

(Storable a, Storable b, Storable c) => Storable (Struct3 a b c) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct3 a b c -> Int #

alignment :: Struct3 a b c -> Int #

peekElemOff :: Ptr (Struct3 a b c) -> Int -> IO (Struct3 a b c) #

pokeElemOff :: Ptr (Struct3 a b c) -> Int -> Struct3 a b c -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct3 a b c) #

pokeByteOff :: Ptr b0 -> Int -> Struct3 a b c -> IO () #

peek :: Ptr (Struct3 a b c) -> IO (Struct3 a b c) #

poke :: Ptr (Struct3 a b c) -> Struct3 a b c -> IO () #

(Storable a, Storable b, Storable c, Storable d) => Storable (Struct4 a b c d) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct4 a b c d -> Int #

alignment :: Struct4 a b c d -> Int #

peekElemOff :: Ptr (Struct4 a b c d) -> Int -> IO (Struct4 a b c d) #

pokeElemOff :: Ptr (Struct4 a b c d) -> Int -> Struct4 a b c d -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct4 a b c d) #

pokeByteOff :: Ptr b0 -> Int -> Struct4 a b c d -> IO () #

peek :: Ptr (Struct4 a b c d) -> IO (Struct4 a b c d) #

poke :: Ptr (Struct4 a b c d) -> Struct4 a b c d -> IO () #

(Storable a, Storable b, Storable c, Storable d, Storable e) => Storable (Struct5 a b c d e) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct5 a b c d e -> Int #

alignment :: Struct5 a b c d e -> Int #

peekElemOff :: Ptr (Struct5 a b c d e) -> Int -> IO (Struct5 a b c d e) #

pokeElemOff :: Ptr (Struct5 a b c d e) -> Int -> Struct5 a b c d e -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct5 a b c d e) #

pokeByteOff :: Ptr b0 -> Int -> Struct5 a b c d e -> IO () #

peek :: Ptr (Struct5 a b c d e) -> IO (Struct5 a b c d e) #

poke :: Ptr (Struct5 a b c d e) -> Struct5 a b c d e -> IO () #

(Storable a, Storable b, Storable c, Storable d, Storable e, Storable f) => Storable (Struct6 a b c d e f) Source # 
Instance details

Defined in Foreign.C.Structs.Types

Methods

sizeOf :: Struct6 a b c d e f -> Int #

alignment :: Struct6 a b c d e f -> Int #

peekElemOff :: Ptr (Struct6 a b c d e f) -> Int -> IO (Struct6 a b c d e f) #

pokeElemOff :: Ptr (Struct6 a b c d e f) -> Int -> Struct6 a b c d e f -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Struct6 a b c d e f) #

pokeByteOff :: Ptr b0 -> Int -> Struct6 a b c d e f -> IO () #

peek :: Ptr (Struct6 a b c d e f) -> IO (Struct6 a b c d e f) #

poke :: Ptr (Struct6 a b c d e f) -> Struct6 a b c d e f -> IO () #

peek :: Storable a => Ptr a -> IO a #

Read a value from the given memory location.

Note that the peek and poke functions might require properly aligned addresses to function correctly. This is architecture dependent; thus, portable code should ensure that when peeking or poking values of some type a, the alignment constraint for a, as given by the function alignment is fulfilled.

poke :: Storable a => Ptr a -> a -> IO () #

Write the given value to the given memory location. Alignment restrictions might apply; see peek.

sizeOf :: Storable a => a -> Int #

Computes the storage requirements (in bytes) of the argument. The value of the argument is not used.

alignment :: Storable a => a -> Int #

Computes the alignment constraint of the argument. An alignment constraint x is fulfilled by any address divisible by x. The value of the argument is not used.

castPtr :: Ptr a -> Ptr b #

The castPtr function casts a pointer from one type to another.