derive-storable-0.2.0.0: Derive Storable instances with GHC.Generics.

Copyright(c) Mateusz Kłoczko 2016
LicenseMIT
Maintainermateusz.p.kloczko@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Foreign.Storable.Generic

Contents

Description

 
Synopsis

Documentation

class GStorable a where Source #

The class uses the default Generic based implementations to provide Storable instances for types made from primitive types. Sum types work with sumtypes cabal flag enabled - or just with -DGSTORABLE_SUMTYPES cpp flag.

Minimal complete definition

Nothing

Methods

gsizeOf Source #

Arguments

:: a

Element of a given type. Can be undefined.

-> Int

Size.

Calculate the size of the type.

galignment Source #

Arguments

:: a

Element of a given type. Can be undefined

-> Int

Alignment.

Calculate the alignment of the type.

gpeekByteOff Source #

Arguments

:: Ptr b

Pointer to the variable

-> Int

Offset

-> IO a

Returned variable.

Read the variable from a given pointer.

gpokeByteOff Source #

Arguments

:: Ptr b

Pointer to the variable.

-> Int

Offset.

-> a

The variable

-> IO () 

Write the variable to a pointer.

gsizeOf Source #

Arguments

:: (ConstraintsSize a, GStorableChoice a) 
=> a

Element of a given type. Can be undefined.

-> Int

Size.

Calculate the size of the type.

galignment Source #

Arguments

:: (ConstraintsAlignment a, GStorableChoice a) 
=> a

Element of a given type. Can be undefined

-> Int

Alignment.

Calculate the alignment of the type.

gpeekByteOff Source #

Arguments

:: (GStorableChoice a, ConstraintsPeek a) 
=> Ptr b

Pointer to the variable

-> Int

Offset

-> IO a

Returned variable.

Read the variable from a given pointer.

gpokeByteOff Source #

Arguments

:: (GStorableChoice a, ConstraintsPoke a) 
=> Ptr b

Pointer to the variable.

-> Int

Offset.

-> a

The variable

-> IO () 

Write the variable to a pointer.

Instances
GStorable Bool Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Char Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Double Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Float Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Int Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Int8 Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Int16 Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Int32 Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Int64 Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Word Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Word8 Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Word16 Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Word32 Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Word64 Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CDev Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CIno Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CMode Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable COff Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CPid Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CSsize Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CGid Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CNlink Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CUid Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CCc Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CSpeed Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CTcflag Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CRLim Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Fd Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

Methods

gsizeOf :: Fd -> Int Source #

galignment :: Fd -> Int Source #

gpeekByteOff :: Ptr b -> Int -> IO Fd Source #

gpokeByteOff :: Ptr b -> Int -> Fd -> IO () Source #

GStorable CChar Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CSChar Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CUChar Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CShort Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CUShort Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CInt Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CUInt Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CLong Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CULong Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CLLong Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CULLong Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CFloat Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CDouble Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CPtrdiff Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CSigAtomic Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CClock Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CTime Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CUSeconds Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CSUSeconds Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CIntMax Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable CUIntMax Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable WordPtr Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable IntPtr Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable Fingerprint Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable (StablePtr a) Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

GStorable (Ptr a) Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

Methods

gsizeOf :: Ptr a -> Int Source #

galignment :: Ptr a -> Int Source #

gpeekByteOff :: Ptr b -> Int -> IO (Ptr a) Source #

gpokeByteOff :: Ptr b -> Int -> Ptr a -> IO () Source #

GStorable (FunPtr a) Source # 
Instance details

Defined in Foreign.Storable.Generic.Instances

Methods

gsizeOf :: FunPtr a -> Int Source #

galignment :: FunPtr a -> Int Source #

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

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

class Storable a where #

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)

Methods

sizeOf :: a -> Int #

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

alignment :: 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.

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

Read a value from a memory area regarded as an array of values of the same kind. The first argument specifies the start address of the array and the second the index into the array (the first element of the array has index 0). The following equality holds,

peekElemOff addr idx = IOExts.fixIO $ \result ->
  peek (addr `plusPtr` (idx * sizeOf result))

Note that this is only a specification, not necessarily the concrete implementation of the function.

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

Write a value to a memory area regarded as an array of values of the same kind. The following equality holds:

pokeElemOff addr idx x = 
  poke (addr `plusPtr` (idx * sizeOf x)) x

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

Read a value from a memory location given by a base address and offset. The following equality holds:

peekByteOff addr off = peek (addr `plusPtr` off)

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

Write a value to a memory location given by a base address and offset. The following equality holds:

pokeByteOff addr off x = poke (addr `plusPtr` off) x

peek :: 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 :: Ptr a -> a -> IO () #

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

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 () #

GStorable a => Storable a Source # 
Instance details

Defined in Foreign.Storable.Generic

Methods

sizeOf :: a -> Int #

alignment :: a -> Int #

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

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

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

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

peek :: Ptr a -> IO a #

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

Storable CDev 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CDev -> Int #

alignment :: CDev -> Int #

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

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

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

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

peek :: Ptr CDev -> IO CDev #

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

Storable CIno 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CIno -> Int #

alignment :: CIno -> Int #

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

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

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

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

peek :: Ptr CIno -> IO CIno #

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

