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

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

HsLua.Packaging.Types

Contents

- Documented Lua objects
- Documentation types
- Type classes

Description

Marshaling and documenting Haskell functions.

Synopsis

- data Module e = Module {
  - moduleName :: Name
  - moduleDescription :: Text
  - moduleFields :: [Field e]
  - moduleFunctions :: [DocumentedFunction e]
  - moduleOperations :: [(Operation, DocumentedFunction e)]
  - moduleTypeInitializers :: [LuaE e Name]
  - moduleTypeDocs :: [TypeDoc]
  }
- data Field e = Field {
  - fieldName :: Name
  - fieldDoc :: FieldDoc
  - fieldPushValue :: LuaE e ()
  }
- data DocumentedFunction e = DocumentedFunction {
  - callFunction :: LuaE e NumResults
  - functionName :: Name
  - functionDoc :: FunctionDoc
  }
- type DocumentedType e a = UDType e (DocumentedFunction e) a
- data DocumentationObject
  - = DocObjectFunction FunctionDoc
  - | DocObjectModule ModuleDoc
  - | DocObjectType TypeDoc
- 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 TypeDoc = TypeDoc {
  - typeDocName :: Text
  - typeDocDescription :: Text
  - typeDocOperations :: [(Operation, FunctionDoc)]
  - typeDocMethods :: [FunctionDoc]
  }
- data ParameterDoc = ParameterDoc {
  - parameterName :: Text
  - parameterType :: TypeSpec
  - parameterDescription :: Text
  - parameterIsOptional :: Bool
  }
- data ResultsDoc
  - = ResultsDocList [ResultValueDoc]
  - | ResultsDocMult Text
- data ResultValueDoc = ResultValueDoc {
  - resultValueType :: TypeSpec
  - resultValueDescription :: Text
  }
- data FieldDoc = FieldDoc {
  - fieldDocName :: Text
  - fieldDocType :: TypeSpec
  - fieldDocDescription :: Text
  }
- class HasName a where
  - getName :: a -> Name
  - setName :: a -> Name -> a
- class HasDescription a where
  - getDescription :: a -> Text
  - setDescription :: a -> Text -> a

# Documented Lua objects

data Module e Source #

Named and documented Lua module.

Constructors

Module |

Fields

- moduleName :: Name
- moduleDescription :: Text
- moduleFields :: [Field e]
- moduleFunctions :: [DocumentedFunction e]
- moduleOperations :: [(Operation, DocumentedFunction e)]
- moduleTypeInitializers :: [LuaE e Name]

  Lua initializers for the types that come with this module. Useful to force full initialization of all metatables.

- moduleTypeDocs :: [TypeDoc]

  Documentation for the types that are associated with this module.

#### Instances

Instances details

