| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Data.GI.CodeGen.SymbolNaming
Synopsis
- lowerName :: Name -> Text
- lowerSymbol :: Text -> Text
- upperName :: Name -> Text
- noName :: Text -> CodeGen ()
- escapedArgName :: Arg -> Text
- classConstraint :: Name -> CodeGen Text
- typeConstraint :: Type -> CodeGen 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
- submoduleLocation :: Name -> API -> ModulePath
- qualifiedAPI :: Name -> CodeGen Text
- qualifiedSymbol :: Text -> Name -> CodeGen Text
Documentation
lowerName :: Name -> Text Source #
Same as lowerSymbol, but accepts a Name. The namespace part
of the name will be discarded.
Examples
>>>lowerName (Name "Gtk" "main_quit")"mainQuit"
lowerSymbol :: Text -> Text Source #
Turn the given identifier into camelCase, starting with a lowercase letter.
Examples
>>>lowerSymbol "main_quit""mainQuit"
upperName :: Name -> Text Source #
Turn the given Name into CamelCase, starting with a capital letter.
Examples
>>>upperName (Name "Foo" "bar_baz")"BarBaz"
noName :: Text -> CodeGen () Source #
Save a bit of typing for optional arguments in the case that we want to pass Nothing.
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
>>>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
>>>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.
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.