-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Type specifiers for Lua.
--   
--   Structure to hold detailed type information. The primary use-case at
--   this time are auto-generated docs.
@package hslua-typing
@version 0.1.1

-- | The module provides Haskell types and values that can be used to
--   describe and declare the types of Lua values.
module HsLua.Typing

-- | Type specification for Lua values.
data TypeSpec

-- | Built-in type
BasicType :: Type -> TypeSpec

-- | A type that's been given a name.
NamedType :: Name -> TypeSpec

-- | Sequence of the given type.
SeqType :: TypeSpec -> TypeSpec

-- | Union type; a sum type.
SumType :: [TypeSpec] -> TypeSpec

-- | Record type (type product).
RecType :: Map Name TypeSpec -> TypeSpec

-- | Function type.
FunType :: [TypeSpec] -> [TypeSpec] -> TypeSpec

-- | Unconstrained type.
AnyType :: TypeSpec

-- | Documented custom type.
data TypeDocs
TypeDocs :: Text -> TypeSpec -> Maybe Name -> TypeDocs
[typeDescription] :: TypeDocs -> Text
[typeSpec] :: TypeDocs -> TypeSpec
[typeRegistry] :: TypeDocs -> Maybe Name

-- | Returns the sum of two type specifiers, declaring that a Lua value can
--   have either type.
(#|#) :: TypeSpec -> TypeSpec -> TypeSpec

-- | Generate a string representation of the type specifier.
typeSpecToString :: TypeSpec -> String

-- | 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.
typeSpecFromString :: String -> TypeSpec

-- | Unconstraint type; any Lua value.
anyType :: TypeSpec

-- | A type for which there cannot be any value.
voidType :: TypeSpec

-- | The built-in boolean Lua type.
booleanType :: TypeSpec

-- | The built-in function Lua type.
functionType :: TypeSpec

-- | A Lua integer type.
integerType :: TypeSpec

-- | The built-in light userdata Lua type.
lightUserdataType :: TypeSpec

-- | The built-in nil Lua type.
nilType :: TypeSpec

-- | The built-in number Lua type.
numberType :: TypeSpec

-- | The built-in string Lua type.
stringType :: TypeSpec

-- | The built-in table Lua type.
tableType :: TypeSpec

-- | The built-in thread Lua type.
threadType :: TypeSpec

-- | The built-in userdata Lua type.
userdataType :: TypeSpec

-- | Creates a record type.
recType :: [(Name, TypeSpec)] -> TypeSpec

-- | Creates a sequence type.
seqType :: TypeSpec -> TypeSpec

-- | Pushes a table representation of a TypeSpec to the stack.
pushTypeSpec :: LuaError e => TypeSpec -> LuaE e ()

-- | Retrieves a TypeSpec from a table on the stack.
peekTypeSpec :: LuaError e => Peeker e TypeSpec

-- | Pushes documentation for a custom type.
pushTypeDoc :: LuaError e => Pusher e TypeDocs

-- | Retrieves a custom type specifier.
peekTypeDoc :: LuaError e => Peeker e TypeDocs
instance GHC.Classes.Eq HsLua.Typing.TypeDocs
instance GHC.Classes.Eq HsLua.Typing.TypeSpec
instance GHC.Internal.Generics.Generic HsLua.Typing.TypeDocs
instance GHC.Internal.Generics.Generic HsLua.Typing.TypeSpec
instance GHC.Internal.Data.String.IsString HsLua.Typing.TypeSpec
instance GHC.Classes.Ord HsLua.Typing.TypeDocs
instance GHC.Classes.Ord HsLua.Typing.TypeSpec
instance GHC.Internal.Show.Show HsLua.Typing.TypeDocs
instance GHC.Internal.Show.Show HsLua.Typing.TypeSpec