HasDescription (Module e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getDescription :: Module e -> Text Source # setDescription :: Module e -> Text -> Module e Source #
HasName (Module e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getName :: Module e -> Name Source # setName :: Module e -> Name -> Module e Source #

data Field e Source #

Self-documenting module field

Constructors

Field |

Fields

- fieldName :: Name
- fieldDoc :: FieldDoc
- fieldPushValue :: LuaE e ()

#### Instances

Instances details

HasDescription (Field e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getDescription :: Field e -> Text Source # setDescription :: Field e -> Text -> Field e Source #
HasName (Field e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getName :: Field e -> Name Source # setName :: Field e -> Name -> Field e Source #

data DocumentedFunction e Source #

Haskell equivallent to CFunction, i.e., function callable from Lua.

Constructors

DocumentedFunction |

Fields

- callFunction :: LuaE e NumResults
- functionName :: Name
- functionDoc :: FunctionDoc

#### Instances

Instances details

HasName (DocumentedFunction e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getName :: DocumentedFunction e -> Name Source # setName :: DocumentedFunction e -> Name -> DocumentedFunction e Source #

type DocumentedType e a = UDType e (DocumentedFunction e) a Source #

Type definitions containing documented functions.

# Documentation types

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 #

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 TypeDoc Source #

Documentation of a data type.

Constructors

TypeDoc |

Fields

- typeDocName :: Text
- typeDocDescription :: Text
- typeDocOperations :: [(Operation, FunctionDoc)]
- typeDocMethods :: [FunctionDoc]

#### Instances

Instances details

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

data ParameterDoc Source #

Documentation for function parameters.

Constructors

ParameterDoc |

Fields

- parameterName :: Text
- parameterType :: TypeSpec
- parameterDescription :: Text
- parameterIsOptional :: Bool

#### Instances

Instances details

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

Instance details

Defined in HsLua.Packaging.Types

Methods

compare :: ParameterDoc -> ParameterDoc -> Ordering Source #

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

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

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

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

max :: ParameterDoc -> ParameterDoc -> ParameterDoc Source #

min :: ParameterDoc -> ParameterDoc -> ParameterDoc Source #

data ResultsDoc Source #

Documentation for the return values of a function.

Constructors

ResultsDocList [ResultValueDoc] | List of individual results
ResultsDocMult Text | Flexible results

#### Instances

Instances details

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

Instance details

Defined in HsLua.Packaging.Types

Methods

compare :: ResultsDoc -> ResultsDoc -> Ordering Source #

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

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

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

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

max :: ResultsDoc -> ResultsDoc -> ResultsDoc Source #

min :: ResultsDoc -> ResultsDoc -> ResultsDoc Source #

data ResultValueDoc Source #

Documentation for a single return value of a function.

Constructors

ResultValueDoc |

Fields

- resultValueType :: TypeSpec
- resultValueDescription :: Text

#### Instances

Instances details

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

Instance details

Defined in HsLua.Packaging.Types

Methods

compare :: ResultValueDoc -> ResultValueDoc -> Ordering Source #

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

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

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

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

max :: ResultValueDoc -> ResultValueDoc -> ResultValueDoc Source #

min :: ResultValueDoc -> ResultValueDoc -> ResultValueDoc Source #

data FieldDoc Source #

Documentation for a module field.

Constructors

FieldDoc |

Fields

- fieldDocName :: Text
- fieldDocType :: TypeSpec
- fieldDocDescription :: Text

#### Instances

Instances details

Show FieldDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods showsPrec :: Int -> FieldDoc -> ShowS Source # show :: FieldDoc -> String Source # showList :: [FieldDoc] -> ShowS Source #
Eq FieldDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods (==) :: FieldDoc -> FieldDoc -> Bool Source # (/=) :: FieldDoc -> FieldDoc -> Bool Source #
Ord FieldDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods compare :: FieldDoc -> FieldDoc -> Ordering Source # (<) :: FieldDoc -> FieldDoc -> Bool Source # (<=) :: FieldDoc -> FieldDoc -> Bool Source # (>) :: FieldDoc -> FieldDoc -> Bool Source # (>=) :: FieldDoc -> FieldDoc -> Bool Source # max :: FieldDoc -> FieldDoc -> FieldDoc Source # min :: FieldDoc -> FieldDoc -> FieldDoc Source #
HasDescription FieldDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods getDescription :: FieldDoc -> Text Source # setDescription :: FieldDoc -> Text -> FieldDoc Source #

# Type classes

class HasName a where Source #

Named objects

Methods

getName :: a -> Name Source #

setName :: a -> Name -> a Source #

#### Instances

Instances details

HasName (DocumentedFunction e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getName :: DocumentedFunction e -> Name Source # setName :: DocumentedFunction e -> Name -> DocumentedFunction e Source #
HasName (Field e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getName :: Field e -> Name Source # setName :: Field e -> Name -> Field e Source #
HasName (Module e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getName :: Module e -> Name Source # setName :: Module e -> Name -> Module e Source #

class HasDescription a where Source #

Objects that have descriptions.

Methods

getDescription :: a -> Text Source #

setDescription :: a -> Text -> a Source #

#### Instances

Instances details

HasDescription FieldDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods getDescription :: FieldDoc -> Text Source # setDescription :: FieldDoc -> Text -> FieldDoc Source #
HasDescription ModuleDoc Source # |
Instance details Defined in HsLua.Packaging.Types Methods getDescription :: ModuleDoc -> Text Source # setDescription :: ModuleDoc -> Text -> ModuleDoc Source #
HasDescription (Field e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getDescription :: Field e -> Text Source # setDescription :: Field e -> Text -> Field e Source #
HasDescription (Module e) Source # |
Instance details Defined in HsLua.Packaging.Types Methods getDescription :: Module e -> Text Source # setDescription :: Module e -> Text -> Module e Source #