Storable CMode 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CMode -> Int #

alignment :: CMode -> Int #

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

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

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

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

peek :: Ptr CMode -> IO CMode #

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

Storable COff 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: COff -> Int #

alignment :: COff -> Int #

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

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

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

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

peek :: Ptr COff -> IO COff #

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

Storable CPid 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CPid -> Int #

alignment :: CPid -> Int #

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

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

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

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

peek :: Ptr CPid -> IO CPid #

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

Storable CSsize 
Instance details

Defined in System.Posix.Types

Storable CGid 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CGid -> Int #

alignment :: CGid -> Int #

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

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

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

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

peek :: Ptr CGid -> IO CGid #

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

Storable CNlink 
Instance details

Defined in System.Posix.Types

Storable CUid 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CUid -> Int #

alignment :: CUid -> Int #

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

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

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

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

peek :: Ptr CUid -> IO CUid #

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

Storable CCc 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CCc -> Int #

alignment :: CCc -> Int #

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

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

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

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

peek :: Ptr CCc -> IO CCc #

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

Storable CSpeed 
Instance details

Defined in System.Posix.Types

Storable CTcflag 
Instance details

Defined in System.Posix.Types

Storable CRLim 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CRLim -> Int #

alignment :: CRLim -> Int #

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

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

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

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

peek :: Ptr CRLim -> IO CRLim #

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

Storable CBlkSize 
Instance details

Defined in System.Posix.Types

Storable CBlkCnt 
Instance details

Defined in System.Posix.Types

Storable CClockId 
Instance details

Defined in System.Posix.Types

Storable CFsBlkCnt 
Instance details

Defined in System.Posix.Types

Storable CFsFilCnt 
Instance details

Defined in System.Posix.Types

Storable CId 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CId -> Int #

alignment :: CId -> Int #

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

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

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

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

peek :: Ptr CId -> IO CId #

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

Storable CKey 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CKey -> Int #

alignment :: CKey -> Int #

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

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

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

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

peek :: Ptr CKey -> IO CKey #

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

Storable CTimer 
Instance details

Defined in System.Posix.Types

Storable Fd 
Instance details

Defined in System.Posix.Types

Methods

sizeOf :: Fd -> Int #

alignment :: Fd -> Int #

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

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

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

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

peek :: Ptr Fd -> IO Fd #

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

Storable CChar 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CChar -> Int #

alignment :: CChar -> Int #

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

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

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

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

peek :: Ptr CChar -> IO CChar #

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

Storable CSChar 
Instance details

Defined in Foreign.C.Types

Storable CUChar 
Instance details

Defined in Foreign.C.Types

Storable CShort 
Instance details

Defined in Foreign.C.Types

Storable CUShort 
Instance details

Defined in Foreign.C.Types

Storable CInt 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CInt -> Int #

alignment :: CInt -> Int #

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

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

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

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

peek :: Ptr CInt -> IO CInt #

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

Storable CUInt 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CUInt -> Int #

alignment :: CUInt -> Int #

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

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

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

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

peek :: Ptr CUInt -> IO CUInt #

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

Storable CLong 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CLong -> Int #

alignment :: CLong -> Int #

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

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

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

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

peek :: Ptr CLong -> IO CLong #

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

Storable CULong 
Instance details

Defined in Foreign.C.Types

Storable CLLong 
Instance details

Defined in Foreign.C.Types

Storable CULLong 
Instance details

Defined in Foreign.C.Types

Storable CBool 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CBool -> Int #

alignment :: CBool -> Int #

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

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

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

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

peek :: Ptr CBool -> IO CBool #

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

Storable CFloat 
Instance details

Defined in Foreign.C.Types

Storable CDouble 
Instance details

Defined in Foreign.C.Types

Storable CPtrdiff 
Instance details

Defined in Foreign.C.Types

Storable CSize 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CSize -> Int #

alignment :: CSize -> Int #

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

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

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

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

peek :: Ptr CSize -> IO CSize #

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

Storable CWchar 
Instance details

Defined in Foreign.C.Types

Storable CSigAtomic 
Instance details

Defined in Foreign.C.Types

Storable CClock 
Instance details

Defined in Foreign.C.Types

Storable CTime 
Instance details

Defined in Foreign.C.Types

Methods

sizeOf :: CTime -> Int #

alignment :: CTime -> Int #

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

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

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

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

peek :: Ptr CTime -> IO CTime #

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

Storable CUSeconds 
Instance details

Defined in Foreign.C.Types

Storable CSUSeconds 
Instance details

Defined in Foreign.C.Types

Storable CIntPtr 
Instance details

Defined in Foreign.C.Types

Storable CUIntPtr 
Instance details

Defined in Foreign.C.Types

Storable CIntMax 
Instance details

Defined in Foreign.C.Types

Storable CUIntMax 
Instance details

Defined in Foreign.C.Types

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 () #

Orphan instances

GStorable a => Storable a Source # 
Instance details

Methods

sizeOf :: a -> Int #

alignment :: a -> Int #

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

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

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

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

peek :: Ptr a -> IO a #

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