foundation-0.0.13: Alternative prelude with batteries and no dependencies

LicenseBSD-style
MaintainerHaskell Foundation
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Foundation.Class.Storable

Contents

Description

Synopsis

Documentation

Ptr

data Ptr a :: * -> *

A value of type Ptr a represents a pointer to an object, or an array of objects, which may be marshalled to or from Haskell values of type a.

The type a will often be an instance of class Storable which provides the marshalling operations. However this is not essential, and you can provide your own operations to access the pointer. For example you might write small foreign functions to get or set the fields of a C struct.

Instances

Eq (Ptr a) 
(Data a, Typeable * a) => Data (Ptr a) 
Ord (Ptr a) 
Show (Ptr a) 
Storable (Ptr a) 
NormalForm (Ptr a) 
StorableFixed (Ptr a) 
Storable (Ptr a) 

plusPtr :: StorableFixed a => Ptr a -> CountOf a -> Ptr a

castPtr :: Ptr a -> Ptr b

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

offset based helper

peekOff :: StorableFixed a => Ptr a -> Offset a -> IO a

like peek but at a given offset.

pokeOff :: StorableFixed a => Ptr a -> Offset a -> a -> IO ()

like poke but at a given offset.

Collection

peekArray :: (Buildable col, StorableFixed (Element col)) => CountOf (Element col) -> Ptr (Element col) -> IO col

peekArrayEndedBy :: (Buildable col, StorableFixed (Element col), Eq (Element col), Show (Element col)) => Element col -> Ptr (Element col) -> IO col

pokeArray :: (Sequential col, StorableFixed (Element col)) => Ptr (Element col) -> col -> IO ()

pokeArrayEndedBy :: (Sequential col, StorableFixed (Element col)) => Element col -> Ptr (Element col) -> col -> IO ()