-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generate Haskell bindings for GObject Introspection capable libraries -- -- Generate Haskell bindings for GObject Introspection capable libraries. -- This includes most notably Gtk+, but many other libraries in the -- GObject ecosystem provide introspection data too. @package haskell-gi @version 0.20 module Data.GI.CodeGen.Util prime :: Text -> Text parenthesize :: Text -> Text padTo :: Int -> Text -> Text withComment :: Text -> Text -> Text -- | Capitalize the first character of the given string. ucFirst :: Text -> Text -- | Make the first character of the given string lowercase. lcFirst :: Text -> Text -- | Apply the given modification function to the given symbol. If the -- symbol is qualified the modification will only apply to the last -- component. modifyQualified :: (Text -> Text) -> Text -> Text -- | Construct the Text representation of a showable. tshow :: Show a => a -> Text -- | Throw an error with the given Text. terror :: Text -> a -- | Project information to include in generated bindings, should be kept -- in sync with haskell-gi.cabal module Data.GI.CodeGen.ProjectInfo homepage :: Text authors :: Text license :: Text licenseText :: Text -- | Under which category in hackage should the generated bindings be -- listed. category :: Text maintainers :: Text -- | Default list of extensions to turn on when compiling the generated -- code. defaultExtensions :: [Text] -- | Extensions that will be used in some modules, but we do not wish to -- turn on by default. otherExtensions :: [Text] -- | Default options for GHC when compiling generated code. ghcOptions :: [Text] -- | Default version of the report to use. defaultLanguage :: Text -- | List of dependencies for all bindings. Notice that base is not -- included here, since not all bindings use the same base version. -- haskell-gi and haskell-gi-base are not included either, since the -- versions to use may change depending on whether we are using old style -- or new style bindings. standardDeps :: [Text] module Data.GI.CodeGen.PkgConfig -- | Get the pkg-config name and associated installed version of a given -- gobject-introspection namespace. Since the mapping is not one-to-one -- some guessing is involved, although in most cases the required -- information is listed in the GIR file. pkgConfigGetVersion :: Text -> Text -> [Text] -> Bool -> Map Text Text -> IO (Maybe (Text, Text)) -- | Try asking pkg-config for the version of a given module, and return -- the package name together with its version. tryPkgConfig :: Text -> IO (Maybe (Text, Text)) -- | A minimal wrapper for libgirepository. module Data.GI.CodeGen.LibGIRepository -- | Ensure that the given version of the namespace is loaded. If that is -- not possible we error out. girRequire :: Text -> Text -> IO Typelib -- | Extra info about a field in a struct or union which is not easily -- determined from the GIR file. (And which we determine by using -- libgirepository.) data FieldInfo FieldInfo :: Int -> FieldInfo [fieldInfoOffset] :: FieldInfo -> Int -- | Find out the size of a struct, and the map from field names to offsets -- inside the struct. girStructFieldInfo :: Text -> Text -> IO (Int, Map Text FieldInfo) -- | Find out the size of a union, and the map from field names to offsets -- inside the union. girUnionFieldInfo :: Text -> Text -> IO (Int, Map Text FieldInfo) -- | Load a GType given the namespace where it lives and the type init -- function. girLoadGType :: Text -> Text -> IO GType instance Data.GI.Base.BasicTypes.BoxedObject Data.GI.CodeGen.LibGIRepository.BaseInfo module Data.GI.CodeGen.GType data GType :: * gtypeIsA :: GType -> GType -> Bool gtypeIsBoxed :: GType -> Bool -- | Some helpers for making traversals of GIR documents easier. module Data.GI.GIR.XMLUtils -- | Turn a node into an element (if it is indeed an element node). nodeToElement :: Node -> Maybe Element -- | Find all children of the given element which are XML Elements -- themselves. subelements :: Element -> [Element] -- | The local name of an element. localName :: Element -> Text -- | Lookup an attribute for an element (with no prefix). lookupAttr :: Name -> Element -> Maybe Text -- | GIR namespaces we know about. data GIRXMLNamespace GLibGIRNS :: GIRXMLNamespace CGIRNS :: GIRXMLNamespace -- | Lookup an attribute for an element, given the namespace where it -- lives. lookupAttrWithNamespace :: GIRXMLNamespace -> Name -> Element -> Maybe Text -- | Restrict to those with the given local name. childElemsWithLocalName :: Text -> Element -> [Element] -- | Restrict to those with given name. childElemsWithNSName :: GIRXMLNamespace -> Text -> Element -> [Element] -- | Find the first child element with the given name. firstChildWithLocalName :: Text -> Element -> Maybe Element -- | Get the content of a given element, if it exists. getElementContent :: Element -> Maybe Text -- | Construct a Name by only giving the local name. xmlLocalName :: Text -> Name -- | Construct a Name specifying a namespace too. xmlNSName :: GIRXMLNamespace -> Text -> Name instance GHC.Show.Show Data.GI.GIR.XMLUtils.GIRXMLNamespace module Data.GI.GIR.Repository -- | Try to load the `.gir` file corresponding to the given repository readGiRepository :: Bool -> Text -> Maybe Text -> [FilePath] -> IO Document -- | Parsing of documentation nodes. module Data.GI.GIR.Documentation -- | Documentation for a given element. data Documentation Documentation :: Text -> Documentation [docText] :: Documentation -> Text -- | Parse the documentation node for the given element of the GIR file. queryDocumentation :: Element -> Maybe Documentation instance GHC.Classes.Eq Data.GI.GIR.Documentation.Documentation instance GHC.Show.Show Data.GI.GIR.Documentation.Documentation module Data.GI.GIR.Deprecation -- | Deprecation information on a symbol. data DeprecationInfo -- | Encode the given DeprecationInfo for the given symbol as a -- deprecation pragma. deprecatedPragma :: Text -> Maybe DeprecationInfo -> Text -- | Parse the deprecation information for the given element of the GIR -- file. queryDeprecated :: Element -> Maybe DeprecationInfo instance GHC.Classes.Eq Data.GI.GIR.Deprecation.DeprecationInfo instance GHC.Show.Show Data.GI.GIR.Deprecation.DeprecationInfo -- | Basic types used in GIR parsing. module Data.GI.GIR.BasicTypes -- | Name for a symbol in the GIR file. data Name Name :: Text -> Text -> Name [namespace] :: Name -> Text [name] :: Name -> Text -- | Transfer mode for an argument or property. data Transfer TransferNothing :: Transfer TransferContainer :: Transfer TransferEverything :: Transfer -- | An alias, which is simply (Namespace, name). newtype Alias Alias :: Name -> Alias -- | This type represents the types found in GObject Introspection -- interfaces: the types of constants, arguments, etc. data Type TBasicType :: BasicType -> Type -- | GError TError :: Type -- | GVariant TVariant :: Type -- | GParamSpec TParamSpec :: Type -- | Zero terminated, Array Fixed Size, Array Length, Element Type TCArray :: Bool -> Int -> Int -> Type -> Type -- | GArray TGArray :: Type -> Type -- | GPtrArray TPtrArray :: Type -> Type -- | GByteArray TByteArray :: Type -- | GList TGList :: Type -> Type -- | GSList TGSList :: Type -> Type -- | GHashTable TGHash :: Type -> Type -> Type -- | A reference to some API in the GIR TInterface :: Name -> Type -- | Basic types. These are generally trivial to marshal, and the GIR -- assumes that they are defined. data BasicType -- | gboolean TBoolean :: BasicType -- | gint TInt :: BasicType -- | guint TUInt :: BasicType -- | glong TLong :: BasicType -- | gulong TULong :: BasicType -- | gint8 TInt8 :: BasicType -- | guint8 TUInt8 :: BasicType -- | gint16 TInt16 :: BasicType -- | guint16 TUInt16 :: BasicType -- | gint32 TInt32 :: BasicType -- | guint32 TUInt32 :: BasicType -- | gint64 TInt64 :: BasicType -- | guint64 TUInt64 :: BasicType -- | gfloat TFloat :: BasicType -- | gdouble TDouble :: BasicType -- | gunichar TUniChar :: BasicType -- | GType TGType :: BasicType -- | gchar*, encoded as UTF-8 TUTF8 :: BasicType -- | gchar*, encoding a filename TFileName :: BasicType -- | gpointer TPtr :: BasicType -- | gintptr TIntPtr :: BasicType -- | guintptr TUIntPtr :: BasicType instance GHC.Classes.Ord Data.GI.GIR.BasicTypes.Type instance GHC.Show.Show Data.GI.GIR.BasicTypes.Type instance GHC.Classes.Eq Data.GI.GIR.BasicTypes.Type instance GHC.Classes.Ord Data.GI.GIR.BasicTypes.BasicType instance GHC.Show.Show Data.GI.GIR.BasicTypes.BasicType instance GHC.Classes.Eq Data.GI.GIR.BasicTypes.BasicType instance GHC.Show.Show Data.GI.GIR.BasicTypes.Alias instance GHC.Classes.Eq Data.GI.GIR.BasicTypes.Alias instance GHC.Classes.Ord Data.GI.GIR.BasicTypes.Alias instance GHC.Classes.Ord Data.GI.GIR.BasicTypes.Transfer instance GHC.Classes.Eq Data.GI.GIR.BasicTypes.Transfer instance GHC.Show.Show Data.GI.GIR.BasicTypes.Transfer instance GHC.Show.Show Data.GI.GIR.BasicTypes.Name instance GHC.Classes.Ord Data.GI.GIR.BasicTypes.Name instance GHC.Classes.Eq Data.GI.GIR.BasicTypes.Name -- | The Parser monad. module Data.GI.GIR.Parser -- | Monad where parsers live: we carry a context around, and can throw -- errors that abort the parsing. type Parser a = ReaderT ParseContext (Except ParseError) a -- | A message describing a parsing error in human readable form. type ParseError = Text -- | Throw a parse error. parseError :: ParseError -> Parser a -- | Run the given parser, returning either success or an error. runParser :: Text -> Map Alias Type -> Element -> Parser a -> Either ParseError a -- | Get the qualified name for the current element. parseName :: Parser Name -- | Parse the deprecation text, if present. parseDeprecation :: Parser (Maybe DeprecationInfo) -- | Parse the documentation text, if present. parseDocumentation :: Parser (Maybe Documentation) -- | Parse a signed integral number. parseIntegral :: Integral a => Text -> Parser a -- | A boolean value given by a numerical constant. parseBool :: Text -> Parser Bool -- | Parse all the introspectable subelements with the given local name. parseChildrenWithLocalName :: Text -> Parser a -> Parser [a] -- | Parse all subelements with the given local name. parseAllChildrenWithLocalName :: Text -> Parser a -> Parser [a] -- | Parse all introspectable children with the given namespace and local -- name. parseChildrenWithNSName :: GIRXMLNamespace -> Text -> Parser a -> Parser [a] -- | Return the value of an attribute for the given element. If the -- attribute is not present this throws an error. getAttr :: Name -> Parser Text -- | Like getAttr, but allow for specifying the namespace. getAttrWithNamespace :: GIRXMLNamespace -> Name -> Parser Text -- | Return the value of an attribute if it is present, and Nothing -- otherwise. queryAttr :: Name -> Parser (Maybe Text) -- | Like queryAttr, but allow for specifying the namespace. queryAttrWithNamespace :: GIRXMLNamespace -> Name -> Parser (Maybe Text) -- | Ask for an optional attribute, applying the given parser to it. If the -- argument does not exist return the default value provided. optionalAttr :: Name -> a -> (Text -> Parser a) -> Parser a -- | Return the current namespace. currentNamespace :: Parser Text -- | Build a Name out of the (possibly qualified) supplied name. If -- the supplied name is unqualified we qualify with the current -- namespace, and otherwise we simply parse it. qualifyName :: Text -> Parser Name -- | Check whether there is an alias for the given name, and return the -- corresponding type in case it exists, and otherwise a TInterface. resolveQualifiedTypeName :: Name -> Parser Type -- | Name for a symbol in the GIR file. data Name Name :: Text -> Text -> Name [namespace] :: Name -> Text [name] :: Name -> Text data Element :: * -- | GIR namespaces we know about. data GIRXMLNamespace GLibGIRNS :: GIRXMLNamespace CGIRNS :: GIRXMLNamespace -- | Deprecation information on a symbol. data DeprecationInfo -- | Documentation for a given element. data Documentation instance GHC.Show.Show Data.GI.GIR.Parser.ParseContext -- | Parsing of Enums. module Data.GI.GIR.Enum data Enumeration Enumeration :: [(Text, Int64)] -> Maybe Text -> Maybe Text -> Int -> Maybe DeprecationInfo -> Enumeration [enumValues] :: Enumeration -> [(Text, Int64)] [errorDomain] :: Enumeration -> Maybe Text [enumTypeInit] :: Enumeration -> Maybe Text -- | Bytes used for storage of this struct. [enumStorageBytes] :: Enumeration -> Int [enumDeprecated] :: Enumeration -> Maybe DeprecationInfo -- | Parse an "enumeration" element from the GIR file. parseEnum :: Parser (Name, Enumeration) instance GHC.Show.Show Data.GI.GIR.Enum.Enumeration -- | Parsing of bitfields, a.k.a. flags. They are represented in the same -- way as enums, so this is a thin wrapper over that code. module Data.GI.GIR.Flags data Flags Flags :: Enumeration -> Flags parseFlags :: Parser (Name, Flags) instance GHC.Show.Show Data.GI.GIR.Flags.Flags -- | Parsing type information from GIR files. module Data.GI.GIR.Type -- | Parse the type of a node (which will be described by a child node -- named "type" or "array"). parseType :: Parser Type -- | Parse the C-type associated to the element. If there is no "c:type" -- attribute we return the type name. parseCType :: Parser Text -- | Like parseType, but allow for none, returned as -- Nothing. parseOptionalType :: Parser (Maybe Type) -- | Parsing of constants in GIR files. module Data.GI.GIR.Constant -- | Info about a constant. data Constant Constant :: Type -> Text -> Maybe DeprecationInfo -> Constant [constantType] :: Constant -> Type [constantValue] :: Constant -> Text [constantDeprecated] :: Constant -> Maybe DeprecationInfo -- | Parse a "constant" element from the GIR file. parseConstant :: Parser (Name, Constant) instance GHC.Show.Show Data.GI.GIR.Constant.Constant -- | Type constructors. module Data.GI.CodeGen.Type -- | This type represents the types found in GObject Introspection -- interfaces: the types of constants, arguments, etc. data Type TBasicType :: BasicType -> Type -- | GError TError :: Type -- | GVariant TVariant :: Type -- | GParamSpec TParamSpec :: Type -- | Zero terminated, Array Fixed Size, Array Length, Element Type TCArray :: Bool -> Int -> Int -> Type -> Type -- | GArray TGArray :: Type -> Type -- | GPtrArray TPtrArray :: Type -> Type -- | GByteArray TByteArray :: Type -- | GList TGList :: Type -> Type -- | GSList TGSList :: Type -> Type -- | GHashTable TGHash :: Type -> Type -> Type -- | A reference to some API in the GIR TInterface :: Name -> Type -- | Basic types. These are generally trivial to marshal, and the GIR -- assumes that they are defined. data BasicType -- | gboolean TBoolean :: BasicType -- | gint TInt :: BasicType -- | guint TUInt :: BasicType -- | glong TLong :: BasicType -- | gulong TULong :: BasicType -- | gint8 TInt8 :: BasicType -- | guint8 TUInt8 :: BasicType -- | gint16 TInt16 :: BasicType -- | guint16 TUInt16 :: BasicType -- | gint32 TInt32 :: BasicType -- | guint32 TUInt32 :: BasicType -- | gint64 TInt64 :: BasicType -- | guint64 TUInt64 :: BasicType -- | gfloat TFloat :: BasicType -- | gdouble TDouble :: BasicType -- | gunichar TUniChar :: BasicType -- | GType TGType :: BasicType -- | gchar*, encoded as UTF-8 TUTF8 :: BasicType -- | gchar*, encoding a filename TFileName :: BasicType -- | gpointer TPtr :: BasicType -- | gintptr TIntPtr :: BasicType -- | guintptr TUIntPtr :: BasicType -- | Embed in the IO monad. io :: TypeRep -> TypeRep -- | A Ptr to the type. ptr :: TypeRep -> TypeRep -- | A FunPtr to the type. funptr :: TypeRep -> TypeRep -- | Type constructor applied to the given types. con :: Text -> [TypeRep] -> TypeRep -- | Embed in the Maybe monad. maybeT :: TypeRep -> TypeRep module Data.GI.GIR.Arg data Arg Arg :: Text -> Type -> Direction -> Bool -> Scope -> Int -> Int -> Bool -> Transfer -> Arg -- | C name for the argument. For a escaped name valid in Haskell -- code, use escapedArgName. [argCName] :: Arg -> Text [argType] :: Arg -> Type [direction] :: Arg -> Direction [mayBeNull] :: Arg -> Bool [argScope] :: Arg -> Scope [argClosure] :: Arg -> Int [argDestroy] :: Arg -> Int [argCallerAllocates] :: Arg -> Bool [transfer] :: Arg -> Transfer data Direction DirectionIn :: Direction DirectionOut :: Direction DirectionInout :: Direction data Scope ScopeTypeInvalid :: Scope ScopeTypeCall :: Scope ScopeTypeAsync :: Scope ScopeTypeNotified :: Scope parseArg :: Parser Arg parseTransfer :: Parser Transfer instance GHC.Classes.Ord Data.GI.GIR.Arg.Arg instance GHC.Classes.Eq Data.GI.GIR.Arg.Arg instance GHC.Show.Show Data.GI.GIR.Arg.Arg instance GHC.Classes.Ord Data.GI.GIR.Arg.Scope instance GHC.Classes.Eq Data.GI.GIR.Arg.Scope instance GHC.Show.Show Data.GI.GIR.Arg.Scope instance GHC.Classes.Ord Data.GI.GIR.Arg.Direction instance GHC.Classes.Eq Data.GI.GIR.Arg.Direction instance GHC.Show.Show Data.GI.GIR.Arg.Direction module Data.GI.GIR.Callable data Callable Callable :: Maybe Type -> Bool -> Transfer -> [Arg] -> Bool -> Maybe DeprecationInfo -> Callable [returnType] :: Callable -> Maybe Type [returnMayBeNull] :: Callable -> Bool [returnTransfer] :: Callable -> Transfer [args] :: Callable -> [Arg] [skipReturn] :: Callable -> Bool [callableDeprecated] :: Callable -> Maybe DeprecationInfo parseCallable :: Parser Callable instance GHC.Classes.Eq Data.GI.GIR.Callable.Callable instance GHC.Show.Show Data.GI.GIR.Callable.Callable -- | Parsing of callbacks. module Data.GI.GIR.Callback data Callback Callback :: Callable -> Callback parseCallback :: Parser (Name, Callback) instance GHC.Show.Show Data.GI.GIR.Callback.Callback -- | Parsing of objectstructunion fields. module Data.GI.GIR.Field data Field Field :: Text -> Bool -> Type -> Bool -> Maybe Callback -> Int -> [FieldInfoFlag] -> Maybe DeprecationInfo -> Field [fieldName] :: Field -> Text [fieldVisible] :: Field -> Bool [fieldType] :: Field -> Type [fieldIsPointer] :: Field -> Bool [fieldCallback] :: Field -> Maybe Callback [fieldOffset] :: Field -> Int [fieldFlags] :: Field -> [FieldInfoFlag] [fieldDeprecated] :: Field -> Maybe DeprecationInfo data FieldInfoFlag parseFields :: Parser [Field] instance GHC.Show.Show Data.GI.GIR.Field.Field instance GHC.Show.Show Data.GI.GIR.Field.FieldInfoFlag module Data.GI.GIR.Function data Function Function :: Text -> Bool -> Maybe Text -> Callable -> Function [fnSymbol] :: Function -> Text [fnThrows] :: Function -> Bool [fnMovedTo] :: Function -> Maybe Text [fnCallable] :: Function -> Callable parseFunction :: Parser (Name, Function) instance GHC.Show.Show Data.GI.GIR.Function.Function module Data.GI.GIR.Signal data Signal Signal :: Text -> Callable -> Maybe DeprecationInfo -> Signal [sigName] :: Signal -> Text [sigCallable] :: Signal -> Callable [sigDeprecated] :: Signal -> Maybe DeprecationInfo parseSignal :: Parser Signal instance GHC.Classes.Eq Data.GI.GIR.Signal.Signal instance GHC.Show.Show Data.GI.GIR.Signal.Signal module Data.GI.GIR.Method data Method Method :: Name -> Text -> Bool -> MethodType -> Maybe Text -> Callable -> Method [methodName] :: Method -> Name [methodSymbol] :: Method -> Text [methodThrows] :: Method -> Bool [methodType] :: Method -> MethodType [methodMovedTo] :: Method -> Maybe Text [methodCallable] :: Method -> Callable data MethodType -- | Constructs an instance of the parent type Constructor :: MethodType -- | A function in the namespace MemberFunction :: MethodType -- | A function taking the parent instance as first argument. OrdinaryMethod :: MethodType parseMethod :: MethodType -> Parser Method instance GHC.Show.Show Data.GI.GIR.Method.Method instance GHC.Classes.Eq Data.GI.GIR.Method.Method instance GHC.Show.Show Data.GI.GIR.Method.MethodType instance GHC.Classes.Eq Data.GI.GIR.Method.MethodType module Data.GI.GIR.Property data Property Property :: Text -> Type -> [PropertyFlag] -> Maybe Bool -> Maybe Bool -> Transfer -> Maybe DeprecationInfo -> Property [propName] :: Property -> Text [propType] :: Property -> Type [propFlags] :: Property -> [PropertyFlag] [propReadNullable] :: Property -> Maybe Bool [propWriteNullable] :: Property -> Maybe Bool [propTransfer] :: Property -> Transfer [propDeprecated] :: Property -> Maybe DeprecationInfo data PropertyFlag PropertyReadable :: PropertyFlag PropertyWritable :: PropertyFlag PropertyConstruct :: PropertyFlag PropertyConstructOnly :: PropertyFlag parseProperty :: Parser Property instance GHC.Classes.Eq Data.GI.GIR.Property.Property instance GHC.Show.Show Data.GI.GIR.Property.Property instance GHC.Classes.Eq Data.GI.GIR.Property.PropertyFlag instance GHC.Show.Show Data.GI.GIR.Property.PropertyFlag module Data.GI.GIR.Interface data Interface Interface :: Maybe Text -> [Name] -> [Property] -> [Signal] -> [Method] -> Maybe DeprecationInfo -> Interface [ifTypeInit] :: Interface -> Maybe Text [ifPrerequisites] :: Interface -> [Name] [ifProperties] :: Interface -> [Property] [ifSignals] :: Interface -> [Signal] [ifMethods] :: Interface -> [Method] [ifDeprecated] :: Interface -> Maybe DeprecationInfo parseInterface :: Parser (Name, Interface) instance GHC.Show.Show Data.GI.GIR.Interface.Interface -- | Parsing of objects. module Data.GI.GIR.Object data Object Object :: Maybe Name -> Text -> Text -> [Name] -> Maybe DeprecationInfo -> Maybe Documentation -> [Method] -> [Property] -> [Signal] -> Object [objParent] :: Object -> Maybe Name [objTypeInit] :: Object -> Text [objTypeName] :: Object -> Text [objInterfaces] :: Object -> [Name] [objDeprecated] :: Object -> Maybe DeprecationInfo [objDocumentation] :: Object -> Maybe Documentation [objMethods] :: Object -> [Method] [objProperties] :: Object -> [Property] [objSignals] :: Object -> [Signal] parseObject :: Parser (Name, Object) instance GHC.Show.Show Data.GI.GIR.Object.Object -- | Information on explicit allocation/deallocation for foreign pointers. module Data.GI.GIR.Allocation -- | Allocation/deallocation information for a given foreign pointer. data AllocationInfo AllocationInfo :: AllocationOp -> AllocationOp -> AllocationOp -> AllocationInfo [allocCalloc] :: AllocationInfo -> AllocationOp [allocCopy] :: AllocationInfo -> AllocationOp [allocFree] :: AllocationInfo -> AllocationOp -- | Information about a given allocation operation. It is either -- disallowed, allowed via the given function, or it is unknown at the -- current stage how to perform the operation. data AllocationOp AllocationOpUnknown :: AllocationOp AllocationOp :: Text -> AllocationOp -- | A convenience function, filling in all the allocation info to unknown. unknownAllocationInfo :: AllocationInfo instance GHC.Show.Show Data.GI.GIR.Allocation.AllocationInfo instance GHC.Classes.Eq Data.GI.GIR.Allocation.AllocationOp instance GHC.Show.Show Data.GI.GIR.Allocation.AllocationOp -- | Parsing of structs. module Data.GI.GIR.Struct data Struct Struct :: Bool -> AllocationInfo -> Maybe Text -> Int -> Maybe Name -> Bool -> [Field] -> [Method] -> Maybe DeprecationInfo -> Maybe Documentation -> Struct [structIsBoxed] :: Struct -> Bool [structAllocationInfo] :: Struct -> AllocationInfo [structTypeInit] :: Struct -> Maybe Text [structSize] :: Struct -> Int [gtypeStructFor] :: Struct -> Maybe Name [structIsDisguised] :: Struct -> Bool [structFields] :: Struct -> [Field] [structMethods] :: Struct -> [Method] [structDeprecated] :: Struct -> Maybe DeprecationInfo [structDocumentation] :: Struct -> Maybe Documentation parseStruct :: Parser (Name, Struct) instance GHC.Show.Show Data.GI.GIR.Struct.Struct -- | Parsing of unions. module Data.GI.GIR.Union data Union Union :: Bool -> AllocationInfo -> Int -> Maybe Text -> [Field] -> [Method] -> Maybe DeprecationInfo -> Union [unionIsBoxed] :: Union -> Bool [unionAllocationInfo] :: Union -> AllocationInfo [unionSize] :: Union -> Int [unionTypeInit] :: Union -> Maybe Text [unionFields] :: Union -> [Field] [unionMethods] :: Union -> [Method] [unionDeprecated] :: Union -> Maybe DeprecationInfo parseUnion :: Parser (Name, Union) instance GHC.Show.Show Data.GI.GIR.Union.Union module Data.GI.GIR.Alias -- | Find all aliases in a given document. documentListAliases :: Document -> Map Alias Type module Data.GI.CodeGen.API data API APIConst :: Constant -> API APIFunction :: Function -> API APICallback :: Callback -> API APIEnum :: Enumeration -> API APIFlags :: Flags -> API APIInterface :: Interface -> API APIObject :: Object -> API APIStruct :: Struct -> API APIUnion :: Union -> API data GIRInfo GIRInfo :: [Text] -> Text -> Text -> [(Name, API)] -> Map Text Name -> GIRInfo [girPCPackages] :: GIRInfo -> [Text] [girNSName] :: GIRInfo -> Text [girNSVersion] :: GIRInfo -> Text [girAPIs] :: GIRInfo -> [(Name, API)] [girCTypes] :: GIRInfo -> Map Text Name -- | Load and parse a GIR file, including its dependencies. loadGIRInfo :: Bool -> Text -> Maybe Text -> [FilePath] -> [GIRRule] -> IO (GIRInfo, [GIRInfo]) -- | Bare minimum loading and parsing of a single repository, without -- loading or parsing its dependencies, resolving aliases, or fixing up -- structs or interfaces. loadRawGIRInfo :: Bool -> Text -> Maybe Text -> [FilePath] -> IO GIRInfo -- | A rule for modifying the GIR file. data GIRRule -- | (Path to element, attrName), newValue GIRSetAttr :: (GIRPath, Name) -> Text -> GIRRule -- | Path to a node in the GIR file, starting from the document root of the -- GIR file. This is a very simplified version of something like XPath. type GIRPath = [GIRNodeSpec] -- | Node selector for a path in the GIR file. data GIRNodeSpec -- | Node with the given "name" attr. GIRNamed :: GIRNameTag -> GIRNodeSpec -- | Node of the given type. GIRType :: Text -> GIRNodeSpec -- | Combination of the above. GIRTypedName :: Text -> GIRNameTag -> GIRNodeSpec -- | A name tag, which is either a name or a regular expression. data GIRNameTag GIRPlainName :: Text -> GIRNameTag GIRRegex :: Text -> GIRNameTag -- | Name for a symbol in the GIR file. data Name Name :: Text -> Text -> Name [namespace] :: Name -> Text [name] :: Name -> Text -- | Transfer mode for an argument or property. data Transfer TransferNothing :: Transfer TransferContainer :: Transfer TransferEverything :: Transfer -- | Allocation/deallocation information for a given foreign pointer. data AllocationInfo AllocationInfo :: AllocationOp -> AllocationOp -> AllocationOp -> AllocationInfo [allocCalloc] :: AllocationInfo -> AllocationOp [allocCopy] :: AllocationInfo -> AllocationOp [allocFree] :: AllocationInfo -> AllocationOp -- | Information about a given allocation operation. It is either -- disallowed, allowed via the given function, or it is unknown at the -- current stage how to perform the operation. data AllocationOp AllocationOpUnknown :: AllocationOp AllocationOp :: Text -> AllocationOp -- | A convenience function, filling in all the allocation info to unknown. unknownAllocationInfo :: AllocationInfo data Direction DirectionIn :: Direction DirectionOut :: Direction DirectionInout :: Direction data Scope ScopeTypeInvalid :: Scope ScopeTypeCall :: Scope ScopeTypeAsync :: Scope ScopeTypeNotified :: Scope -- | Encode the given DeprecationInfo for the given symbol as a -- deprecation pragma. deprecatedPragma :: Text -> Maybe DeprecationInfo -> Text -- | Deprecation information on a symbol. data DeprecationInfo data PropertyFlag PropertyReadable :: PropertyFlag PropertyWritable :: PropertyFlag PropertyConstruct :: PropertyFlag PropertyConstructOnly :: PropertyFlag data MethodType -- | Constructs an instance of the parent type Constructor :: MethodType -- | A function in the namespace MemberFunction :: MethodType -- | A function taking the parent instance as first argument. OrdinaryMethod :: MethodType -- | Info about a constant. data Constant Constant :: Type -> Text -> Maybe DeprecationInfo -> Constant [constantType] :: Constant -> Type [constantValue] :: Constant -> Text [constantDeprecated] :: Constant -> Maybe DeprecationInfo data Arg Arg :: Text -> Type -> Direction -> Bool -> Scope -> Int -> Int -> Bool -> Transfer -> Arg -- | C name for the argument. For a escaped name valid in Haskell -- code, use escapedArgName. [argCName] :: Arg -> Text [argType] :: Arg -> Type [direction] :: Arg -> Direction [mayBeNull] :: Arg -> Bool [argScope] :: Arg -> Scope [argClosure] :: Arg -> Int [argDestroy] :: Arg -> Int [argCallerAllocates] :: Arg -> Bool [transfer] :: Arg -> Transfer data Callable Callable :: Maybe Type -> Bool -> Transfer -> [Arg] -> Bool -> Maybe DeprecationInfo -> Callable [returnType] :: Callable -> Maybe Type [returnMayBeNull] :: Callable -> Bool [returnTransfer] :: Callable -> Transfer [args] :: Callable -> [Arg] [skipReturn] :: Callable -> Bool [callableDeprecated] :: Callable -> Maybe DeprecationInfo data Function Function :: Text -> Bool -> Maybe Text -> Callable -> Function [fnSymbol] :: Function -> Text [fnThrows] :: Function -> Bool [fnMovedTo] :: Function -> Maybe Text [fnCallable] :: Function -> Callable data Signal Signal :: Text -> Callable -> Maybe DeprecationInfo -> Signal [sigName] :: Signal -> Text [sigCallable] :: Signal -> Callable [sigDeprecated] :: Signal -> Maybe DeprecationInfo data Property Property :: Text -> Type -> [PropertyFlag] -> Maybe Bool -> Maybe Bool -> Transfer -> Maybe DeprecationInfo -> Property [propName] :: Property -> Text [propType] :: Property -> Type [propFlags] :: Property -> [PropertyFlag] [propReadNullable] :: Property -> Maybe Bool [propWriteNullable] :: Property -> Maybe Bool [propTransfer] :: Property -> Transfer [propDeprecated] :: Property -> Maybe DeprecationInfo data Field Field :: Text -> Bool -> Type -> Bool -> Maybe Callback -> Int -> [FieldInfoFlag] -> Maybe DeprecationInfo -> Field [fieldName] :: Field -> Text [fieldVisible] :: Field -> Bool [fieldType] :: Field -> Type [fieldIsPointer] :: Field -> Bool [fieldCallback] :: Field -> Maybe Callback [fieldOffset] :: Field -> Int [fieldFlags] :: Field -> [FieldInfoFlag] [fieldDeprecated] :: Field -> Maybe DeprecationInfo data Struct Struct :: Bool -> AllocationInfo -> Maybe Text -> Int -> Maybe Name -> Bool -> [Field] -> [Method] -> Maybe DeprecationInfo -> Maybe Documentation -> Struct [structIsBoxed] :: Struct -> Bool [structAllocationInfo] :: Struct -> AllocationInfo [structTypeInit] :: Struct -> Maybe Text [structSize] :: Struct -> Int [gtypeStructFor] :: Struct -> Maybe Name [structIsDisguised] :: Struct -> Bool [structFields] :: Struct -> [Field] [structMethods] :: Struct -> [Method] [structDeprecated] :: Struct -> Maybe DeprecationInfo [structDocumentation] :: Struct -> Maybe Documentation data Callback Callback :: Callable -> Callback data Interface Interface :: Maybe Text -> [Name] -> [Property] -> [Signal] -> [Method] -> Maybe DeprecationInfo -> Interface [ifTypeInit] :: Interface -> Maybe Text [ifPrerequisites] :: Interface -> [Name] [ifProperties] :: Interface -> [Property] [ifSignals] :: Interface -> [Signal] [ifMethods] :: Interface -> [Method] [ifDeprecated] :: Interface -> Maybe DeprecationInfo data Method Method :: Name -> Text -> Bool -> MethodType -> Maybe Text -> Callable -> Method [methodName] :: Method -> Name [methodSymbol] :: Method -> Text [methodThrows] :: Method -> Bool [methodType] :: Method -> MethodType [methodMovedTo] :: Method -> Maybe Text [methodCallable] :: Method -> Callable data Object Object :: Maybe Name -> Text -> Text -> [Name] -> Maybe DeprecationInfo -> Maybe Documentation -> [Method] -> [Property] -> [Signal] -> Object [objParent] :: Object -> Maybe Name [objTypeInit] :: Object -> Text [objTypeName] :: Object -> Text [objInterfaces] :: Object -> [Name] [objDeprecated] :: Object -> Maybe DeprecationInfo [objDocumentation] :: Object -> Maybe Documentation [objMethods] :: Object -> [Method] [objProperties] :: Object -> [Property] [objSignals] :: Object -> [Signal] data Enumeration Enumeration :: [(Text, Int64)] -> Maybe Text -> Maybe Text -> Int -> Maybe DeprecationInfo -> Enumeration [enumValues] :: Enumeration -> [(Text, Int64)] [errorDomain] :: Enumeration -> Maybe Text [enumTypeInit] :: Enumeration -> Maybe Text -- | Bytes used for storage of this struct. [enumStorageBytes] :: Enumeration -> Int [enumDeprecated] :: Enumeration -> Maybe DeprecationInfo data Flags Flags :: Enumeration -> Flags data Union Union :: Bool -> AllocationInfo -> Int -> Maybe Text -> [Field] -> [Method] -> Maybe DeprecationInfo -> Union [unionIsBoxed] :: Union -> Bool [unionAllocationInfo] :: Union -> AllocationInfo [unionSize] :: Union -> Int [unionTypeInit] :: Union -> Maybe Text [unionFields] :: Union -> [Field] [unionMethods] :: Union -> [Method] [unionDeprecated] :: Union -> Maybe DeprecationInfo instance GHC.Show.Show Data.GI.CodeGen.API.GIRInfo instance GHC.Show.Show Data.GI.CodeGen.API.GIRInfoParse instance GHC.Show.Show Data.GI.CodeGen.API.GIRNamespace instance GHC.Show.Show Data.GI.CodeGen.API.API instance GHC.Show.Show Data.GI.CodeGen.API.GIRRule instance GHC.Show.Show Data.GI.CodeGen.API.GIRNodeSpec instance GHC.Show.Show Data.GI.CodeGen.API.GIRNameTag -- | Various fixups in the introspection data. module Data.GI.CodeGen.Fixups -- | Remove functions and methods annotated with "moved-to". dropMovedItems :: API -> Maybe API -- | GObject-introspection does not currently support nullability -- annotations, so we try to guess the nullability from the nullability -- annotations of the curresponding get/set methods, which in principle -- should be reliable. guessPropertyNullability :: (Name, API) -> (Name, API) module Data.GI.CodeGen.Overrides data Overrides -- | Parse the given config file (as a set of lines) for a given -- introspection namespace, filling in the configuration as needed. In -- case the parsing fails we return a description of the error instead. parseOverridesFile :: [Text] -> IO (Either Text Overrides) -- | Load a given API, applying filtering. Load also any necessary -- dependencies. filterAPIsAndDeps :: Overrides -> GIRInfo -> [GIRInfo] -> (Map Name API, Map Name API) instance GHC.Show.Show Data.GI.CodeGen.Overrides.OSType instance GHC.Show.Show Data.GI.CodeGen.Overrides.ParserState instance GHC.Show.Show Data.GI.CodeGen.Overrides.Overrides instance GHC.Base.Monoid Data.GI.CodeGen.Overrides.Overrides -- | Configuration for the code generator. module Data.GI.CodeGen.Config data Config Config :: Maybe Text -> Bool -> Overrides -> CodeGenFlags -> Config -- | Name of the module being generated. [modName] :: Config -> Maybe Text -- | Whether to print extra info. [verbose] :: Config -> Bool -- | List of loaded overrides for the code generator. [overrides] :: Config -> Overrides -- | List of flags for the code generator. [cgFlags] :: Config -> CodeGenFlags -- | Flags controlling different aspects of the code generator. data CodeGenFlags CodeGenFlags :: Bool -> Bool -> Bool -> CodeGenFlags -- | Whether to generate overloaded properties. [cgOverloadedProperties] :: CodeGenFlags -> Bool -- | Whether to generate support for overloaded signals. [cgOverloadedSignals] :: CodeGenFlags -> Bool -- | Whether to generate support for overloaded methods. [cgOverloadedMethods] :: CodeGenFlags -> Bool instance GHC.Show.Show Data.GI.CodeGen.Config.Config instance GHC.Show.Show Data.GI.CodeGen.Config.CodeGenFlags module Data.GI.CodeGen.Code data Code -- | No code NoCode :: Code -- | A single line, indented to current indentation Line :: Text -> Code -- | Indented region Indent :: Code -> Code -- | The basic sequence of code Sequence :: (Seq Code) -> Code -- | A grouped set of lines Group :: Code -> Code -- | Information on a generated module. data ModuleInfo ModuleInfo :: ModuleName -> Code -> Code -> Map Text ModuleInfo -> Deps -> Seq Export -> Set ModuleName -> Set Text -> Set Text -> Set ModuleFlag -> Maybe Text -> BaseVersion -> ModuleInfo -- | Full module name: [GI, Gtk, Label]. [moduleName] :: ModuleInfo -> ModuleName -- | Generated code for the module. [moduleCode] :: ModuleInfo -> Code -- | Interface going into the .hs-boot file. [bootCode] :: ModuleInfo -> Code -- | Indexed by the relative module name. [submodules] :: ModuleInfo -> Map Text ModuleInfo -- | Set of dependencies for this module. [moduleDeps] :: ModuleInfo -> Deps -- | Exports for the module. [moduleExports] :: ModuleInfo -> Seq Export -- | Qualified (source) imports [qualifiedImports] :: ModuleInfo -> Set ModuleName -- | Set of language pragmas for the module. [modulePragmas] :: ModuleInfo -> Set Text -- | GHC options for compiling the module. [moduleGHCOpts] :: ModuleInfo -> Set Text -- | Flags for the module. [moduleFlags] :: ModuleInfo -> Set ModuleFlag -- | Documentation for the module. [moduleDoc] :: ModuleInfo -> Maybe Text -- | Minimal version of base the module will work on. [moduleMinBase] :: ModuleInfo -> BaseVersion -- | Flags for module code generation. data ModuleFlag -- | Use the standard prelude, instead of the haskell-gi-base short one. ImplicitPrelude :: ModuleFlag type BaseCodeGen excType a = ReaderT CodeGenConfig (StateT ModuleInfo (ExceptT excType IO)) a -- | The code generator monad, for generators that cannot throw errors. The -- fact that they cannot throw errors is encoded in the forall, which -- disallows any operation on the error, except discarding it or passing -- it along without inspecting. This last operation is useful in order to -- allow embedding CodeGen computations inside ExcCodeGen -- computations, while disallowing the opposite embedding without -- explicit error handling. type CodeGen a = forall e. BaseCodeGen e a -- | Code generators that can throw errors. type ExcCodeGen a = BaseCodeGen CGError a data CGError CGErrorNotImplemented :: Text -> CGError CGErrorBadIntrospectionInfo :: Text -> CGError CGErrorMissingInfo :: Text -> CGError -- | Like evalCodeGen, but discard the resulting output value. genCode :: Config -> Map Name API -> ModuleName -> CodeGen () -> IO ModuleInfo -- | Run a code generator, and return the information for the generated -- module together with the return value of the generator. evalCodeGen :: Config -> Map Name API -> ModuleName -> CodeGen a -> IO (a, ModuleInfo) -- | Write down the code for a module and its submodules to disk under the -- given base directory. It returns the list of written modules. writeModuleTree :: Bool -> Maybe FilePath -> ModuleInfo -> IO [Text] -- | Return the list of modules writeModuleTree would write, without -- actually writing anything to disk. listModuleTree :: ModuleInfo -> [Text] -- | Return a text representation of the Code. codeToText :: Code -> Text -- | Return the transitive set of dependencies, i.e. the union of those of -- the module and (transitively) its submodules. transitiveModuleDeps :: ModuleInfo -> Deps -- | Return the minimal base version supported by the module and all its -- submodules. minBaseVersion :: ModuleInfo -> BaseVersion -- | Minimal version of base supported by a given module. data BaseVersion -- |