haskell-gi-0.20: Generate Haskell bindings for GObject Introspection capable libraries

Safe HaskellNone
LanguageHaskell98

Data.GI.CodeGen.Conversions

Synopsis

Documentation

convert :: Text -> BaseCodeGen e Converter -> BaseCodeGen e Text Source #

genConversion :: Text -> Converter -> CodeGen Text Source #

unpackCArray :: Text -> Type -> Transfer -> ExcCodeGen Converter Source #

callableHasClosures :: Callable -> Bool Source #

Whether the callable has closure arguments (i.e. "user_data" style arguments).

hToF :: Type -> Transfer -> ExcCodeGen Converter Source #

fToH :: Type -> Transfer -> ExcCodeGen Converter Source #

isoHaskellType :: Type -> CodeGen TypeRep Source #

Basically like haskellType, but for types which admit a "isomorphic" version of the Haskell type distinct from the usual Haskell type. Generally the Haskell type we expose is isomorphic to the foreign type, but in some cases, such as callbacks with closure arguments, this does not hold, as we omit the closure arguments. This function returns a type which is actually isomorphic.

argumentType :: [Char] -> Type -> CodeGen ([Char], Text, [Text]) Source #

elementMap :: Type -> Text -> Maybe Text Source #

elementTypeAndMap :: Type -> Text -> Maybe (Type, Text) Source #

isManaged :: Type -> CodeGen Bool Source #

Returns whether the given type corresponds to a ManagedPtr instance (a thin wrapper over a ForeignPtr).

typeIsNullable :: Type -> CodeGen Bool Source #

Returns whether the given type should be represented by a Maybe type on the Haskell side. This applies to all properties which have a C representation in terms of pointers, except for G(S)Lists, for which NULL is a valid G(S)List, and raw pointers, which we just pass through to the Haskell side. Notice that introspection annotations can override this.

typeIsPtr :: Type -> CodeGen Bool Source #

Returns whether the given type is represented by a pointer on the C side.

maybeNullConvert :: Type -> CodeGen (Maybe Text) Source #

If the passed in type is nullable, return the conversion function between the FFI pointer type (may be a Ptr or a FunPtr) and the corresponding Maybe type.

nullPtrForType :: Type -> CodeGen (Maybe Text) Source #

An appropriate NULL value for the given type, for types which are represented by pointers on the C side.

typeAllocInfo :: Type -> CodeGen (Maybe TypeAllocInfo) Source #

Information on how to allocate the given type, if known.

data TypeAllocInfo Source #

Information on how to allocate a type.

Constructors

TypeAllocInfo 

apply :: Constructor -> Converter Source #

mapC :: Constructor -> Converter Source #

literal :: Constructor -> Converter Source #