Copyright | © 2023-2024 Albert Krewinkel |
---|---|
License | MIT |
Maintainer | Albert Krewinkel <tarleb@hslua.org> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The module provides Haskell types and values that can be used to describe and declare the types of Lua values.
Synopsis
- data TypeSpec
- data TypeDocs = TypeDocs {}
- (#|#) :: TypeSpec -> TypeSpec -> TypeSpec
- typeSpecToString :: TypeSpec -> String
- typeSpecFromString :: String -> TypeSpec
- anyType :: TypeSpec
- voidType :: TypeSpec
- booleanType :: TypeSpec
- functionType :: TypeSpec
- integerType :: TypeSpec
- lightUserdataType :: TypeSpec
- nilType :: TypeSpec
- numberType :: TypeSpec
- stringType :: TypeSpec
- tableType :: TypeSpec
- threadType :: TypeSpec
- userdataType :: TypeSpec
- recType :: [(Name, TypeSpec)] -> TypeSpec
- seqType :: TypeSpec -> TypeSpec
- pushTypeSpec :: LuaError e => TypeSpec -> LuaE e ()
- peekTypeSpec :: LuaError e => Peeker e TypeSpec
- pushTypeDoc :: LuaError e => Pusher e TypeDocs
- peekTypeDoc :: LuaError e => Peeker e TypeDocs
Documentation
Type specification for Lua values.
BasicType Type | Built-in type |
NamedType Name | A type that's been given a name. |
SeqType TypeSpec | Sequence of the given type. |
SumType [TypeSpec] | Union type; a sum type. |
RecType (Map Name TypeSpec) | Record type (type product). |
FunType [TypeSpec] [TypeSpec] | Function type. |
AnyType | Unconstrained type. |
Instances
Documented custom type.
TypeDocs | |
|
Instances
Generic TypeDocs Source # | |
Show TypeDocs Source # | |
Eq TypeDocs Source # | |
Ord TypeDocs Source # | |
Defined in HsLua.Typing | |
type Rep TypeDocs Source # | |
Defined in HsLua.Typing type Rep TypeDocs = D1 ('MetaData "TypeDocs" "HsLua.Typing" "hslua-typing-0.1.1-LiVjbUc2V3DIMCvCaKVrW5" 'False) (C1 ('MetaCons "TypeDocs" 'PrefixI 'True) (S1 ('MetaSel ('Just "typeDescription") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "typeSpec") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TypeSpec) :*: S1 ('MetaSel ('Just "typeRegistry") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Name))))) |
(#|#) :: TypeSpec -> TypeSpec -> TypeSpec Source #
Returns the sum of two type specifiers, declaring that a Lua value can have either type.
typeSpecToString :: TypeSpec -> String Source #
Generate a string representation of the type specifier.
typeSpecFromString :: String -> TypeSpec Source #
Creates a TypeSpec
value from a string.
The implementation currently handles basic types, sequences, and
alternatives. A string that cannot be parsed is returned as a Named
type with the full string as the name.
Types
Built-in types
booleanType :: TypeSpec Source #
The built-in boolean
Lua type.
functionType :: TypeSpec Source #
The built-in function
Lua type.
integerType :: TypeSpec Source #
A Lua integer type.
lightUserdataType :: TypeSpec Source #
The built-in light userdata
Lua type.
numberType :: TypeSpec Source #
The built-in number
Lua type.
stringType :: TypeSpec Source #
The built-in string
Lua type.
threadType :: TypeSpec Source #
The built-in thread
Lua type.
userdataType :: TypeSpec Source #
The built-in userdata
Lua type.
Type constructors
Marshalling
pushTypeSpec :: LuaError e => TypeSpec -> LuaE e () Source #
Pushes a table representation of a TypeSpec
to the stack.