| Safe Haskell | None | 
|---|---|
| Language | Haskell2010 | 
Data.GI.Base.BasicTypes
Description
Basic types used in the bindings.
Synopsis
- data ManagedPtr a = ManagedPtr {}
 - class Coercible a (ManagedPtr ()) => ManagedPtrNewtype a where
- toManagedPtr :: a -> ManagedPtr a
 
 - class ManagedPtrNewtype a => BoxedPtr a where
- boxedPtrCopy :: a -> IO a
 - boxedPtrFree :: a -> IO ()
 
 - class BoxedPtr a => CallocPtr a where
- boxedPtrCalloc :: IO (Ptr a)
 
 - data UnexpectedNullPointerReturn = UnexpectedNullPointerReturn {}
 - class HasParentTypes a => TypedObject a where
 - class (ManagedPtrNewtype a, TypedObject a) => GObject a
 - newtype GType = GType {}
 - type CGType = Word64
 - gtypeName :: GType -> IO String
 - newtype GVariant = GVariant (ManagedPtr GVariant)
 - class (ManagedPtrNewtype a, TypedObject a) => GBoxed a
 - class TypedObject a => BoxedEnum a
 - class TypedObject a => BoxedFlags a
 - newtype GParamSpec = GParamSpec (ManagedPtr GParamSpec)
 - noGParamSpec :: Maybe GParamSpec
 - data GArray a = GArray (Ptr (GArray a))
 - data GPtrArray a = GPtrArray (Ptr (GPtrArray a))
 - data GByteArray = GByteArray (Ptr GByteArray)
 - data GHashTable a b = GHashTable (Ptr (GHashTable a b))
 - data GList a = GList (Ptr (GList a))
 - g_list_free :: Ptr (GList a) -> IO ()
 - data GSList a = GSList (Ptr (GSList a))
 - g_slist_free :: Ptr (GSList a) -> IO ()
 - class Enum a => IsGFlag a
 - newtype PtrWrapped a = PtrWrapped {}
 - type GDestroyNotify ptr = FunPtr (ptr -> IO ())
 - type GHashFunc a = FunPtr (PtrWrapped a -> IO Word32)
 - type GEqualFunc a = FunPtr (PtrWrapped a -> PtrWrapped a -> IO Int32)
 
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   | 
Defined in Data.GI.Base.BasicTypes  | |
class Coercible a (ManagedPtr ()) => ManagedPtrNewtype a where Source #
A constraint ensuring that the given type is a newtype over a
 ManagedPtr.
Methods
toManagedPtr :: a -> ManagedPtr a Source #
Instances
| Coercible a (ManagedPtr ()) => ManagedPtrNewtype a Source # | A default instance for   | 
Defined in Data.GI.Base.BasicTypes 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.
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.
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.
Constructors
| UnexpectedNullPointerReturn | |
Fields  | |
Instances
| Exception UnexpectedNullPointerReturn Source # | |
| Show UnexpectedNullPointerReturn Source # | |
Defined in Data.GI.Base.BasicTypes Methods showsPrec :: Int -> UnexpectedNullPointerReturn -> ShowS # show :: UnexpectedNullPointerReturn -> String # showList :: [UnexpectedNullPointerReturn] -> ShowS #  | |
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.
Instances
| TypedObject GError Source # | |
| TypedObject GValue Source # | |
| TypedObject (GClosure a) Source # | Find the associated   | 
class (ManagedPtrNewtype a, TypedObject a) => GObject a Source #
A wrapped GObject, or any other type that descends from it.
A newtype for use on the Haskell side.
Constructors
| GType | |
Fields  | |
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.
A GVariant. See Data.GI.Base.GVariant for further methods.
Constructors
| GVariant (ManagedPtr GVariant) | 
Instances
| IsGVariant GVariant Source # | |
Defined in Data.GI.Base.GVariant  | |
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 GError Source # | 
  | 
Defined in Data.GI.Base.GError  | |
| GBoxed GValue Source # | 
  | 
Defined in Data.GI.Base.GValue  | |
| GBoxed (GClosure a) Source # | 
  | 
Defined in Data.GI.Base.GClosure  | |
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.
Constructors
| GParamSpec (ManagedPtr GParamSpec) | 
Instances
| IsGValue (Maybe GParamSpec) Source # | |
Defined in Data.GI.Base.GValue Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe GParamSpec -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe GParamSpec) Source #  | |
noGParamSpec :: Maybe GParamSpec Source #
A convenient synonym for Nothing :: Maybe GParamSpec.
A GArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is mapped to a list on the Haskell side.
A GPtrArray. Marshalling for this type is done in Data.GI.Base.BasicConversions, it is mapped to a list on the Haskell side.
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)) | 
A GList, mapped to a list on the Haskell side. Marshalling is done in Data.GI.Base.BasicConversions.
A GSList, mapped to a list on the Haskell side. Marshalling is done in Data.GI.Base.BasicConversions.
class Enum a => IsGFlag a Source #
An enum usable as a flag for a function.
Instances
| IsGFlag GParamFlag Source # | |
Defined in Data.GI.Base.GParamSpec  | |
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 | |
type GDestroyNotify ptr = FunPtr (ptr -> IO ()) Source #
Destroy the memory pointed to by a given pointer type.
type GHashFunc a = FunPtr (PtrWrapped a -> IO Word32) Source #
A pointer to a hashing function on the C side.
type GEqualFunc a = FunPtr (PtrWrapped a -> PtrWrapped a -> IO Int32) Source #
A pointer to an equality checking function on the C side.