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

Safe Haskell | None
Language | Haskell2010

Data.GI.CodeGen.SymbolNaming

Synopsis

- lowerName :: Name -> Text
- lowerSymbol :: Text -> Text
- upperName :: Name -> Text
- escapedArgName :: Arg -> Text
- classConstraint :: Name -> CodeGen e Text
- typeConstraint :: Type -> CodeGen e Text
- safeCast :: Name -> CodeGen e Text
- hyphensToCamelCase :: Text -> Text
- underscoresToCamelCase :: Text -> Text
- callbackCType :: Text -> Text
- callbackHTypeWithClosures :: Text -> Text
- callbackDropClosures :: Text -> Text
- callbackDynamicWrapper :: Text -> Text
- callbackWrapperAllocator :: Text -> Text
- callbackHaskellToForeign :: Text -> Text
- callbackHaskellToForeignWithClosures :: Text -> Text
- callbackClosureGenerator :: Text -> Text
- signalHaskellName :: Text -> Text
- signalInfoName :: Name -> Signal -> CodeGen e Text
- submoduleLocation :: Name -> API -> ModulePath
- moduleLocation :: Name -> API -> ModulePath
- qualifiedAPI :: API -> Name -> CodeGen e Text
- qualifiedSymbol :: Text -> Name -> CodeGen e Text
- normalizedAPIName :: API -> Name -> Name
- hackageModuleLink :: Name -> CodeGen e Text
- haddockSignalAnchor :: Text
- haddockAttrAnchor :: Text

# Documentation

lowerName :: Name -> Text Source #

Turn the given `Name` into CamelCase, starting with a lowercase letter. The resulting identifier will be qualified by the namespace if necessary.

### Examples

Expand

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

    >>> lowerName (Name "NM" "80211Test")
    "nM80211Test"

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. The resulting identifier will be qualified by the namespace if necessary.

### Examples

Expand

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

    >>> upperName (Name "NM" "80211ApFlags")
    "NM80211ApFlags"

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 e Text Source #

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

typeConstraint :: Type -> CodeGen e Text Source #

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

safeCast :: Name -> CodeGen e Text Source #

Return a qualified form of the function mapping instances of `IsX` to haskell values of type `X`.

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

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

Obtain the absolute location of the module where the given `API` lives.

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

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

qualifiedSymbol :: Text -> Name -> CodeGen e 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.

hackageModuleLink :: Name -> CodeGen e Text Source #

Return a link to the hackage package for the given name. Note that the generated link will only be valid if the name belongs to the binding which is currently being generated.

haddockSignalAnchor :: Text Source #

Prefix in Haddock for the signal anchor.

haddockAttrAnchor :: Text Source #

Prefix in Haddock for the attribute anchor.