hslua-packaging-2.4.1: Utilities to build Lua modules.

Copyright | © 2020-2026 Albert Krewinkel
License | MIT
Maintainer | Albert Krewinkel <tarleb@hslua.org>
Safe Haskell | None
Language | Haskell2010

HsLua.Packaging.Documentation

Contents

- Setting and retrieving documentation
- Documentation Types
- Creating documentation values

Description

Provides a function to print documentation if available.

Synopsis

- getdocumentation :: LuaError e => StackIndex -> LuaE e Type
- registerDocumentation :: LuaError e => StackIndex -> LuaE e ()
- docsField :: Name
- data ModuleDoc = ModuleDoc {
  - moduleDocName :: Text
  - moduleDocDescription :: Text
  - moduleDocFields :: [FieldDoc]
  - moduleDocFunctions :: [FunctionDoc]
  - moduleDocTypes :: [TypeDoc]
  }
- data FunctionDoc = FunDoc {
  - funDocName :: Text
  - funDocDescription :: Text
  - funDocParameters :: [ParameterDoc]
  - funDocResults :: ResultsDoc
  - funDocSince :: Maybe Version
  }
- data DocumentationObject
  - = DocObjectFunction FunctionDoc
  - | DocObjectModule ModuleDoc
  - | DocObjectType TypeDoc
- pushDocumentationObject :: LuaError e => Pusher e DocumentationObject
- peekDocumentationObject :: Peeker e DocumentationObject
- pushModuleDoc :: LuaError e => Pusher e ModuleDoc
- peekModuleDoc :: Peeker e ModuleDoc
- pushFunctionDoc :: LuaError e => Pusher e FunctionDoc
- peekFunctionDoc :: Peeker e FunctionDoc
- pushTypeDoc :: LuaError e => Pusher e FunctionDoc
- peekTypeDoc :: Peeker e TypeDoc
- generateFunctionDocumentation :: Maybe Name -> DocumentedFunction e -> FunctionDoc
- generateModuleDocumentation :: Module e -> ModuleDoc
- generateTypeDocumentation :: DocumentedType e a -> TypeDoc

# Setting and retrieving documentation

getdocumentation :: LuaError e => StackIndex -> LuaE e Type Source #

Pushes the documentation for the element at the given stack index. Returns the type of the documentation object.

registerDocumentation Source #

Arguments

:: LuaError e |

=> StackIndex

    idx

-> LuaE e () |

Registers the object at the top of the stack as documentation for the object at index `idx`. Pops the documentation of the stack.

docsField :: Name Source #

Name of the registry field holding the documentation table. The documentation table is indexed by the documented objects, like module tables and functions, and contains documentation objects as values.

The table is an ephemeron table, i.e., an entry gets garbage collected if the key is no longer reachable.

# Documentation Types

data ModuleDoc Source #

Module documentation

Constructors

ModuleDoc |

Fields

- moduleDocName :: Text

  module name

- moduleDocDescription :: Text

  textual module description

- moduleDocFields :: [FieldDoc]

  module fields

- moduleDocFunctions :: [FunctionDoc]

  module functions

- moduleDocTypes :: [TypeDoc]

  module-associated types

#### Instances

Instances details

Show ModuleDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods showsPrec :: Int -> ModuleDoc -> ShowS Source # show :: ModuleDoc -> String Source # showList :: [ModuleDoc] -> ShowS Source #
Eq ModuleDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods (==) :: ModuleDoc -> ModuleDoc -> Bool Source # (/=) :: ModuleDoc -> ModuleDoc -> Bool Source #
Ord ModuleDoc Source # |

Instance details

Defined in HsLua.Packaging.Types

Methods

compare :: ModuleDoc -> ModuleDoc -> Ordering Source #

(<) :: ModuleDoc -> ModuleDoc -> Bool Source #

(<=) :: ModuleDoc -> ModuleDoc -> Bool Source #

(>) :: ModuleDoc -> ModuleDoc -> Bool Source #

(>=) :: ModuleDoc -> ModuleDoc -> Bool Source #

max :: ModuleDoc -> ModuleDoc -> ModuleDoc Source #

min :: ModuleDoc -> ModuleDoc -> ModuleDoc Source #

