haskell-gi-0.24.3: Generate Haskell bindings for GObject Introspection capable libraries
Safe HaskellNone
LanguageHaskell2010

Data.GI.CodeGen.SymbolNaming

Synopsis

Documentation

lowerName :: Name -> Text Source #

Same as lowerSymbol, but accepts a Name. The namespace part of the name will be discarded.

Examples

Expand
>>> lowerName (Name "Gtk" "main_quit")
"mainQuit"

lowerSymbol :: Text -> Text Source #

Turn the given identifier into camelCase, starting with a lowercase letter.

Examples

Expand
>>> lowerSymbol "main_quit"
"mainQuit"

upperName :: Name -> Text Source #

Turn the given Name into CamelCase, starting with a capital letter.

Examples

Expand
>>> upperName (Name "Foo" "bar_baz")
"BarBaz"

escapedArgName :: Arg -> Text Source #

Name for the given argument, making sure it is a valid Haskell argument name (and escaping it if not).

classConstraint :: Name -> CodeGen Text Source #

Return a qualified form of the constraint for the given name (which should correspond to a valid TInterface).

typeConstraint :: Type -> CodeGen Text Source #

Same as classConstraint, but applicable directly to a type. The type should be a TInterface, otherwise an error will be raised.

hyphensToCamelCase :: Text -> Text Source #

Turn a hyphen-separated identifier into camel case.

Examples

Expand
>>> hyphensToCamelCase "one-sample-string"
"OneSampleString"

underscoresToCamelCase :: Text -> Text Source #

Similarly to hyphensToCamelCase, turn a name separated_by_underscores into CamelCase. We preserve final and initial underscores, and n>1 consecutive underscores are transformed into n-1 underscores.

Examples

Expand
>>> underscoresToCamelCase "sample_id"
"SampleId"
>>> underscoresToCamelCase "_internal_id_"
"_InternalId_"
>>> underscoresToCamelCase "multiple___underscores"
"Multiple__Underscores"

callbackCType :: Text -> Text Source #

Foreign type associated with a callback type. It can be passed in qualified.

callbackHTypeWithClosures :: Text -> Text Source #

Haskell type exposing the closure arguments, which are generally elided.

callbackDropClosures :: Text -> Text Source #

The name of a function which takes a callback without closure arguments, and generates a function which does accep the closures, but simply ignores them.

callbackDynamicWrapper :: Text -> Text Source #

The name of the dynamic wrapper for the given callback type. It can be passed in qualified.

callbackWrapperAllocator :: Text -> Text Source #

The name for the foreign wrapper allocator (foreign import "wrapper" ...) for the given callback type. It can be passed in qualified.

callbackHaskellToForeign :: Text -> Text Source #

The name of the Haskell to foreign wrapper for the given callback type. It can be passed in qualified.

callbackHaskellToForeignWithClosures :: Text -> Text Source #

The name of the Haskell to foreign wrapper for the given callback type, keeping the closure arguments (we usually elide them). The callback type can be passed in qualified.

callbackClosureGenerator :: Text -> Text Source #

The name for the closure generator for the given callback type. It can be passed in qualified.

signalHaskellName :: Text -> Text Source #

Return the name for the signal in Haskell CamelCase conventions.

signalInfoName :: Name -> Signal -> CodeGen Text Source #

Qualified name for the "(sigName, info)" tag for a given signal.

submoduleLocation :: Name -> API -> ModulePath Source #

Construct the submodule path where the given API element will live. This is the path relative to the root for the corresponding namespace. I.e. the GI.Gtk part is not prepended.

qualifiedAPI :: API -> Name -> CodeGen Text Source #

Return an identifier for the given interface type valid in the current module.

qualifiedSymbol :: Text -> Name -> CodeGen Text Source #

Construct an identifier for the given symbol in the given API.

normalizedAPIName :: API -> Name -> Name Source #

Construct the Haskell version of the name associated to the given API.