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

Safe HaskellNone
LanguageHaskell98

Data.GI.Base.Overloading

Contents

Description

Helpers for dealing with GObjects.

Synopsis

Type level inheritance

type family ParentTypes a :: [*] Source #

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.

type family IsDescendantOf (parent :: *) (descendant :: *) :: Constraint where ... Source #

Check that a type is in the list of GObjectParents of another GObject-derived type.

Equations

IsDescendantOf d d = () ~ () 
IsDescendantOf p d = CheckForAncestorType d p (ParentTypes d) ~ HasAncestor p d 

type family UnknownAncestorError (a :: *) (t :: *) where ... Source #

Type error to be generated when an ancestor check fails.

Equations

UnknownAncestorError a t = TypeError ((((Text "Required ancestor \8216" :<>: ShowType a) :<>: Text "\8217 not found for type \8216") :<>: ShowType t) :<>: Text "\8217.") 

Looking up attributes in parent types

type family AttributeList a :: [(Symbol, *)] Source #

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.

class HasAttributeList a Source #

A constraint on a type, to be fulfilled whenever it has a type instance for AttributeList. This is here for nicer error reporting.

Instances
(TypeError ((Text "Type \8216" :<>: ShowType a) :<>: Text "\8217 does not have any known attributes.") :: Constraint) => HasAttributeList (a :: k) Source # 
Instance details

Defined in Data.GI.Base.Overloading

type family ResolveAttribute (s :: Symbol) (o :: *) :: * where ... Source #

Return the type encoding the attribute information for a given type and attribute.

Equations

ResolveAttribute s o = FindElement s (AttributeList o) ((((Text "Unknown attribute \8216" :<>: Text s) :<>: Text "\8217 for object \8216") :<>: ShowType o) :<>: Text "\8217.") 

type family HasAttribute (attr :: Symbol) (o :: *) where ... Source #

A constraint imposing that the given object has the given attribute.

Equations

HasAttribute attr o = IsElem attr (AttributeList o) HasAttribute ((((Text "Attribute \8216" :<>: Text attr) :<>: Text "\8217 not found for type \8216") :<>: ShowType o) :<>: Text "\8217.") ~ HasAttribute 

class HasAttr (attr :: Symbol) (o :: *) Source #

A constraint that enforces that the given type has a given attribute.

Instances
HasAttribute attr o => HasAttr attr o Source # 
Instance details

Defined in Data.GI.Base.Overloading

Looking up signals in parent types

type family SignalList a :: [(Symbol, *)] Source #

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.

type family ResolveSignal (s :: Symbol) (o :: *) :: * where ... Source #

Return the type encoding the signal information for a given type and signal.

Equations

ResolveSignal s o = FindElement s (SignalList o) ((((Text "Unknown signal \8216" :<>: Text s) :<>: Text "\8217 for object \8216") :<>: ShowType o) :<>: Text "\8217.") 

type family HasSignal (s :: Symbol) (o :: *) where ... Source #

A constraint enforcing that the signal exists for the given object, or one of its ancestors.

Equations

HasSignal s o = IsElem s (SignalList o) HasSignal ((((Text "Signal \8216" :<>: Text s) :<>: Text "\8217 not found for type \8216") :<>: ShowType o) :<>: Text "\8217.") ~ HasSignal 

Looking up methods in parent types

class MethodInfo i o s where Source #

Class for types containing the information about an overloaded method of type `o -> s`.

Methods

overloadedMethod :: MethodProxy i -> o -> s Source #

data MethodProxy a Source #

Proxy for passing a type to overloadedMethod. We do not use Proxy directly since it clashes with types defined in the autogenerated bindings.

Constructors

MethodProxy 

type family MethodResolutionFailed (method :: Symbol) (o :: *) where ... Source #

Equations

MethodResolutionFailed m o = TypeError ((((Text "Unknown method \8216" :<>: Text m) :<>: Text "\8217 for type \8216") :<>: ShowType o) :<>: Text "\8217.") 

Overloaded labels

class IsLabelProxy (x :: Symbol) a where Source #

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.)

Methods

fromLabelProxy :: Proxy x -> a Source #

Instances
a ~ x => IsLabelProxy x (AttrLabelProxy a) Source #

Support for overloaded labels.

Instance details

Defined in Data.GI.Base.Attributes

info ~ ResolveSignal slot object => IsLabelProxy slot (SignalProxy object info) Source #

Support for overloaded labels.

Instance details

Defined in Data.GI.Base.Signals

Methods

fromLabelProxy :: Proxy slot -> SignalProxy object info Source #

class IsLabel (x :: Symbol) a where #

Methods

fromLabel :: a #

Instances
a ~ x => IsLabel x (AttrLabelProxy a) Source # 
Instance details

Defined in Data.GI.Base.Attributes

info ~ ResolveSignal slot object => IsLabel slot (SignalProxy object info) Source # 
Instance details

Defined in Data.GI.Base.Signals

Methods

fromLabel :: SignalProxy object info #