-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Foundation for libraries generated by haskell-gi -- -- Foundation for libraries generated by haskell-gi @package haskell-gi-base @version 0.13 -- | Helpers for dealing with GObjects. module Data.GI.Base.Overloading -- | The direct parents of this object: its direct parent type, if any, and -- the interfaces it implements. The interfaces inherited from parent -- types can be omitted. -- | Check that a type is in the list of GObjectParents of another -- GObject-derived type. -- | The list of attributes defined for a given type. Each element of the -- list is a tuple, with the first element of the tuple the name of the -- attribute, and the second the type encoding the information of the -- attribute. This type will be an instance of AttrInfo. -- | Return the type encoding the attribute information for a given type -- and attribute. -- | A constraint imposing that the given object has the given attribute. -- | A constraint that enforces that the given type has a given attribute. class HasAttr (attr :: Symbol) (o :: *) -- | The list of signals defined for a given type. Each element of the list -- is a tuple, with the first element of the tuple the name of the -- signal, and the second the type encoding the information of the -- signal. This type will be an instance of SignalInfo. -- | Return the type encoding the signal information for a given type and -- signal. -- | A constraint enforcing that the signal exists for the given object, or -- one of its ancestors. -- | Class for types containing the information about an overloaded method -- of type `o -> s`. class MethodInfo i o s overloadedMethod :: MethodInfo i o s => MethodProxy i -> o -> s -- | Proxy for passing a type to overloadedMethod. We do not use -- Proxy directly since it clashes with types defined in the -- autogenerated bindings. data MethodProxy a MethodProxy :: MethodProxy a -- | Support for overloaded labels in ghc < 8.0. This is like the -- IsLabel class introduced in ghc 8.0 (for use with the -- OverloadedLabels extension) with the difference that the Proxy -- argument is lifted. (Using the unlifted Proxy# type in user code is a -- bit of a pain, hence the choice.) class IsLabelProxy (x :: Symbol) a fromLabelProxy :: IsLabelProxy x a => Proxy x -> a instance Data.GI.Base.Overloading.HasAttribute attr o => Data.GI.Base.Overloading.HasAttr attr o -- | Basic types used in the bindings. module Data.GI.Base.BasicTypes -- | A newtype for use on the haskell side. newtype GType GType :: CGType -> GType [gtypeToCGType] :: GType -> CGType -- | 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. type CGType = Word64 -- | Get the name assigned to the given GType. gtypeName :: GType -> IO String -- | GType of strings. gtypeString :: GType -- | GType of pointers. gtypePointer :: GType -- | GType for signed integers. gtypeInt32 :: GType -- | GType for unsigned integers. gtypeUInt32 :: GType -- | GType for signed 64 bit integers. gtypeInt64 :: GType -- | GType for unsigned 64 bit integers. gtypeUInt64 :: GType -- | GType for floating point values. gtypeFloat :: GType -- | GType for gdouble. gtypeDouble :: GType -- | GType corresponding to gboolean. gtypeBoolean :: GType -- | GType corresponding to a GType itself. gtypeGType :: GType -- | GType for a NULL terminated array of strings. gtypeStrv :: GType -- | GType corresponding to a BoxedObject. gtypeBoxed :: GType -- | GType corresponding to a GObject. gtypeObject :: GType -- | A constraint ensuring that the given type is coercible to a -- ForeignPtr. It will hold for newtypes of the form -- --
--   newtype Foo = Foo (ForeignPtr Foo)
--   
-- -- which is the typical shape of wrapped GObjects. type ForeignPtrNewtype a = Coercible a (ForeignPtr ()) -- | Wrapped boxed structures, identified by their GType. class ForeignPtrNewtype a => BoxedObject a boxedType :: BoxedObject a => a -> IO GType -- | Enums with an associated GType. class BoxedEnum a boxedEnumType :: BoxedEnum a => a -> IO GType -- | A wrapped GObject. class ForeignPtrNewtype a => GObject a -- | Whether the GObject is a descendent of -- GInitiallyUnowned. gobjectIsInitiallyUnowned :: GObject a => a -> Bool -- | The GType for this object. gobjectType :: GObject a => a -> IO GType -- | 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. data UnexpectedNullPointerReturn UnexpectedNullPointerReturn :: Text -> UnexpectedNullPointerReturn [nullPtrErrorMsg] :: UnexpectedNullPointerReturn -> Text -- | A GVariant. See Data.GI.Base.GVariant for further -- methods. newtype GVariant GVariant :: (ForeignPtr GVariant) -> GVariant -- | A GParamSpec. See Data.GI.Base.GParamSpec for further -- methods. newtype GParamSpec GParamSpec :: (ForeignPtr GParamSpec) -> GParamSpec -- | A GArray. Marshalling for this type is done in -- Data.GI.Base.BasicConversions, it is mapped to a list on the -- Haskell side. data GArray a GArray :: (Ptr (GArray a)) -> GArray a -- | A GPtrArray. Marshalling for this type is done in -- Data.GI.Base.BasicConversions, it is mapped to a list on the -- Haskell side. data GPtrArray a GPtrArray :: (Ptr (GPtrArray a)) -> GPtrArray a -- | A GByteArray. Marshalling for this type is done in -- Data.GI.Base.BasicConversions, it is packed to a -- ByteString on the Haskell side. data GByteArray GByteArray :: (Ptr GByteArray) -> GByteArray -- | A GHashTable. It is mapped to a Map on the Haskell side. data GHashTable a b GHashTable :: (Ptr (GHashTable a b)) -> GHashTable a b -- | A GList, mapped to a list on the Haskell side. Marshalling is -- done in Data.GI.Base.BasicConversions. data GList a GList :: (Ptr (GList a)) -> GList a -- | Free the given GList. g_list_free :: Ptr (GList a) -> IO () -- | A GSList, mapped to a list on the Haskell side. Marshalling is -- done in Data.GI.Base.BasicConversions. data GSList a GSList :: (Ptr (GSList a)) -> GSList a -- | Free the given GSList. g_slist_free :: Ptr (GSList a) -> IO () -- | An enum usable as a flag for a function. class Enum a => IsGFlag a -- | Some APIs, such as GHashTable, pass around scalar types wrapped -- into a pointer. We encode such a type as follows. newtype PtrWrapped a PtrWrapped :: Ptr a -> PtrWrapped a [unwrapPtr] :: PtrWrapped a -> Ptr a -- | Destroy the memory associated with a given pointer. type GDestroyNotify a = FunPtr (Ptr a -> IO ()) instance GHC.Show.Show Data.GI.Base.BasicTypes.UnexpectedNullPointerReturn instance GHC.Exception.Exception Data.GI.Base.BasicTypes.UnexpectedNullPointerReturn -- | Machinery for some basic support of GHashTable. -- -- The GLib GHashTable implementation requires two things: we -- need to "pack" a datatype into a pointer (for datatypes that are -- represented by pointers this is the trivial operation, for integers it -- is not, and GLib has some helper macros). -- -- We also need to be able to hash and check for equality different -- datatypes. module Data.GI.Base.GHashTable -- | A pointer to a hashing function on the C side. type GHashFunc a = FunPtr (PtrWrapped a -> IO Word32) -- | A pointer to an equality checking function on the C side. type GEqualFunc a = FunPtr (PtrWrapped a -> PtrWrapped a -> IO Int32) -- | Compute the hash for a Ptr. gDirectHash :: GHashFunc (Ptr a) -- | Check whether two pointers are equal. gDirectEqual :: GEqualFunc (Ptr a) -- | Pack a Ptr into a PtrWrapped Ptr. ptrPackPtr :: Ptr a -> PtrWrapped (Ptr a) -- | Extract a Ptr from a PtrWrapped Ptr. ptrUnpackPtr :: PtrWrapped (Ptr a) -> Ptr a -- | Compute the hash for a CString. gStrHash :: GHashFunc CString -- | Check whether two CStrings are equal. gStrEqual :: GEqualFunc CString -- | Pack a CString into a Ptr than can go into a -- GHashTable. cstringPackPtr :: CString -> PtrWrapped CString -- | Extract a CString wrapped into a Ptr coming from a -- GHashTable. cstringUnpackPtr :: PtrWrapped CString -> CString module Data.GI.Base.GParamSpec noGParamSpec :: Maybe GParamSpec -- | Take ownership of a ParamSpec passed in Ptr. wrapGParamSpecPtr :: Ptr GParamSpec -> IO GParamSpec -- | Construct a Haskell wrapper for the given GParamSpec, without -- assuming ownership. newGParamSpecFromPtr :: Ptr GParamSpec -> IO GParamSpec -- | Add a reference to the given GParamSpec. refGParamSpec :: GParamSpec -> IO (Ptr GParamSpec) -- | Remove a reference to the given GParamSpec. unrefGParamSpec :: GParamSpec -> IO () -- | Assorted utility functions for bindings. module Data.GI.Base.Utils -- | When the given value is of "Just a" form, execute the given action, -- otherwise do nothing. whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () -- | Like maybe, but for actions on a monad, and with slightly -- different argument order. maybeM :: Monad m => b -> Maybe a -> (a -> m b) -> m b -- | Check if the pointer is nullPtr, and wrap it on a Maybe -- accordingly. maybeFromPtr :: Ptr a -> Maybe (Ptr a) -- | Given a function and a list of two-tuples, apply the function to every -- first element of the tuples. mapFirst :: (a -> c) -> [(a, b)] -> [(c, b)] -- | Applicative version of mapFirst. mapFirstA :: Applicative f => (a -> f c) -> [(a, b)] -> f [(c, b)] -- | Same for the second element. mapSecond :: (b -> c) -> [(a, b)] -> [(a, c)] -- | Applicative version of mapSecond. mapSecondA :: Applicative f => (b -> f c) -> [(a, b)] -> f [(a, c)] -- | Apply the given conversion action to the given pointer if it is -- non-NULL, otherwise return Nothing. convertIfNonNull :: Ptr a -> (Ptr a -> IO b) -> IO (Maybe b) -- | Make a zero-filled allocation using the GLib allocator. callocBytes :: Int -> IO (Ptr a) -- | Make a zero filled allocation of n bytes for a boxed object. The -- difference with a normal callocBytes is that the returned memory is -- allocated using whatever memory allocator g_boxed_copy uses, which in -- particular may well be different from a plain g_malloc. In particular -- g_slice_alloc is often used for allocating boxed objects, which are -- then freed using g_slice_free. callocBoxedBytes :: forall a. BoxedObject a => Int -> IO (Ptr a) -- | Make a zero-filled allocation of enough size to hold the given -- Storable type, using the GLib allocator. callocMem :: forall a. Storable a => IO (Ptr a) -- | Allocate the given number of bytes using the GLib allocator. allocBytes :: Integral a => a -> IO (Ptr b) -- | Allocate space for the given Storable using the GLib allocator. allocMem :: forall a. Storable a => IO (Ptr a) -- | A wrapped for g_free. freeMem :: Ptr a -> IO () -- | Pointer to g_free. ptr_to_g_free :: FunPtr (Ptr a -> IO ()) -- | Copy memory into a destination (in the first argument) from a source -- (in the second argument). memcpy :: Ptr a -> Ptr b -> Int -> IO () -- | Same as freeHaskellFunPtr, but it does nothing when given a nullPtr. safeFreeFunPtr :: Ptr a -> IO () -- | A pointer to safeFreeFunPtr. safeFreeFunPtrPtr :: FunPtr (Ptr a -> IO ()) -- | If given a pointer to the memory location, free the FunPtr at -- that location, and then the pointer itself. Useful for freeing the -- memory associated to callbacks which are called just once, with no -- destroy notification. maybeReleaseFunPtr :: Maybe (Ptr (FunPtr a)) -> IO () -- | Check that the given pointer is not NULL. If it is, raise a -- UnexpectedNullPointerReturn exception. checkUnexpectedReturnNULL :: Text -> Ptr a -> IO () -- | We wrap most objects in a "managed pointer", which is simply a newtype -- for a ForeignPtr of the appropriate type: -- --
--   newtype Foo = Foo (ForeignPtr Foo)
--   
-- -- Notice that types of this form are instances of -- ForeignPtrNewtype. The newtype is useful in order to make the -- newtype an instance of different typeclasses. The routines in this -- module deal with the memory management of such managed pointers. module Data.GI.Base.ManagedPtr -- | Perform an IO action on the Ptr inside a managed pointer. withManagedPtr :: ForeignPtrNewtype a => a -> (Ptr a -> IO c) -> IO c -- | Perform an IO action taking a list of Ptr on a list of managed -- pointers. withManagedPtrList :: ForeignPtrNewtype a => [a] -> ([Ptr a] -> IO c) -> IO c -- | Return the Ptr in a given managed pointer. As the name says, -- this is potentially unsafe: the given Ptr may only be used -- before a call to touchManagedPtr. This function is of -- most interest to the autogenerated bindings, for hand-written code -- withManagedPtr is almost always a better choice. unsafeManagedPtrGetPtr :: ForeignPtrNewtype a => a -> Ptr a -- | Same as unsafeManagedPtrGetPtr, but is polymorphic on the -- return type. unsafeManagedPtrCastPtr :: forall a b. ForeignPtrNewtype a => a -> Ptr b -- | Ensure that the Ptr in the given managed pointer is still alive -- (i.e. it has not been garbage collected by the runtime) at the point -- that this is called. touchManagedPtr :: forall a. ForeignPtrNewtype a => a -> IO () -- | Cast to the given type, checking that the cast is valid. If it is not, -- we return Nothing. Usage: -- --
--   maybeWidget <- castTo Widget label
--   
castTo :: forall o o'. (GObject o, GObject o') => (ForeignPtr o' -> o') -> o -> IO (Maybe o') -- | Cast to the given type, assuming that the cast will succeed. This -- function will call error if the cast is illegal. unsafeCastTo :: forall o o'. (GObject o, GObject o') => (ForeignPtr o' -> o') -> o -> IO o' -- | Construct a Haskell wrapper for a GObject, increasing its -- reference count. newObject :: (GObject a, GObject b) => (ForeignPtr a -> a) -> Ptr b -> IO a -- | Same as newObject, but we take ownership of the object. Newly -- created GObjects are typically floating, so we use -- g_object_ref_sink. wrapObject :: forall a b. (GObject a, GObject b) => (ForeignPtr a -> a) -> Ptr b -> IO a -- | Increase the reference count of the given GObject. refObject :: (GObject a, GObject b) => a -> IO (Ptr b) -- | Decrease the reference count of the given GObject. The memory -- associated with the object may be released if the reference count -- reaches 0. unrefObject :: GObject a => a -> IO () -- | Construct a Haskell wrapper for the given boxed object. We make a copy -- of the object. newBoxed :: forall a. BoxedObject a => (ForeignPtr a -> a) -> Ptr a -> IO a -- | Like newBoxed, but we do not make a copy (we "steal" the passed -- object, so now it is managed by the Haskell runtime). wrapBoxed :: forall a. BoxedObject a => (ForeignPtr a -> a) -> Ptr a -> IO a -- | Make a copy of the given boxed object. copyBoxed :: forall a. BoxedObject a => a -> IO (Ptr a) -- | Like copyBoxed, but acting directly on a pointer, instead of a -- managed pointer. copyBoxedPtr :: forall a. BoxedObject a => Ptr a -> IO (Ptr a) -- | Free the memory associated with a boxed object freeBoxed :: forall a. BoxedObject a => a -> IO () -- | Wrap a pointer, taking ownership of it. wrapPtr :: (ForeignPtr a -> a) -> Ptr a -> IO a -- | Wrap a pointer to n bytes, making a copy of the data. newPtr :: Int -> (ForeignPtr a -> a) -> Ptr a -> IO a module Data.GI.Base.Closure newtype Closure Closure :: (ForeignPtr Closure) -> Closure newCClosure :: FunPtr a -> IO Closure noClosure :: Maybe Closure instance Data.GI.Base.BasicTypes.BoxedObject Data.GI.Base.Closure.Closure module Data.GI.Base.BasicConversions gflagsToWord :: (Num b, IsGFlag a) => [a] -> b wordToGFlags :: (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b] packGList :: [Ptr a] -> IO (Ptr (GList (Ptr a))) unpackGList :: Ptr (GList (Ptr a)) -> IO [Ptr a] packGSList :: [Ptr a] -> IO (Ptr (GSList (Ptr a))) unpackGSList :: Ptr (GSList (Ptr a)) -> IO [Ptr a] packGArray :: forall a. Storable a => [a] -> IO (Ptr (GArray a)) unpackGArray :: forall a. Storable a => Ptr (GArray a) -> IO [a] unrefGArray :: Ptr (GArray a) -> IO () packGPtrArray :: [Ptr a] -> IO (Ptr (GPtrArray (Ptr a))) unpackGPtrArray :: Ptr (GPtrArray (Ptr a)) -> IO [Ptr a] unrefPtrArray :: Ptr (GPtrArray a) -> IO () packGByteArray :: ByteString -> IO (Ptr GByteArray) unpackGByteArray :: Ptr GByteArray -> IO ByteString unrefGByteArray :: Ptr GByteArray -> IO () packGHashTable :: GHashFunc a -> GEqualFunc a -> Maybe (GDestroyNotify a) -> Maybe (GDestroyNotify b) -> [(PtrWrapped a, PtrWrapped b)] -> IO (Ptr (GHashTable a b)) unpackGHashTable :: Ptr (GHashTable a b) -> IO [(PtrWrapped a, PtrWrapped b)] unrefGHashTable :: Ptr (GHashTable a b) -> IO () packByteString :: ByteString -> IO (Ptr Word8) packZeroTerminatedByteString :: ByteString -> IO (Ptr Word8) unpackByteStringWithLength :: Integral a => a -> Ptr Word8 -> IO ByteString unpackZeroTerminatedByteString :: Ptr Word8 -> IO ByteString packFileNameArray :: [String] -> IO (Ptr CString) packZeroTerminatedFileNameArray :: [String] -> IO (Ptr CString) unpackZeroTerminatedFileNameArray :: Ptr CString -> IO [String] unpackFileNameArrayWithLength :: Integral a => a -> Ptr CString -> IO [String] packUTF8CArray :: [Text] -> IO (Ptr CString) packZeroTerminatedUTF8CArray :: [Text] -> IO (Ptr CString) unpackUTF8CArrayWithLength :: Integral a => a -> Ptr CString -> IO [Text] unpackZeroTerminatedUTF8CArray :: Ptr CString -> IO [Text] packStorableArray :: Storable a => [a] -> IO (Ptr a) packZeroTerminatedStorableArray :: (Num a, Storable a) => [a] -> IO (Ptr a) unpackStorableArrayWithLength :: (Integral a, Storable b) => a -> Ptr b -> IO [b] unpackZeroTerminatedStorableArray :: (Eq a, Num a, Storable a) => Ptr a -> IO [a] packMapStorableArray :: forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b) packMapZeroTerminatedStorableArray :: forall a b. (Num b, Storable b) => (a -> b) -> [a] -> IO (Ptr b) unpackMapStorableArrayWithLength :: forall a b c. (Integral a, Storable b) => (b -> c) -> a -> Ptr b -> IO [c] unpackMapZeroTerminatedStorableArray :: forall a b. (Eq a, Num a, Storable a) => (a -> b) -> Ptr a -> IO [b] packPtrArray :: [Ptr a] -> IO (Ptr (Ptr a)) packZeroTerminatedPtrArray :: [Ptr a] -> IO (Ptr (Ptr a)) unpackPtrArrayWithLength :: Integral a => a -> Ptr (Ptr b) -> IO [Ptr b] unpackZeroTerminatedPtrArray :: Ptr (Ptr a) -> IO [Ptr a] packBlockArray :: Int -> [Ptr a] -> IO (Ptr a) unpackBlockArrayWithLength :: Integral a => Int -> a -> Ptr b -> IO [Ptr b] unpackBoxedArrayWithLength :: forall a b. (Integral a, BoxedObject b) => Int -> a -> Ptr b -> IO [Ptr b] stringToCString :: String -> IO CString cstringToString :: CString -> IO String -- | Convert Text into a CString, using the GLib allocator. textToCString :: Text -> IO CString withTextCString :: Text -> (CString -> IO a) -> IO a cstringToText :: CString -> IO Text byteStringToCString :: ByteString -> IO CString cstringToByteString :: CString -> IO ByteString mapZeroTerminatedCArray :: (Ptr a -> IO b) -> Ptr (Ptr a) -> IO () mapCArrayWithLength :: (Storable a, Integral b) => b -> (a -> IO c) -> Ptr a -> IO () mapGArray :: forall a b. Storable a => (a -> IO b) -> Ptr (GArray a) -> IO () mapPtrArray :: (Ptr a -> IO b) -> Ptr (GPtrArray (Ptr a)) -> IO () mapGList :: (Ptr a -> IO b) -> Ptr (GList (Ptr a)) -> IO () mapGSList :: (Ptr a -> IO b) -> Ptr (GSList (Ptr a)) -> IO () -- | To catch GError exceptions use the catchGError* or handleGError* -- functions. They work in a similar way to the standard catch and -- handle functions. -- -- To catch just a single specific error use catchGErrorJust / -- handleGErrorJust. To catch any error in a particular error -- domain use catchGErrorJustDomain / -- handleGErrorJustDomain -- -- For convenience, generated code also includes specialized variants of -- catchGErrorJust / handleGErrorJust for each error type. -- For example, for errors of type PixbufError one could invoke -- catchPixbufError / handlePixbufError. The definition is -- simply -- --
--   catchPixbufError :: IO a -> (PixbufError -> GErrorMessage -> IO a) -> IO a
--   catchPixbufError = catchGErrorJustDomain
--   
-- -- Notice that the type is suitably specialized, so only errors of type -- PixbufError will be caught. module Data.GI.Base.GError -- | A GError, consisting of a domain, code and a human readable message. -- These can be accessed by gerrorDomain, gerrorCode and -- gerrorMessage below. newtype GError GError :: (ForeignPtr GError) -> GError -- | Return the domain for the given GError. This is a GQuark, a -- textual representation can be obtained with quarkToString. gerrorDomain :: GError -> IO GQuark -- | The numeric code for the given GError. gerrorCode :: GError -> IO GErrorCode -- | A text message describing the GError. gerrorMessage :: GError -> IO GErrorMessage -- | A code used to identify the "namespace" of the error. Within each -- error domain all the error codes are defined in an enumeration. Each -- gtk/gnome module that uses GErrors has its own error domain. The -- rationale behind using error domains is so that each module can -- organise its own error codes without having to coordinate on a global -- error code list. type GErrorDomain = GQuark -- | A code to identify a specific error within a given -- GErrorDomain. Most of time you will not need to deal with this -- raw code since there is an enumeration type for each error domain. Of -- course which enumeration to use depends on the error domain, but if -- you use catchGErrorJustDomain or handleGErrorJustDomain, -- this is worked out for you automatically. type GErrorCode = Int32 -- | A human readable error message. type GErrorMessage = Text -- | This will catch just a specific GError exception. If you need to catch -- a range of related errors, catchGErrorJustDomain is probably -- more appropriate. Example: -- --
--   do image <- catchGErrorJust PixbufErrorCorruptImage
--                 loadImage
--                 (\errorMessage -> do log errorMessage
--                                      return mssingImagePlaceholder)
--   
catchGErrorJust :: GErrorClass err => err -> IO a -> (GErrorMessage -> IO a) -> IO a -- | Catch all GErrors from a particular error domain. The handler function -- should just deal with one error enumeration type. If you need to catch -- errors from more than one error domain, use this function twice with -- an appropriate handler functions for each. -- --
--   catchGErrorJustDomain
--     loadImage
--     (\err message -> case err of
--         PixbufErrorCorruptImage -> ...
--         PixbufErrorInsufficientMemory -> ...
--         PixbufErrorUnknownType -> ...
--         _ -> ...)
--   
catchGErrorJustDomain :: forall err a. GErrorClass err => IO a -> (err -> GErrorMessage -> IO a) -> IO a -- | A verson of handleGErrorJust with the arguments swapped around. handleGErrorJust :: GErrorClass err => err -> (GErrorMessage -> IO a) -> IO a -> IO a -- | A verson of catchGErrorJustDomain with the arguments swapped -- around. handleGErrorJustDomain :: GErrorClass err => (err -> GErrorMessage -> IO a) -> IO a -> IO a -- | Create a new GError. gerrorNew :: GErrorDomain -> GErrorCode -> GErrorMessage -> IO GError -- | Each error domain's error enumeration type should be an instance of -- this class. This class helps to hide the raw error and domain codes -- from the user. -- -- Example for PixbufError: -- --
--   instance GErrorClass PixbufError where
--     gerrorClassDomain _ = "gdk-pixbuf-error-quark"
--   
class Enum err => GErrorClass err gerrorClassDomain :: GErrorClass err => err -> Text -- | Run the given function catching possible GErrors in its -- execution. If a GError is emitted this throws the corresponding -- exception. propagateGError :: (Ptr (Ptr GError) -> IO a) -> IO a -- | Like propagateGError, but allows to specify a custom handler -- instead of just throwing the exception. checkGError :: (Ptr (Ptr GError) -> IO a) -> (GError -> IO a) -> IO a instance GHC.Show.Show Data.GI.Base.GError.GError instance GHC.Exception.Exception Data.GI.Base.GError.GError instance Data.GI.Base.BasicTypes.BoxedObject Data.GI.Base.GError.GError module Data.GI.Base.GValue newtype GValue GValue :: (ForeignPtr GValue) -> GValue class IsGValue a toGValue :: IsGValue a => a -> IO GValue fromGValue :: IsGValue a => GValue -> IO a newGValue :: GType -> IO GValue buildGValue :: GType -> (GValue -> a -> IO ()) -> a -> IO GValue noGValue :: Maybe GValue set_string :: GValue -> Text -> IO () get_string :: GValue -> IO Text set_pointer :: GValue -> Ptr a -> IO () get_pointer :: GValue -> IO (Ptr b) set_int32 :: GValue -> Int32 -> IO () get_int32 :: GValue -> IO Int32 set_uint32 :: GValue -> Word32 -> IO () get_uint32 :: GValue -> IO Word32 set_int64 :: GValue -> Int64 -> IO () get_int64 :: GValue -> IO Int64 set_uint64 :: GValue -> Word64 -> IO () get_uint64 :: GValue -> IO Word64 set_float :: GValue -> Float -> IO () get_float :: GValue -> IO Float set_double :: GValue -> Double -> IO () get_double :: GValue -> IO Double set_boolean :: GValue -> Bool -> IO () get_boolean :: GValue -> IO Bool set_gtype :: GValue -> GType -> IO () get_gtype :: GValue -> IO GType set_object :: GObject a => GValue -> Ptr a -> IO () get_object :: GObject b => GValue -> IO (Ptr b) set_boxed :: GValue -> Ptr a -> IO () get_boxed :: GValue -> IO (Ptr b) set_variant :: GValue -> Ptr GVariant -> IO () get_variant :: GValue -> IO (Ptr GVariant) set_enum :: GValue -> CUInt -> IO () get_enum :: GValue -> IO CUInt set_flags :: GValue -> CUInt -> IO () get_flags :: GValue -> IO CUInt instance Data.GI.Base.BasicTypes.BoxedObject Data.GI.Base.GValue.GValue instance Data.GI.Base.GValue.IsGValue GHC.Base.String instance Data.GI.Base.GValue.IsGValue Data.Text.Internal.Text instance Data.GI.Base.GValue.IsGValue (GHC.Ptr.Ptr a) instance Data.GI.Base.GValue.IsGValue GHC.Int.Int32 instance Data.GI.Base.GValue.IsGValue GHC.Word.Word32 instance Data.GI.Base.GValue.IsGValue GHC.Int.Int64 instance Data.GI.Base.GValue.IsGValue GHC.Word.Word64 instance Data.GI.Base.GValue.IsGValue GHC.Types.Float instance Data.GI.Base.GValue.IsGValue GHC.Types.Double instance Data.GI.Base.GValue.IsGValue GHC.Types.Bool instance Data.GI.Base.GValue.IsGValue Data.GI.Base.BasicTypes.GType -- | This module contains some helper functions for dealing with GVariant -- values. The simplest way of dealing with them is by using the -- IsGVariant typeclass: -- --
--   str <- fromGVariant variant :: IO (Maybe Text)
--   
-- -- assuming that the variant is expected to contain a string in UTF8 -- encoding. The code becomes even shorter if the type checker can -- determine the return type for you: -- --
--   readStringVariant :: GVariant -> IO Text
--   readStringVariant variant =
--     fromGVariant variant >>= \case
--        Nothing  -> error "Variant was not a string"
--        Just str -> return str
--   
-- -- Alternatively, you can use manually the gvariantFrom* and gvariantTo* -- family of functions. module Data.GI.Base.GVariant -- | The typeclass for types that can be automatically marshalled into -- GVariant using toGVariant and fromGVariant. class IsGVariant a -- | Convert a value of the given type into a GVariant. toGVariant :: IsGVariant a => a -> IO GVariant -- | Try to decode a GVariant into a target type. If the conversion -- fails we return Nothing. The type that was expected can be -- obtained by calling toGVariantFormatString, and the actual type -- as understood by the GVariant code can be obtained by calling -- gvariantToTypeString. fromGVariant :: IsGVariant a => GVariant -> IO (Maybe a) -- | The expected format string for this type (the argument is ignored). toGVariantFormatString :: IsGVariant a => a -> Text -- | The typeclass for basic type GVariant types, i.e. those that -- are not containers. class Ord a => IsGVariantBasicType a -- | An alias for Nothing :: Maybe GVariant to save some typing. noGVariant :: Maybe GVariant -- | Get the expected type of a GVariant, in GVariant -- notation. See -- https://developer.gnome.org/glib/stable/glib-GVariantType.html -- for the meaning of the resulting format string. gvariantGetTypeString :: GVariant -> IO Text -- | Haskell has no notion of one element tuples, but GVariants do, so the -- following allows for marshalling one element tuples properly using -- fromGVariant and toGVariant. For instance, to construct -- a single element tuple containing a string, you could do -- --
--   toGVariant (GVariantSinglet "Test")
--   
newtype GVariantSinglet a GVariantSinglet :: a -> GVariantSinglet a -- | A DictEntry GVariant is isomorphic to a two-tuple. Wrapping the -- values into a GVariantDictentry allows the IsGVariant -- instance to do the right thing. data GVariantDictEntry key value GVariantDictEntry :: key -> value -> GVariantDictEntry key value newtype GVariantHandle GVariantHandle :: Int32 -> GVariantHandle -- | An object representing a DBus object path, which is a particular type -- of GVariant too. (Just a string with some specific -- requirements.) In order to construct/deconstruct a -- GVariantObjectPath one can use newGVariantObjectPath and -- gvariantObjectPathToText. data GVariantObjectPath -- | Try to construct a DBus object path. If the passed string is not a -- valid object path Nothing will be returned. newGVariantObjectPath :: Text -> Maybe GVariantObjectPath -- | Return the Text representation of a GVariantObjectPath. gvariantObjectPathToText :: GVariantObjectPath -> Text -- | An object representing a DBus signature, which is a particular type of -- GVariant too. (Just a string with some specific requirements.) -- In order to construct/deconstruct a GVariantSignature one can -- use newGVariantSignature and gvariantSignatureToText. data GVariantSignature -- | Try to construct a DBus object path. If the passed string is not a -- valid DBus signature Nothing will be returned. newGVariantSignature :: Text -> Maybe GVariantSignature -- | Return the Text representation of a GVariantSignature. gvariantSignatureToText :: GVariantSignature -> Text -- | Take ownership of a passed in Ptr (typically created just for -- us, so if it is floating we sink it). wrapGVariantPtr :: Ptr GVariant -> IO GVariant -- | Construct a Haskell wrapper for the given GVariant, without -- assuming ownership. newGVariantFromPtr :: Ptr GVariant -> IO GVariant -- | Add a reference to the given GVariant. refGVariant :: GVariant -> IO (Ptr GVariant) -- | Remove a reference to the given GVariant. unrefGVariant :: GVariant -> IO () gvariantToBool :: GVariant -> IO (Maybe Bool) gvariantFromBool :: Bool -> IO GVariant gvariantToWord8 :: GVariant -> IO (Maybe Word8) gvariantFromWord8 :: Word8 -> IO GVariant gvariantToInt16 :: GVariant -> IO (Maybe Int16) gvariantFromInt16 :: Int16 -> IO GVariant gvariantToWord16 :: GVariant -> IO (Maybe Word16) gvariantFromWord16 :: Word16 -> IO GVariant gvariantToInt32 :: GVariant -> IO (Maybe Int32) gvariantFromInt32 :: Int32 -> IO GVariant gvariantToWord32 :: GVariant -> IO (Maybe Word32) gvariantFromWord32 :: Word32 -> IO GVariant gvariantToInt64 :: GVariant -> IO (Maybe Int64) gvariantFromInt64 :: Int64 -> IO GVariant gvariantToWord64 :: GVariant -> IO (Maybe Word64) gvariantFromWord64 :: Word64 -> IO GVariant -- | Extract the DBus handle (an Int32) inside a GVariant. gvariantToHandle :: GVariant -> IO (Maybe Int32) -- | Convert a DBus handle (an Int32) into a GVariant. gvariantFromHandle :: Int32 -> IO GVariant gvariantToDouble :: GVariant -> IO (Maybe Double) gvariantFromDouble :: Double -> IO GVariant -- | Decode an UTF-8 encoded string GVariant into Text. gvariantToText :: GVariant -> IO (Maybe Text) -- | Encode a Text into an UTF-8 encoded string GVariant. gvariantFromText :: Text -> IO GVariant -- | Extract a GVariantObjectPath from a GVariant, -- represented as its underlying Text representation. gvariantToObjectPath :: GVariant -> IO (Maybe Text) -- | Construct a GVariant containing an object path. In order to -- build a GVariantObjectPath value see -- newGVariantObjectPath. gvariantFromObjectPath :: GVariantObjectPath -> IO GVariant -- | Extract a GVariantSignature from a GVariant, represented -- as Text. gvariantToSignature :: GVariant -> IO (Maybe Text) -- | Construct a GVariant containing an DBus signature. In order to -- build a GVariantSignature value see -- newGVariantSignature. gvariantFromSignature :: GVariantSignature -> IO GVariant -- | Unbox a GVariant contained inside another GVariant. gvariantToGVariant :: GVariant -> IO (Maybe GVariant) -- | Box a GVariant inside another GVariant. gvariantFromGVariant :: GVariant -> IO GVariant -- | Extract a zero terminated list of bytes into a ByteString. gvariantToBytestring :: GVariant -> IO (Maybe ByteString) -- | Encode a ByteString into a list of bytes GVariant. gvariantFromBytestring :: ByteString -> IO GVariant -- | Convert a Maybe value into a corresponding GVariant of -- maybe type. gvariantFromMaybe :: forall a. IsGVariant a => Maybe a -> IO GVariant -- | Try to decode a maybe GVariant into the corresponding -- Maybe type. If the conversion is successful this returns -- Just x, where x itself is of Maybe type. So, -- in particular, Just Nothing indicates a successful call, and -- means that the GVariant of maybe type was empty. gvariantToMaybe :: forall a. IsGVariant a => GVariant -> IO (Maybe (Maybe a)) -- | Construct a GVariant of type DictEntry from the given -- key and value. The key must be a basic -- GVariant type, i.e. not a container. This is determined by -- whether it belongs to the IsGVariantBasicType typeclass. On the -- other hand value is an arbitrary GVariant, and in -- particular it can be a container type. gvariantFromDictEntry :: (IsGVariant key, IsGVariantBasicType key, IsGVariant value) => key -> value -> IO GVariant -- | Unpack a DictEntry variant into key and value, which -- are returned as a two element tuple in case of success. gvariantToDictEntry :: forall key value. (IsGVariant key, IsGVariantBasicType key, IsGVariant value) => GVariant -> IO (Maybe (key, value)) -- | Pack a Map into a GVariant for dictionary type, which -- is just an array of GVariantDictEntry. gvariantFromMap :: (IsGVariant key, IsGVariantBasicType key, IsGVariant value) => Map key value -> IO GVariant -- | Unpack a GVariant into a Map. Notice that this assumes -- that all the elements in the GVariant array of -- GVariantDictEntry are of the same type, which is not necessary -- for a generic GVariant, so this is somewhat restrictive. For -- the general case it is necessary to use gvariantToList plus -- gvariantToDictEntry directly. gvariantToMap :: forall key value. (IsGVariant key, IsGVariantBasicType key, IsGVariant value) => GVariant -> IO (Maybe (Map key value)) -- | Given a list of elements construct a GVariant array containing -- them. gvariantFromList :: forall a. IsGVariant a => [a] -> IO GVariant -- | Unpack a GVariant array into its elements. gvariantToList :: forall a. IsGVariant a => GVariant -> IO (Maybe [a]) -- | Given a list of GVariant, construct a GVariant tuple -- containing the elements in the list. gvariantFromTuple :: [GVariant] -> IO GVariant -- | Extract the children of a GVariant tuple into a list. gvariantToTuple :: GVariant -> IO (Maybe [GVariant]) instance (GHC.Show.Show key, GHC.Show.Show value) => GHC.Show.Show (Data.GI.Base.GVariant.GVariantDictEntry key value) instance (GHC.Classes.Eq key, GHC.Classes.Eq value) => GHC.Classes.Eq (Data.GI.Base.GVariant.GVariantDictEntry key value) instance GHC.Show.Show Data.GI.Base.GVariant.GVariantSignature instance GHC.Classes.Eq Data.GI.Base.GVariant.GVariantSignature instance GHC.Classes.Ord Data.GI.Base.GVariant.GVariantSignature instance GHC.Show.Show Data.GI.Base.GVariant.GVariantObjectPath instance GHC.Classes.Eq Data.GI.Base.GVariant.GVariantObjectPath instance GHC.Classes.Ord Data.GI.Base.GVariant.GVariantObjectPath instance GHC.Show.Show Data.GI.Base.GVariant.GVariantHandle instance GHC.Classes.Ord Data.GI.Base.GVariant.GVariantHandle instance GHC.Classes.Eq Data.GI.Base.GVariant.GVariantHandle instance GHC.Show.Show a => GHC.Show.Show (Data.GI.Base.GVariant.GVariantSinglet a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.GI.Base.GVariant.GVariantSinglet a) instance Data.GI.Base.GVariant.IsGVariant GHC.Types.Bool instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Types.Bool instance Data.GI.Base.GVariant.IsGVariant GHC.Word.Word8 instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Word.Word8 instance Data.GI.Base.GVariant.IsGVariant GHC.Int.Int16 instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Int.Int16 instance Data.GI.Base.GVariant.IsGVariant GHC.Word.Word16 instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Word.Word16 instance Data.GI.Base.GVariant.IsGVariant GHC.Int.Int32 instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Int.Int32 instance Data.GI.Base.GVariant.IsGVariant GHC.Word.Word32 instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Word.Word32 instance Data.GI.Base.GVariant.IsGVariant GHC.Int.Int64 instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Int.Int64 instance Data.GI.Base.GVariant.IsGVariant GHC.Word.Word64 instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Word.Word64 instance Data.GI.Base.GVariant.IsGVariant Data.GI.Base.GVariant.GVariantHandle instance Data.GI.Base.GVariant.IsGVariantBasicType Data.GI.Base.GVariant.GVariantHandle instance Data.GI.Base.GVariant.IsGVariant GHC.Types.Double instance Data.GI.Base.GVariant.IsGVariantBasicType GHC.Types.Double instance Data.GI.Base.GVariant.IsGVariant Data.Text.Internal.Text instance Data.GI.Base.GVariant.IsGVariantBasicType Data.Text.Internal.Text instance Data.GI.Base.GVariant.IsGVariant Data.GI.Base.GVariant.GVariantObjectPath instance Data.GI.Base.GVariant.IsGVariantBasicType Data.GI.Base.GVariant.GVariantObjectPath instance Data.GI.Base.GVariant.IsGVariant Data.GI.Base.GVariant.GVariantSignature instance Data.GI.Base.GVariant.IsGVariantBasicType Data.GI.Base.GVariant.GVariantSignature instance Data.GI.Base.GVariant.IsGVariant Data.GI.Base.BasicTypes.GVariant instance Data.GI.Base.GVariant.IsGVariant Data.ByteString.Internal.ByteString instance Data.GI.Base.GVariant.IsGVariant a => Data.GI.Base.GVariant.IsGVariant (GHC.Base.Maybe a) instance (Data.GI.Base.GVariant.IsGVariant a, Data.GI.Base.GVariant.IsGVariantBasicType a, Data.GI.Base.GVariant.IsGVariant b) => Data.GI.Base.GVariant.IsGVariant (Data.GI.Base.GVariant.GVariantDictEntry a b) instance (Data.GI.Base.GVariant.IsGVariant a, Data.GI.Base.GVariant.IsGVariantBasicType a, Data.GI.Base.GVariant.IsGVariant b) => Data.GI.Base.GVariant.IsGVariant (Data.Map.Base.Map a b) instance Data.GI.Base.GVariant.IsGVariant a => Data.GI.Base.GVariant.IsGVariant [a] instance Data.GI.Base.GVariant.IsGVariant () instance Data.GI.Base.GVariant.IsGVariant a => Data.GI.Base.GVariant.IsGVariant (Data.GI.Base.GVariant.GVariantSinglet a) instance (Data.GI.Base.GVariant.IsGVariant a, Data.GI.Base.GVariant.IsGVariant b) => Data.GI.Base.GVariant.IsGVariant (a, b) instance (Data.GI.Base.GVariant.IsGVariant a, Data.GI.Base.GVariant.IsGVariant b, Data.GI.Base.GVariant.IsGVariant c) => Data.GI.Base.GVariant.IsGVariant (a, b, c) instance (Data.GI.Base.GVariant.IsGVariant a, Data.GI.Base.GVariant.IsGVariant b, Data.GI.Base.GVariant.IsGVariant c, Data.GI.Base.GVariant.IsGVariant d) => Data.GI.Base.GVariant.IsGVariant (a, b, c, d) instance (Data.GI.Base.GVariant.IsGVariant a, Data.GI.Base.GVariant.IsGVariant b, Data.GI.Base.GVariant.IsGVariant c, Data.GI.Base.GVariant.IsGVariant d, Data.GI.Base.GVariant.IsGVariant e) => Data.GI.Base.GVariant.IsGVariant (a, b, c, d, e) -- |

Basic attributes interface

-- -- Attributes of an object can be get, set and constructed. For types -- descending from GObject, properties are encoded in attributes, -- although attributes are slightly more general (every property of a -- GObject is an attribute, but we can also have attributes for -- types not descending from GObject). -- -- As an example consider a button widget and a property (of the -- Button class, or any of its parent classes or implemented interfaces) -- called "label". The simplest way of getting the value of the button is -- to do -- --
--   value <- getButtonLabel button
--   
-- -- And for setting: -- --
--   setButtonLabel button label
--   
-- -- This mechanism quickly becomes rather cumbersome, for example for -- setting the "window" property in a DOMDOMWindow in WebKit: -- --
--   win <- getDOMDOMWindowWindow dom
--   
-- -- and perhaps more importantly, one needs to chase down the type which -- introduces the property: -- --
--   setWidgetSensitive button False
--   
-- -- There is no setButtonSensitive, since it is the -- Widget type that introduces the "sensitive" property. -- --

Overloaded attributes

-- -- A much more convenient overloaded attribute resolution API is provided -- by this module. Getting the value of an object's attribute is -- straightforward: -- --
--   value <- get button _label
--   
-- -- The definition of _label is basically a Proxy encoding -- the name of the attribute to get: -- --
--   _label = fromLabelProxy (Proxy :: Proxy "label")
--   
-- -- These proxies can be automatically generated by invoking the code -- generator with the -a option. The leading underscore is -- simply so the autogenerated identifiers do not pollute the namespace, -- but if this is not a concern the autogenerated names (in the -- autogenerated GI/Properties.hs) can be edited as one wishes. -- -- In addition, for ghc >= 8.0, one can directly use the overloaded -- labels provided by GHC itself. Using the OverloadedLabels -- extension, the code above can also be written as -- --
--   value <- get button #label
--   
-- -- The syntax for setting or updating an attribute is only slightly more -- complex. At the simplest level it is just: -- --
--   set button [ _label := value ]
--   
-- -- or for the WebKit example above -- --
--   set dom [_window := win]
--   
-- -- However as the list notation would indicate, you can set or update -- multiple attributes of the same object in one go: -- --
--   set button [ _label := value, _sensitive := False ]
--   
-- -- You are not limited to setting the value of an attribute, you can also -- apply an update function to an attribute's value. That is the function -- receives the current value of the attribute and returns the new value. -- --
--   set spinButton [ _value :~ (+1) ]
--   
-- -- There are other variants of these operators, (see AttrOp). -- :=> and :~> and like := and :~ but -- operate in the IO monad rather than being pure. There is also -- ::= and ::~ which take the object as an extra parameter. -- -- Attributes can also be set during construction of a GObject -- using new -- --
--   button <- new Button [_label := "Can't touch this!", _sensitive := False]
--   
-- -- In addition for value being set/get having to have the right type, -- there can be attributes that are read-only, or that can only be set -- during construction with new, but cannot be set -- afterwards. That these invariants hold is also checked during compile -- time. module Data.GI.Base.Attributes -- | Info describing an attribute. class AttrInfo (info :: *) where type AttrAllowedOps info :: [AttrOpTag] type AttrSetTypeConstraint info :: * -> Constraint type AttrBaseTypeConstraint info :: * -> Constraint type AttrGetType info type AttrLabel info :: Symbol where { type family AttrAllowedOps info :: [AttrOpTag]; type family AttrSetTypeConstraint info :: * -> Constraint; type family AttrBaseTypeConstraint info :: * -> Constraint; type family AttrGetType info; type family AttrLabel info :: Symbol; } -- | Get the value of the given attribute. attrGet :: (AttrInfo info, AttrBaseTypeConstraint info o) => Proxy info -> o -> IO (AttrGetType info) -- | Set the value of the given attribute, after the object having the -- attribute has already been created. attrSet :: (AttrInfo info, AttrBaseTypeConstraint info o, AttrSetTypeConstraint info b) => Proxy info -> o -> b -> IO () -- | Build a GValue representing the attribute. attrConstruct :: (AttrInfo info, AttrSetTypeConstraint info b) => Proxy info -> b -> IO (String, GValue) -- | Possible operations on an attribute. data AttrOpTag AttrGet :: AttrOpTag AttrSet :: AttrOpTag AttrConstruct :: AttrOpTag -- | Constructors for the different operations allowed on an attribute. data AttrOp obj (tag :: AttrOpTag) [:=] :: (info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info, (AttrSetTypeConstraint info) b) => AttrLabelProxy (attr :: Symbol) -> b -> AttrOp obj tag [:=>] :: (info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, AttrOpAllowed tag info, (AttrSetTypeConstraint info) b) => AttrLabelProxy (attr :: Symbol) -> IO b -> AttrOp obj tag [:~] :: (info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ AttrSet, AttrOpAllowed AttrSet info, AttrOpAllowed AttrGet info, (AttrSetTypeConstraint info) b, a ~ (AttrGetType info)) => AttrLabelProxy (attr :: Symbol) -> (a -> b) -> AttrOp obj tag [:~>] :: (info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ AttrSet, AttrOpAllowed AttrSet info, AttrOpAllowed AttrGet info, (AttrSetTypeConstraint info) b, a ~ (AttrGetType info)) => AttrLabelProxy (attr :: Symbol) -> (a -> IO b) -> AttrOp obj tag [::=] :: (info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ AttrSet, AttrOpAllowed tag info, (AttrSetTypeConstraint info) b) => AttrLabelProxy (attr :: Symbol) -> (obj -> b) -> AttrOp obj tag [::~] :: (info ~ ResolveAttribute attr obj, AttrInfo info, AttrBaseTypeConstraint info obj, tag ~ AttrSet, AttrOpAllowed AttrSet info, AttrOpAllowed AttrGet info, (AttrSetTypeConstraint info) b, a ~ (AttrGetType info)) => AttrLabelProxy (attr :: Symbol) -> (obj -> a -> b) -> AttrOp obj tag -- | Get the value of an attribute for an object. get :: forall info attr obj m. (info ~ ResolveAttribute attr obj, AttrInfo info, (AttrBaseTypeConstraint info) obj, AttrOpAllowed AttrGet info, MonadIO m) => obj -> AttrLabelProxy (attr :: Symbol) -> m (AttrGetType info) -- | Set a number of properties for some object. set :: forall o m. MonadIO m => o -> [AttrOp o AttrSet] -> m () -- | A proxy for attribute labels. data AttrLabelProxy (a :: Symbol) AttrLabelProxy :: AttrLabelProxy instance (a Data.Type.Equality.~ x) => Data.GI.Base.Overloading.IsLabelProxy x (Data.GI.Base.Attributes.AttrLabelProxy a) instance (a Data.Type.Equality.~ x) => GHC.OverloadedLabels.IsLabel x (Data.GI.Base.Attributes.AttrLabelProxy a) module Data.GI.Base.Properties -- | Construct a GObject given the constructor and a list of settable -- attributes. AttrOps are always constructible, so we don't need to -- enforce constraints here. new :: forall o m. (GObject o, MonadIO m) => (ForeignPtr o -> o) -> [AttrOp o AttrConstruct] -> m o setObjectPropertyString :: GObject a => a -> String -> Text -> IO () setObjectPropertyStringArray :: GObject a => a -> String -> [Text] -> IO () setObjectPropertyPtr :: GObject a => a -> String -> Ptr b -> IO () setObjectPropertyCInt :: GObject a => a -> String -> Int32 -> IO () setObjectPropertyCUInt :: GObject a => a -> String -> Word32 -> IO () setObjectPropertyInt64 :: GObject a => a -> String -> Int64 -> IO () setObjectPropertyUInt64 :: GObject a => a -> String -> Word64 -> IO () setObjectPropertyFloat :: GObject a => a -> String -> Float -> IO () setObjectPropertyDouble :: GObject a => a -> String -> Double -> IO () setObjectPropertyBool :: GObject a => a -> String -> Bool -> IO () setObjectPropertyGType :: GObject a => a -> String -> GType -> IO () setObjectPropertyObject :: (GObject a, GObject b) => a -> String -> b -> IO () setObjectPropertyBoxed :: (GObject a, BoxedObject b) => a -> String -> b -> IO () setObjectPropertyEnum :: (GObject a, Enum b, BoxedEnum b) => a -> String -> b -> IO () setObjectPropertyFlags :: (IsGFlag b, GObject a) => a -> String -> [b] -> IO () setObjectPropertyVariant :: GObject a => a -> String -> GVariant -> IO () setObjectPropertyByteArray :: GObject a => a -> String -> ByteString -> IO () setObjectPropertyPtrGList :: GObject a => a -> String -> [Ptr b] -> IO () setObjectPropertyHash :: GObject a => a -> String -> b -> IO () getObjectPropertyString :: GObject a => a -> String -> IO Text getObjectPropertyStringArray :: GObject a => a -> String -> IO [Text] getObjectPropertyPtr :: GObject a => a -> String -> IO (Ptr b) getObjectPropertyCInt :: GObject a => a -> String -> IO Int32 getObjectPropertyCUInt :: GObject a => a -> String -> IO Word32 getObjectPropertyInt64 :: GObject a => a -> String -> IO Int64 getObjectPropertyUInt64 :: GObject a => a -> String -> IO Word64 getObjectPropertyFloat :: GObject a => a -> String -> IO Float getObjectPropertyDouble :: GObject a => a -> String -> IO Double getObjectPropertyBool :: GObject a => a -> String -> IO Bool getObjectPropertyGType :: GObject a => a -> String -> IO GType getObjectPropertyObject :: forall a b. (GObject a, GObject b) => a -> String -> (ForeignPtr b -> b) -> IO b getObjectPropertyBoxed :: forall a b. (GObject a, BoxedObject b) => a -> String -> (ForeignPtr b -> b) -> IO b getObjectPropertyEnum :: forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b getObjectPropertyFlags :: (GObject a, IsGFlag b) => a -> String -> IO [b] getObjectPropertyVariant :: GObject a => a -> String -> IO GVariant getObjectPropertyByteArray :: GObject a => a -> String -> IO ByteString getObjectPropertyPtrGList :: GObject a => a -> String -> IO [Ptr b] getObjectPropertyHash :: GObject a => a -> String -> IO b constructObjectPropertyString :: String -> Text -> IO (String, GValue) constructObjectPropertyStringArray :: String -> [Text] -> IO (String, GValue) constructObjectPropertyPtr :: String -> Ptr b -> IO (String, GValue) constructObjectPropertyCInt :: String -> Int32 -> IO (String, GValue) constructObjectPropertyCUInt :: String -> Word32 -> IO (String, GValue) constructObjectPropertyInt64 :: String -> Int64 -> IO (String, GValue) constructObjectPropertyUInt64 :: String -> Word64 -> IO (String, GValue) constructObjectPropertyFloat :: String -> Float -> IO (String, GValue) constructObjectPropertyDouble :: String -> Double -> IO (String, GValue) constructObjectPropertyBool :: String -> Bool -> IO (String, GValue) constructObjectPropertyGType :: String -> GType -> IO (String, GValue) constructObjectPropertyObject :: GObject a => String -> a -> IO (String, GValue) constructObjectPropertyBoxed :: (BoxedObject a) => String -> a -> IO (String, GValue) constructObjectPropertyEnum :: (Enum a, BoxedEnum a) => String -> a -> IO (String, GValue) constructObjectPropertyFlags :: IsGFlag a => String -> [a] -> IO (String, GValue) constructObjectPropertyVariant :: String -> GVariant -> IO (String, GValue) constructObjectPropertyByteArray :: String -> ByteString -> IO (String, GValue) constructObjectPropertyPtrGList :: String -> [Ptr a] -> IO (String, GValue) constructObjectPropertyHash :: String -> b -> IO (String, GValue) -- | Routines for connecting GObjects to signals. module Data.GI.Base.Signals -- | Same as connectSignal, specifying from the beginning that the -- handler is to be run before the default handler. -- --
--   on = connectSignal SignalConnectBefore
--   
on :: forall object info m. (GObject object, MonadIO m, SignalInfo info) => object -> SignalProxy object info -> HaskellCallbackType info -> m SignalHandlerId -- | Connect a signal to a handler, running the handler after the default -- one. -- --
--   after = connectSignal SignalConnectAfter
--   
after :: forall object info m. (GObject object, MonadIO m, SignalInfo info) => object -> SignalProxy object info -> HaskellCallbackType info -> m SignalHandlerId -- | Support for overloaded signal connectors. data SignalProxy (object :: *) (info :: *) [SignalProxy] :: SignalProxy o info [PropertyNotify] :: (info ~ ResolveAttribute propName o, AttrInfo info, pl ~ AttrLabel info) => AttrLabelProxy propName -> SignalProxy o (GObjectNotifySignalInfo pl) -- | Whether to connect a handler to a signal with connectSignal so -- that it runs before/after the default handler for the given signal. data SignalConnectMode -- | Run before the default handler. SignalConnectBefore :: SignalConnectMode -- | Run after the default handler. SignalConnectAfter :: SignalConnectMode -- | Connect a signal to a handler, given as a FunPtr. connectSignalFunPtr :: GObject o => o -> String -> FunPtr a -> SignalConnectMode -> IO SignalHandlerId -- | Type of a GObject signal handler id. type SignalHandlerId = Word64 -- | Information about an overloaded signal. class SignalInfo (info :: *) where type HaskellCallbackType info where { type family HaskellCallbackType info; } -- | Connect a Haskell function to a signal of the given GObject, -- specifying whether the handler will be called before or after the -- default handler. connectSignal :: (SignalInfo info, GObject o) => SignalProxy o info -> o -> HaskellCallbackType info -> SignalConnectMode -> IO SignalHandlerId -- | Connection information for a "notify" signal indicating that a -- specific property changed (see PropertyNotify for the relevant -- constructor). data GObjectNotifySignalInfo (propName :: Symbol) instance forall k (a :: k). Data.GI.Base.Signals.NoConstraint a instance (info Data.Type.Equality.~ Data.GI.Base.Overloading.ResolveSignal slot object) => Data.GI.Base.Overloading.IsLabelProxy slot (Data.GI.Base.Signals.SignalProxy object info) instance (info Data.Type.Equality.~ Data.GI.Base.Overloading.ResolveSignal slot object) => GHC.OverloadedLabels.IsLabel slot (Data.GI.Base.Signals.SignalProxy object info) instance GHC.TypeLits.KnownSymbol propName => Data.GI.Base.Signals.SignalInfo (Data.GI.Base.Signals.GObjectNotifySignalInfo propName) -- | The Haskell Prelude exports a number of symbols that can easily -- collide with functions appearing in bindings. The generated code -- requires just a small subset of the functions in the Prelude, which we -- reexport explicitly here. module Data.GI.Base.ShortPrelude -- | Class Enum defines operations on sequentially ordered types. -- -- The enumFrom... methods are used in Haskell's translation of -- arithmetic sequences. -- -- Instances of Enum may be derived for any enumeration type -- (types whose constructors have no fields). The nullary constructors -- are assumed to be numbered left-to-right by fromEnum from -- 0 through n-1. See Chapter 10 of the Haskell -- Report for more details. -- -- For any type that is an instance of class Bounded as well as -- Enum, the following should hold: -- -- -- --
--   enumFrom     x   = enumFromTo     x maxBound
--   enumFromThen x y = enumFromThenTo x y bound
--     where
--       bound | fromEnum y >= fromEnum x = maxBound
--             | otherwise                = minBound
--   
class Enum a -- | Convert from an Int. toEnum :: Int -> a -- | Convert to an Int. It is implementation-dependent what -- fromEnum returns when applied to a value that is too large to -- fit in an Int. fromEnum :: a -> Int -- | Conversion of values to readable Strings. -- -- Derived instances of Show have the following properties, which -- are compatible with derived instances of Read: -- -- -- -- For example, given the declarations -- --
--   infixr 5 :^:
--   data Tree a =  Leaf a  |  Tree a :^: Tree a
--   
-- -- the derived instance of Show is equivalent to -- --
--   instance (Show a) => Show (Tree a) where
--   
--          showsPrec d (Leaf m) = showParen (d > app_prec) $
--               showString "Leaf " . showsPrec (app_prec+1) m
--            where app_prec = 10
--   
--          showsPrec d (u :^: v) = showParen (d > up_prec) $
--               showsPrec (up_prec+1) u .
--               showString " :^: "      .
--               showsPrec (up_prec+1) v
--            where up_prec = 5
--   
-- -- Note that right-associativity of :^: is ignored. For example, -- -- class Show a -- | Convert a value to a readable String. -- -- showsPrec should satisfy the law -- --
--   showsPrec d x r ++ s  ==  showsPrec d x (r ++ s)
--   
-- -- Derived instances of Read and Show satisfy the -- following: -- -- -- -- That is, readsPrec parses the string produced by -- showsPrec, and delivers the value that showsPrec started -- with. showsPrec :: Int -> a -> ShowS -- | A specialised variant of showsPrec, using precedence context -- zero, and returning an ordinary String. show :: a -> String -- | The method showList is provided to allow the programmer to give -- a specialised way of showing lists of values. For example, this is -- used by the predefined Show instance of the Char type, -- where values of type String should be shown in double quotes, -- rather than between square brackets. showList :: [a] -> ShowS -- | The Eq class defines equality (==) and inequality -- (/=). All the basic datatypes exported by the Prelude -- are instances of Eq, and Eq may be derived for any -- datatype whose constituents are also instances of Eq. -- -- Minimal complete definition: either == or /=. class Eq a (==) :: a -> a -> Bool (/=) :: a -> a -> Bool -- | A value of type IO a is a computation which, when -- performed, does some I/O before returning a value of type a. -- -- There is really only one way to "perform" an I/O action: bind it to -- Main.main in your program. When your program is run, the I/O -- will be performed. It isn't possible to perform I/O from an arbitrary -- function, unless that function is itself in the IO monad and -- called at some point, directly or indirectly, from Main.main. -- -- IO is a monad, so IO actions can be combined using -- either the do-notation or the >> and >>= -- operations from the Monad class. data IO a :: TYPE Lifted -> TYPE Lifted -- | The Monad class defines the basic operations over a -- monad, a concept from a branch of mathematics known as -- category theory. From the perspective of a Haskell programmer, -- however, it is best to think of a monad as an abstract datatype -- of actions. Haskell's do expressions provide a convenient -- syntax for writing monadic expressions. -- -- Instances of Monad should satisfy the following laws: -- -- -- -- Furthermore, the Monad and Applicative operations should -- relate as follows: -- -- -- -- The above laws imply: -- -- -- -- and that pure and (<*>) satisfy the applicative -- functor laws. -- -- The instances of Monad for lists, Maybe and IO -- defined in the Prelude satisfy these laws. class Applicative m => Monad (m :: TYPE Lifted -> TYPE Lifted) -- | Sequentially compose two actions, passing any value produced by the -- first as an argument to the second. (>>=) :: m a -> (a -> m b) -> m b -- | Sequentially compose two actions, discarding any value produced by the -- first, like sequencing operators (such as the semicolon) in imperative -- languages. (>>) :: m a -> m b -> m b -- | Inject a value into the monadic type. return :: a -> m a -- | Fail with a message. This operation is not part of the mathematical -- definition of a monad, but is invoked on pattern-match failure in a -- do expression. -- -- As part of the MonadFail proposal (MFP), this function is moved to its -- own class MonadFail (see Control.Monad.Fail for more -- details). The definition here will be removed in a future release. fail :: String -> m a -- | The Maybe type encapsulates an optional value. A value of type -- Maybe a either contains a value of type a -- (represented as Just a), or it is empty (represented -- as Nothing). Using Maybe is a good way to deal with -- errors or exceptional cases without resorting to drastic measures such -- as error. -- -- The Maybe type is also a monad. It is a simple kind of error -- monad, where all errors are represented by Nothing. A richer -- error monad can be built using the Either type. data Maybe a :: TYPE Lifted -> TYPE Lifted Nothing :: Maybe a Just :: a -> Maybe a -- | Function composition. (.) :: (b -> c) -> (a -> b) -> a -> c infixr 9 . -- | Application operator. This operator is redundant, since ordinary -- application (f x) means the same as (f $ x). -- However, $ has low, right-associative binding precedence, so it -- sometimes allows parentheses to be omitted; for example: -- --
--   f $ g $ h x  =  f (g (h x))
--   
-- -- It is also useful in higher-order situations, such as map -- ($ 0) xs, or zipWith ($) fs xs. ($) :: (a -> b) -> a -> b infixr 0 $ -- | Append two lists, i.e., -- --
--   [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
--   [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
--   
-- -- If the first list is not finite, the result is the first list. (++) :: [a] -> [a] -> [a] infixr 5 ++ -- | Same as >>=, but with the arguments interchanged. (=<<) :: Monad m => (a -> m b) -> m a -> m b infixr 1 =<< data Bool :: TYPE Lifted False :: Bool True :: Bool -- | Single-precision floating point numbers. It is desirable that this -- type be at least equal in range and precision to the IEEE -- single-precision type. data Float :: TYPE Lifted -- | Double-precision floating point numbers. It is desirable that this -- type be at least equal in range and precision to the IEEE -- double-precision type. data Double :: TYPE Lifted -- | A special case of error. It is expected that compilers will -- recognize this and insert error messages which are more appropriate to -- the context in which undefined appears. undefined :: HasCallStack => a -- | error stops execution and displays an error message. error :: HasCallStack => [Char] -> a -- | map f xs is the list obtained by applying f -- to each element of xs, i.e., -- --
--   map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
--   map f [x1, x2, ...] == [f x1, f x2, ...]
--   
map :: (a -> b) -> [a] -> [b] -- | Returns the size/length of a finite structure as an Int. The -- default implementation is optimized for structures that are similar to -- cons-lists, because there is no general way to do better. length :: Foldable t => forall a. t a -> Int -- | Map each element of a structure to a monadic action, evaluate these -- actions from left to right, and collect the results. For a version -- that ignores the results see mapM_. mapM :: Traversable t => forall (m :: TYPE Lifted -> TYPE Lifted) a b. Monad m => (a -> m b) -> t a -> m (t b) -- | Map each element of a structure to a monadic action, evaluate these -- actions from left to right, and ignore the results. For a version that -- doesn't ignore the results see mapM. -- -- As of base 4.8.0.0, mapM_ is just traverse_, specialized -- to Monad. mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m () -- | Conditional execution of Applicative expressions. For example, -- --
--   when debug (putStrLn "Debugging")
--   
-- -- will output the string Debugging if the Boolean value -- debug is True, and otherwise do nothing. when :: Applicative f => Bool -> f () -> f () -- | general coercion from integral types fromIntegral :: (Integral a, Num b) => a -> b -- | general coercion to fractional types realToFrac :: (Real a, Fractional b) => a -> b -- |

Convenience header for basic GObject-Introspection modules

-- -- See the documentation for each individual module for a description and -- usage help. module Data.GI.Base