haskell-gi-base-0.24.4: Foundation for libraries generated by haskell-gi

Safe HaskellNone
LanguageHaskell2010

Data.GI.Base.BasicTypes

Contents

Description

Basic types used in the bindings.

Synopsis

Memory management

data ManagedPtr a Source #

Thin wrapper over ForeignPtr, supporting the extra notion of disowning, that is, not running the finalizers associated with the foreign ptr.

Constructors

ManagedPtr 

Fields

Instances
Eq (ManagedPtr a) Source #

Two ManagedPtrs are equal if they wrap the same underlying C Ptr.

Instance details

Methods

(==) :: ManagedPtr a -> ManagedPtr a -> Bool #

(/=) :: ManagedPtr a -> ManagedPtr a -> Bool #

class Coercible a (ManagedPtr ()) => ManagedPtrNewtype a where Source #

A constraint ensuring that the given type is a newtype over a ManagedPtr.

Minimal complete definition

toManagedPtr

Methods

toManagedPtr :: a -> ManagedPtr a Source #

Instances
Coercible a (ManagedPtr ()) => ManagedPtrNewtype a Source #

A default instance for IsManagedPtr for newtypes over ManagedPtr.

Instance details

Methods

toManagedPtr :: a -> ManagedPtr a Source #

class ManagedPtrNewtype a => BoxedPtr a where Source #

Pointers to chunks of memory which we know how to copy and release.

Minimal complete definition

boxedPtrCopy, boxedPtrFree

Methods

boxedPtrCopy :: a -> IO a Source #

Make a copy of the given BoxedPtr.

boxedPtrFree :: a -> IO () Source #

A pointer to a function for freeing the given pointer.

class BoxedPtr a => CallocPtr a where Source #

A ptr to a memory block which we know how to allocate and fill with zero.

Minimal complete definition

boxedPtrCalloc

Methods

boxedPtrCalloc :: IO (Ptr a) Source #

Allocate a zero-initialized block of memory for the given type.

data UnexpectedNullPointerReturn Source #

A common omission in the introspection data is missing (nullable) annotations for return types, when they clearly are nullable. (A common idiom is "Returns: valid value, or %NULL if something went wrong.")

Haskell wrappers will raise this exception if the return value is an unexpected nullPtr.

Basic GLib / GObject types

class HasParentTypes a => TypedObject a where Source #

A wrapped object that has an associated GLib type. This does not necessarily descend from GObject, that constraint is implemented by GObject below.

Minimal complete definition

glibType

Methods

glibType :: IO GType Source #

The GType for this object.

Instances
TypedObject GValue Source #

Find the associated GType for GValue.

Instance details
TypedObject GError Source # 
Instance details
TypedObject (GClosure a) Source #

Find the associated GType for the given closure.

Instance details

class (ManagedPtrNewtype a, TypedObject a) => GObject a Source #

A wrapped GObject, or any other type that descends from it.

newtype GType Source #

A newtype for use on the Haskell side.

Constructors

GType 
Instances
Eq GType Source # 
Instance details

Methods

(==) :: GType -> GType -> Bool #

(/=) :: GType -> GType -> Bool #

Show GType Source # 
Instance details

Methods

showsPrec :: Int -> GType -> ShowS #

show :: GType -> String #

showList :: [GType] -> ShowS #

IsGValue GType Source # 
Instance details

type CGType = Word64 Source #

A type identifier in the GLib type system. This is the low-level type associated with the representation in memory, when using this on the Haskell side use GType below.

gtypeName :: GType -> IO String Source #

Get the name assigned to the given GType.

class (ManagedPtrNewtype a, TypedObject a) => GBoxed a Source #

Chunks of memory whose allocation/deallocation info has been registered with the GLib type system.

Instances
GBoxed GValue Source #

GValues are registered as boxed in the GLib type system.

Instance details
GBoxed GError Source #

GErrors are registered as boxed in the GLib type system.

Instance details
GBoxed (GClosure a) Source #

GClosures are registered as boxed in the GLib type system.

Instance details

class TypedObject a => BoxedEnum a Source #

Enums with an associated GType.

class TypedObject a => BoxedFlags a Source #

Flags with an associated GType.

newtype GParamSpec Source #

A GParamSpec. See Data.GI.Base.GParamSpec for further methods.

noGParamSpec :: Maybe GParamSpec Source #

A convenient synonym for Nothing :: Maybe GParamSpec.

data GArray a Source #

A GArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is mapped to a list on the Haskell side.

Constructors

GArray (Ptr (GArray a)) 

data GPtrArray a Source #

A GPtrArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is mapped to a list on the Haskell side.

Constructors

GPtrArray (Ptr (GPtrArray a)) 

data GByteArray Source #

A GByteArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is packed to a ByteString on the Haskell side.

Constructors

GByteArray (Ptr GByteArray) 

data GHashTable a b Source #

A GHashTable. It is mapped to a Map on the Haskell side.

Constructors

GHashTable (Ptr (GHashTable a b)) 

data GList a Source #

A GList, mapped to a list on the Haskell side. Marshalling is done in Data.GI.Base.BasicConversions.

Constructors

GList (Ptr (GList a)) 

g_list_free :: Ptr (GList a) -> IO () Source #

Free the given GList.

data GSList a Source #

A GSList, mapped to a list on the Haskell side. Marshalling is done in Data.GI.Base.BasicConversions.

Constructors

GSList (Ptr (GSList a)) 

g_slist_free :: Ptr (GSList a) -> IO () Source #

Free the given GSList.

class Enum a => IsGFlag a Source #

An enum usable as a flag for a function.

Instances
IsGFlag GParamFlag Source # 
Instance details

newtype PtrWrapped a Source #

Some APIs, such as GHashTable, pass around scalar types wrapped into a pointer. We encode such a type as follows.

Constructors

PtrWrapped 

Fields

type GDestroyNotify a = FunPtr (Ptr a -> IO ()) Source #

Destroy the memory associated with a given pointer.