HasDescription ModuleDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods getDescription :: ModuleDoc -> Text Source # setDescription :: ModuleDoc -> Text -> ModuleDoc Source #

data FunctionDoc Source #

Documentation for a Haskell function

Constructors

FunDoc |

Fields

- funDocName :: Text
- funDocDescription :: Text
- funDocParameters :: [ParameterDoc]
- funDocResults :: ResultsDoc
- funDocSince :: Maybe Version

  Version in which the function was introduced.

#### Instances

Instances details

Show FunctionDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods showsPrec :: Int -> FunctionDoc -> ShowS Source # show :: FunctionDoc -> String Source # showList :: [FunctionDoc] -> ShowS Source #
Eq FunctionDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods (==) :: FunctionDoc -> FunctionDoc -> Bool Source # (/=) :: FunctionDoc -> FunctionDoc -> Bool Source #
Ord FunctionDoc Source # |

Instance details

Defined in HsLua.Packaging.Types

Methods

compare :: FunctionDoc -> FunctionDoc -> Ordering Source #

(<) :: FunctionDoc -> FunctionDoc -> Bool Source #

(<=) :: FunctionDoc -> FunctionDoc -> Bool Source #

(>) :: FunctionDoc -> FunctionDoc -> Bool Source #

(>=) :: FunctionDoc -> FunctionDoc -> Bool Source #

max :: FunctionDoc -> FunctionDoc -> FunctionDoc Source #

min :: FunctionDoc -> FunctionDoc -> FunctionDoc Source #

data DocumentationObject Source #

Documentation for any of the supported Lua objects.

Constructors

DocObjectFunction FunctionDoc |
DocObjectModule ModuleDoc |
DocObjectType TypeDoc |

#### Instances

Instances details

Show DocumentationObject Source # |
Instance details Defined in HsLua.Packaging.Types Methods showsPrec :: Int -> DocumentationObject -> ShowS Source # show :: DocumentationObject -> String Source # showList :: [DocumentationObject] -> ShowS Source #
Eq DocumentationObject Source # |
Instance details Defined in HsLua.Packaging.Types Methods (==) :: DocumentationObject -> DocumentationObject -> Bool Source # (/=) :: DocumentationObject -> DocumentationObject -> Bool Source #
Ord DocumentationObject Source # |

Instance details

Defined in HsLua.Packaging.Types

Methods

compare :: DocumentationObject -> DocumentationObject -> Ordering Source #

(<) :: DocumentationObject -> DocumentationObject -> Bool Source #

(<=) :: DocumentationObject -> DocumentationObject -> Bool Source #

(>) :: DocumentationObject -> DocumentationObject -> Bool Source #

(>=) :: DocumentationObject -> DocumentationObject -> Bool Source #

max :: DocumentationObject -> DocumentationObject -> DocumentationObject Source #

min :: DocumentationObject -> DocumentationObject -> DocumentationObject Source #

pushDocumentationObject :: LuaError e => Pusher e DocumentationObject Source #

Pushes a `DocumentationObject` to the Lua stack.

peekDocumentationObject :: Peeker e DocumentationObject Source #

Pushes the metatable for documentation objects.

pushModuleDoc :: LuaError e => Pusher e ModuleDoc Source #

Pushes the documentation of a module as userdata.

peekModuleDoc :: Peeker e ModuleDoc Source #

Retrieves a module documentation object from the Lua stack.

pushFunctionDoc :: LuaError e => Pusher e FunctionDoc Source #

Pushes function documentation as userdata.

peekFunctionDoc :: Peeker e FunctionDoc Source #

Retrieve function documentation from the Lua stack.

pushTypeDoc :: LuaError e => Pusher e FunctionDoc Source #

Pushes documentation type documentation as userdata.

peekTypeDoc :: Peeker e TypeDoc Source #

Retrieve function documentation from the Lua stack.

# Creating documentation values

generateFunctionDocumentation :: Maybe Name -> DocumentedFunction e -> FunctionDoc Source #

Generate `FunctionDoc` documentation for module functions.

generateModuleDocumentation :: Module e -> ModuleDoc Source #

Generate documentation for a module.

generateTypeDocumentation :: DocumentedType e a -> TypeDoc Source #

Generate documentation for a `UDType`.