    {-# LINE 1 "src/Lua/Types.hsc" #-}
    {-# LANGUAGE DeriveGeneric              #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE PatternSynonyms            #-}
    {-|
    Module      : Lua.Types
    Copyright   : © 2007–2012 Gracjan Polak;
                  © 2012–2016 Ömer Sinan Ağacan;
                  © 2017-2024 Albert Krewinkel
    License     : MIT
    Maintainer  : Albert Krewinkel <tarleb@hslua.org>
    Stability   : beta
    Portability : non-portable (depends on GHC)

    The core Lua types, including mappings of Lua types to Haskell.
    -}
    module Lua.Types
      ( State (..)
      , Reader
      , TypeCode (..)
      , CFunction
      , PreCFunction
      , WarnFunction
      , PreWarnFunction
      , LuaBool (..)
      , Integer (..)
      , Number (..)
      , StackIndex (..)
      , NumArgs (..)
      , NumResults (..)
      , OPCode (..)
      , ArithOPCode (..)
      , StatusCode (..)
        -- * Garbage-Collection
      , GCCode (..)
      )
    where

    import Prelude hiding (Integer)

    import Data.Bifunctor (first)
    import Data.Int (Int64)
    {-# LINE 44 "src/Lua/Types.hsc" #-}
    import Foreign.C (CChar, CInt, CSize, CString)
    import Foreign.Ptr (FunPtr, Ptr)
    import Foreign.Storable (Storable)
    import GHC.Generics (Generic)

    -- | An opaque structure that points to a thread and indirectly (through the
    -- thread) to the whole state of a Lua interpreter. The Lua library is fully
    -- reentrant: it has no global variables. All information about a state is
    -- accessible through this structure.
    --
    -- Synonym for @lua_State *@. See
    -- <https://www.lua.org/manual/5.4/#lua_State lua_State>.
    newtype State = State (Ptr ()) deriving (State -> State -> Bool
    (State -> State -> Bool) -> (State -> State -> Bool) -> Eq State
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: State -> State -> Bool
    == :: State -> State -> Bool
    $c/= :: State -> State -> Bool
    /= :: State -> State -> Bool
    Eq, (forall x. State -> Rep State x)
    -> (forall x. Rep State x -> State) -> Generic State
    forall x. Rep State x -> State
    forall x. State -> Rep State x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. State -> Rep State x
    from :: forall x. State -> Rep State x
    $cto :: forall x. Rep State x -> State
    to :: forall x. Rep State x -> State
    Generic)

    -- |  Type for C functions.
    --
    -- In order to communicate properly with Lua, a C function must use the
    -- following protocol, which defines the way parameters and results are
    -- passed: a C function receives its arguments from Lua in its stack in
    -- direct order (the first argument is pushed first). So, when the
    -- function starts, @'Lua.Functions.lua_gettop'@ returns the
    -- number of arguments received by the function. The first argument (if
    -- any) is at index 1 and its last argument is at index
    -- @'Lua.Functions.lua_gettop'@. To return values to Lua, a C
    -- function just pushes them onto the stack, in direct order (the first
    -- result is pushed first), and returns the number of results. Any other
    -- value in the stack below the results will be properly discarded by
    -- Lua. Like a Lua function, a C function called by Lua can also return
    -- many results.
    --
    -- See
    -- <https://www.lua.org/manual/5.4/manual.html#lua_CFunction lua_CFunction>.
    type CFunction = FunPtr PreCFunction

    -- | Type of Haskell functions that can be turned into C functions.
    --
    -- This is the same as a dereferenced 'CFunction'.
    type PreCFunction = State -> IO NumResults

    -- | The reader function used by @'Lua.load'@.
    -- Every time it needs another piece of the chunk, lua_load calls the
    -- reader, passing along its data parameter. The reader must return a
    -- pointer to a block of memory with a new piece of the chunk and set
    -- size to the block size. The block must exist until the reader
    -- function is called again. To signal the end of the chunk, the reader
    -- must return @NULL@ or set size to zero. The reader function may
    -- return pieces of any size greater than zero.
    --
    -- See <https://www.lua.org/manual/5.4/manual.html#lua_Reader lua_Reader>.
    type Reader = FunPtr (State -> Ptr () -> Ptr CSize -> IO (Ptr CChar))

    -- | The type of warning functions, called by Lua to emit warnings. The
    -- first parameter is an opaque pointer set by 'lua_setwarnf'. The
    -- second parameter is the warning message. The third parameter is a
    -- boolean that indicates whether the message is to be continued by the
    -- message in the next call.
    --
    -- See <https://www.lua.org/manual/5.4/manual.html#pdf-warn warn> for
    -- more details about warnings.
    type WarnFunction = FunPtr (Ptr () -> CString -> LuaBool -> IO ())

    -- | Type of Haskell functions that can be turned into a WarnFunction.
    --
    -- This is the same as a dereferenced 'WarnFunction'.
    type PreWarnFunction = Ptr () -> CString -> LuaBool -> IO ()

    -- |  The type of integers in Lua.
    --
    -- By default this type is @'Int64'@, but that can be changed to
    -- different values in Lua. (See @LUA_INT_TYPE@ in @luaconf.h@.)
    --
    -- See <https://www.lua.org/manual/5.4/manual.html#lua_Integer lua_Integer>.
    newtype Integer = Integer Int64
    {-# LINE 118 "src/Lua/Types.hsc" #-}
      deriving (Bounded, Enum, Eq, Integral, Num, Ord, Real)
    -- we should be able to use deriving strategies if we decide to drop
    -- support for GHC 8.0
    instance Show Integer where
      show :: Integer -> String
    show (Integer Int64
    i) = Int64 -> String
    forall a. Show a => a -> String
    show Int64
    i
    instance Read Integer where
      readsPrec :: Int -> ReadS Integer
    readsPrec Int
    i = ((Int64, String) -> (Integer, String))
    -> [(Int64, String)] -> [(Integer, String)]
    forall a b. (a -> b) -> [a] -> [b]
    map ((Int64 -> Integer) -> (Int64, String) -> (Integer, String)
    forall a b c. (a -> b) -> (a, c) -> (b, c)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first Int64 -> Integer
    Integer) ([(Int64, String)] -> [(Integer, String)])
    -> (String -> [(Int64, String)]) -> ReadS Integer
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> [(Int64, String)]
    forall a. Read a => Int -> ReadS a
    readsPrec Int
    i

    -- |  The type of floats in Lua.
    --
    -- By default this type is @'Double'@, but that can be changed in Lua to
    -- a single float or a long double. (See @LUA_FLOAT_TYPE@ in
    -- @luaconf.h@.)
    --
    -- See <https://www.lua.org/manual/5.4/manual.html#lua_Number lua_Number>.
    newtype Number = Number Double
    {-# LINE 134 "src/Lua/Types.hsc" #-}
      deriving (Eq, Floating, Fractional, Num, Ord, Real, RealFloat, RealFrac)
    -- we should be able to use deriving strategies if we decide to drop
    -- support for GHC 8.0
    instance Show Number where
      show :: Number -> String
    show (Number Double
    n) = Double -> String
    forall a. Show a => a -> String
    show Double
    n
    instance Read Number where
      readsPrec :: Int -> ReadS Number
    readsPrec Int
    i = ((Double, String) -> (Number, String))
    -> [(Double, String)] -> [(Number, String)]
    forall a b. (a -> b) -> [a] -> [b]
    map ((Double -> Number) -> (Double, String) -> (Number, String)
    forall a b c. (a -> b) -> (a, c) -> (b, c)
    forall (p :: * -> * -> *) a b c.
    Bifunctor p =>
    (a -> b) -> p a c -> p b c
    first Double -> Number
    Number) ([(Double, String)] -> [(Number, String)])
    -> (String -> [(Double, String)]) -> ReadS Number
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Int -> String -> [(Double, String)]
    forall a. Read a => Int -> ReadS a
    readsPrec Int
    i

    -- | Boolean value returned by a Lua C API function. This is a @'CInt'@
    -- and should be interpreted as @'False'@ iff the value is @0@, @'True'@
    -- otherwise.
    newtype LuaBool = LuaBool CInt
      deriving (LuaBool -> LuaBool -> Bool
    (LuaBool -> LuaBool -> Bool)
    -> (LuaBool -> LuaBool -> Bool) -> Eq LuaBool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: LuaBool -> LuaBool -> Bool
    == :: LuaBool -> LuaBool -> Bool
    $c/= :: LuaBool -> LuaBool -> Bool
    /= :: LuaBool -> LuaBool -> Bool
    Eq, Ptr LuaBool -> IO LuaBool
    Ptr LuaBool -> Int -> IO LuaBool
    Ptr LuaBool -> Int -> LuaBool -> IO ()
    Ptr LuaBool -> LuaBool -> IO ()
    LuaBool -> Int
    (LuaBool -> Int)
    -> (LuaBool -> Int)
    -> (Ptr LuaBool -> Int -> IO LuaBool)
    -> (Ptr LuaBool -> Int -> LuaBool -> IO ())
    -> (forall b. Ptr b -> Int -> IO LuaBool)
    -> (forall b. Ptr b -> Int -> LuaBool -> IO ())
    -> (Ptr LuaBool -> IO LuaBool)
    -> (Ptr LuaBool -> LuaBool -> IO ())
    -> Storable LuaBool
    forall b. Ptr b -> Int -> IO LuaBool
    forall b. Ptr b -> Int -> LuaBool -> IO ()
    forall a.
    (a -> Int)
    -> (a -> Int)
    -> (Ptr a -> Int -> IO a)
    -> (Ptr a -> Int -> a -> IO ())
    -> (forall b. Ptr b -> Int -> IO a)
    -> (forall b. Ptr b -> Int -> a -> IO ())
    -> (Ptr a -> IO a)
    -> (Ptr a -> a -> IO ())
    -> Storable a
    $csizeOf :: LuaBool -> Int
    sizeOf :: LuaBool -> Int
    $calignment :: LuaBool -> Int
    alignment :: LuaBool -> Int
    $cpeekElemOff :: Ptr LuaBool -> Int -> IO LuaBool
    peekElemOff :: Ptr LuaBool -> Int -> IO LuaBool
    $cpokeElemOff :: Ptr LuaBool -> Int -> LuaBool -> IO ()
    pokeElemOff :: Ptr LuaBool -> Int -> LuaBool -> IO ()
    $cpeekByteOff :: forall b. Ptr b -> Int -> IO LuaBool
    peekByteOff :: forall b. Ptr b -> Int -> IO LuaBool
    $cpokeByteOff :: forall b. Ptr b -> Int -> LuaBool -> IO ()
    pokeByteOff :: forall b. Ptr b -> Int -> LuaBool -> IO ()
    $cpeek :: Ptr LuaBool -> IO LuaBool
    peek :: Ptr LuaBool -> IO LuaBool
    $cpoke :: Ptr LuaBool -> LuaBool -> IO ()
    poke :: Ptr LuaBool -> LuaBool -> IO ()
    Storable, Int -> LuaBool -> ShowS
    [LuaBool] -> ShowS
    LuaBool -> String
    (Int -> LuaBool -> ShowS)
    -> (LuaBool -> String) -> ([LuaBool] -> ShowS) -> Show LuaBool
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> LuaBool -> ShowS
    showsPrec :: Int -> LuaBool -> ShowS
    $cshow :: LuaBool -> String
    show :: LuaBool -> String
    $cshowList :: [LuaBool] -> ShowS
    showList :: [LuaBool] -> ShowS
    Show)

    -- | Integer code used to encode the type of a Lua value.
    newtype TypeCode = TypeCode { TypeCode -> CInt
    fromTypeCode :: CInt }
      deriving (TypeCode -> TypeCode -> Bool
    (TypeCode -> TypeCode -> Bool)
    -> (TypeCode -> TypeCode -> Bool) -> Eq TypeCode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: TypeCode -> TypeCode -> Bool
    == :: TypeCode -> TypeCode -> Bool
    $c/= :: TypeCode -> TypeCode -> Bool
    /= :: TypeCode -> TypeCode -> Bool
    Eq, Eq TypeCode
    Eq TypeCode =>
    (TypeCode -> TypeCode -> Ordering)
    -> (TypeCode -> TypeCode -> Bool)
    -> (TypeCode -> TypeCode -> Bool)
    -> (TypeCode -> TypeCode -> Bool)
    -> (TypeCode -> TypeCode -> Bool)
    -> (TypeCode -> TypeCode -> TypeCode)
    -> (TypeCode -> TypeCode -> TypeCode)
    -> Ord TypeCode
    TypeCode -> TypeCode -> Bool
    TypeCode -> TypeCode -> Ordering
    TypeCode -> TypeCode -> TypeCode
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: TypeCode -> TypeCode -> Ordering
    compare :: TypeCode -> TypeCode -> Ordering
    $c< :: TypeCode -> TypeCode -> Bool
    < :: TypeCode -> TypeCode -> Bool
    $c<= :: TypeCode -> TypeCode -> Bool
    <= :: TypeCode -> TypeCode -> Bool
    $c> :: TypeCode -> TypeCode -> Bool
    > :: TypeCode -> TypeCode -> Bool
    $c>= :: TypeCode -> TypeCode -> Bool
    >= :: TypeCode -> TypeCode -> Bool
    $cmax :: TypeCode -> TypeCode -> TypeCode
    max :: TypeCode -> TypeCode -> TypeCode
    $cmin :: TypeCode -> TypeCode -> TypeCode
    min :: TypeCode -> TypeCode -> TypeCode
    Ord, Int -> TypeCode -> ShowS
    [TypeCode] -> ShowS
    TypeCode -> String
    (Int -> TypeCode -> ShowS)
    -> (TypeCode -> String) -> ([TypeCode] -> ShowS) -> Show TypeCode
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> TypeCode -> ShowS
    showsPrec :: Int -> TypeCode -> ShowS
    $cshow :: TypeCode -> String
    show :: TypeCode -> String
    $cshowList :: [TypeCode] -> ShowS
    showList :: [TypeCode] -> ShowS
    Show)

    -- | Relational operator code.
    newtype OPCode = OPCode CInt deriving (OPCode -> OPCode -> Bool
    (OPCode -> OPCode -> Bool)
    -> (OPCode -> OPCode -> Bool) -> Eq OPCode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: OPCode -> OPCode -> Bool
    == :: OPCode -> OPCode -> Bool
    $c/= :: OPCode -> OPCode -> Bool
    /= :: OPCode -> OPCode -> Bool
    Eq, Ptr OPCode -> IO OPCode
    Ptr OPCode -> Int -> IO OPCode
    Ptr OPCode -> Int -> OPCode -> IO ()
    Ptr OPCode -> OPCode -> IO ()
    OPCode -> Int
    (OPCode -> Int)
    -> (OPCode -> Int)
    -> (Ptr OPCode -> Int -> IO OPCode)
    -> (Ptr OPCode -> Int -> OPCode -> IO ())
    -> (forall b. Ptr b -> Int -> IO OPCode)
    -> (forall b. Ptr b -> Int -> OPCode -> IO ())
    -> (Ptr OPCode -> IO OPCode)
    -> (Ptr OPCode -> OPCode -> IO ())
    -> Storable OPCode
    forall b. Ptr b -> Int -> IO OPCode
    forall b. Ptr b -> Int -> OPCode -> IO ()
    forall a.
    (a -> Int)
    -> (a -> Int)
    -> (Ptr a -> Int -> IO a)
    -> (Ptr a -> Int -> a -> IO ())
    -> (forall b. Ptr b -> Int -> IO a)
    -> (forall b. Ptr b -> Int -> a -> IO ())
    -> (Ptr a -> IO a)
    -> (Ptr a -> a -> IO ())
    -> Storable a
    $csizeOf :: OPCode -> Int
    sizeOf :: OPCode -> Int
    $calignment :: OPCode -> Int
    alignment :: OPCode -> Int
    $cpeekElemOff :: Ptr OPCode -> Int -> IO OPCode
    peekElemOff :: Ptr OPCode -> Int -> IO OPCode
    $cpokeElemOff :: Ptr OPCode -> Int -> OPCode -> IO ()
    pokeElemOff :: Ptr OPCode -> Int -> OPCode -> IO ()
    $cpeekByteOff :: forall b. Ptr b -> Int -> IO OPCode
    peekByteOff :: forall b. Ptr b -> Int -> IO OPCode
    $cpokeByteOff :: forall b. Ptr b -> Int -> OPCode -> IO ()
    pokeByteOff :: forall b. Ptr b -> Int -> OPCode -> IO ()
    $cpeek :: Ptr OPCode -> IO OPCode
    peek :: Ptr OPCode -> IO OPCode
    $cpoke :: Ptr OPCode -> OPCode -> IO ()
    poke :: Ptr OPCode -> OPCode -> IO ()
    Storable, Int -> OPCode -> ShowS
    [OPCode] -> ShowS
    OPCode -> String
    (Int -> OPCode -> ShowS)
    -> (OPCode -> String) -> ([OPCode] -> ShowS) -> Show OPCode
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> OPCode -> ShowS
    showsPrec :: Int -> OPCode -> ShowS
    $cshow :: OPCode -> String
    show :: OPCode -> String
    $cshowList :: [OPCode] -> ShowS
    showList :: [OPCode] -> ShowS
    Show)

    -- | Arithmetic operator code.
    newtype ArithOPCode = ArithOPCode CInt deriving (ArithOPCode -> ArithOPCode -> Bool
    (ArithOPCode -> ArithOPCode -> Bool)
    -> (ArithOPCode -> ArithOPCode -> Bool) -> Eq ArithOPCode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ArithOPCode -> ArithOPCode -> Bool
    == :: ArithOPCode -> ArithOPCode -> Bool
    $c/= :: ArithOPCode -> ArithOPCode -> Bool
    /= :: ArithOPCode -> ArithOPCode -> Bool
    Eq, Ptr ArithOPCode -> IO ArithOPCode
    Ptr ArithOPCode -> Int -> IO ArithOPCode
    Ptr ArithOPCode -> Int -> ArithOPCode -> IO ()
    Ptr ArithOPCode -> ArithOPCode -> IO ()
    ArithOPCode -> Int
    (ArithOPCode -> Int)
    -> (ArithOPCode -> Int)
    -> (Ptr ArithOPCode -> Int -> IO ArithOPCode)
    -> (Ptr ArithOPCode -> Int -> ArithOPCode -> IO ())
    -> (forall b. Ptr b -> Int -> IO ArithOPCode)
    -> (forall b. Ptr b -> Int -> ArithOPCode -> IO ())
    -> (Ptr ArithOPCode -> IO ArithOPCode)
    -> (Ptr ArithOPCode -> ArithOPCode -> IO ())
    -> Storable ArithOPCode
    forall b. Ptr b -> Int -> IO ArithOPCode
    forall b. Ptr b -> Int -> ArithOPCode -> IO ()
    forall a.
    (a -> Int)
    -> (a -> Int)
    -> (Ptr a -> Int -> IO a)
    -> (Ptr a -> Int -> a -> IO ())
    -> (forall b. Ptr b -> Int -> IO a)
    -> (forall b. Ptr b -> Int -> a -> IO ())
    -> (Ptr a -> IO a)
    -> (Ptr a -> a -> IO ())
    -> Storable a
    $csizeOf :: ArithOPCode -> Int
    sizeOf :: ArithOPCode -> Int
    $calignment :: ArithOPCode -> Int
    alignment :: ArithOPCode -> Int
    $cpeekElemOff :: Ptr ArithOPCode -> Int -> IO ArithOPCode
    peekElemOff :: Ptr ArithOPCode -> Int -> IO ArithOPCode
    $cpokeElemOff :: Ptr ArithOPCode -> Int -> ArithOPCode -> IO ()
    pokeElemOff :: Ptr ArithOPCode -> Int -> ArithOPCode -> IO ()
    $cpeekByteOff :: forall b. Ptr b -> Int -> IO ArithOPCode
    peekByteOff :: forall b. Ptr b -> Int -> IO ArithOPCode
    $cpokeByteOff :: forall b. Ptr b -> Int -> ArithOPCode -> IO ()
    pokeByteOff :: forall b. Ptr b -> Int -> ArithOPCode -> IO ()
    $cpeek :: Ptr ArithOPCode -> IO ArithOPCode
    peek :: Ptr ArithOPCode -> IO ArithOPCode
    $cpoke :: Ptr ArithOPCode -> ArithOPCode -> IO ()
    poke :: Ptr ArithOPCode -> ArithOPCode -> IO ()
    Storable, Int -> ArithOPCode -> ShowS
    [ArithOPCode] -> ShowS
    ArithOPCode -> String
    (Int -> ArithOPCode -> ShowS)
    -> (ArithOPCode -> String)
    -> ([ArithOPCode] -> ShowS)
    -> Show ArithOPCode
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ArithOPCode -> ShowS
    showsPrec :: Int -> ArithOPCode -> ShowS
    $cshow :: ArithOPCode -> String
    show :: ArithOPCode -> String
    $cshowList :: [ArithOPCode] -> ShowS
    showList :: [ArithOPCode] -> ShowS
    Show)

    -- | Integer code used to signal the status of a thread or computation.
    newtype StatusCode = StatusCode CInt deriving (StatusCode -> StatusCode -> Bool
    (StatusCode -> StatusCode -> Bool)
    -> (StatusCode -> StatusCode -> Bool) -> Eq StatusCode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: StatusCode -> StatusCode -> Bool
    == :: StatusCode -> StatusCode -> Bool
    $c/= :: StatusCode -> StatusCode -> Bool
    /= :: StatusCode -> StatusCode -> Bool
    Eq, Ptr StatusCode -> IO StatusCode
    Ptr StatusCode -> Int -> IO StatusCode
    Ptr StatusCode -> Int -> StatusCode -> IO ()
    Ptr StatusCode -> StatusCode -> IO ()
    StatusCode -> Int
    (StatusCode -> Int)
    -> (StatusCode -> Int)
    -> (Ptr StatusCode -> Int -> IO StatusCode)
    -> (Ptr StatusCode -> Int -> StatusCode -> IO ())
    -> (forall b. Ptr b -> Int -> IO StatusCode)
    -> (forall b. Ptr b -> Int -> StatusCode -> IO ())
    -> (Ptr StatusCode -> IO StatusCode)
    -> (Ptr StatusCode -> StatusCode -> IO ())
    -> Storable StatusCode
    forall b. Ptr b -> Int -> IO StatusCode
    forall b. Ptr b -> Int -> StatusCode -> IO ()
    forall a.
    (a -> Int)
    -> (a -> Int)
    -> (Ptr a -> Int -> IO a)
    -> (Ptr a -> Int -> a -> IO ())
    -> (forall b. Ptr b -> Int -> IO a)
    -> (forall b. Ptr b -> Int -> a -> IO ())
    -> (Ptr a -> IO a)
    -> (Ptr a -> a -> IO ())
    -> Storable a
    $csizeOf :: StatusCode -> Int
    sizeOf :: StatusCode -> Int
    $calignment :: StatusCode -> Int
    alignment :: StatusCode -> Int
    $cpeekElemOff :: Ptr StatusCode -> Int -> IO StatusCode
    peekElemOff :: Ptr StatusCode -> Int -> IO StatusCode
    $cpokeElemOff :: Ptr StatusCode -> Int -> StatusCode -> IO ()
    pokeElemOff :: Ptr StatusCode -> Int -> StatusCode -> IO ()
    $cpeekByteOff :: forall b. Ptr b -> Int -> IO StatusCode
    peekByteOff :: forall b. Ptr b -> Int -> IO StatusCode
    $cpokeByteOff :: forall b. Ptr b -> Int -> StatusCode -> IO ()
    pokeByteOff :: forall b. Ptr b -> Int -> StatusCode -> IO ()
    $cpeek :: Ptr StatusCode -> IO StatusCode
    peek :: Ptr StatusCode -> IO StatusCode
    $cpoke :: Ptr StatusCode -> StatusCode -> IO ()
    poke :: Ptr StatusCode -> StatusCode -> IO ()
    Storable, Int -> StatusCode -> ShowS
    [StatusCode] -> ShowS
    StatusCode -> String
    (Int -> StatusCode -> ShowS)
    -> (StatusCode -> String)
    -> ([StatusCode] -> ShowS)
    -> Show StatusCode
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> StatusCode -> ShowS
    showsPrec :: Int -> StatusCode -> ShowS
    $cshow :: StatusCode -> String
    show :: StatusCode -> String
    $cshowList :: [StatusCode] -> ShowS
    showList :: [StatusCode] -> ShowS
    Show)

    -- | Garbage-collection options.
    newtype GCCode = GCCode CInt deriving (GCCode -> GCCode -> Bool
    (GCCode -> GCCode -> Bool)
    -> (GCCode -> GCCode -> Bool) -> Eq GCCode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: GCCode -> GCCode -> Bool
    == :: GCCode -> GCCode -> Bool
    $c/= :: GCCode -> GCCode -> Bool
    /= :: GCCode -> GCCode -> Bool
    Eq, Ptr GCCode -> IO GCCode
    Ptr GCCode -> Int -> IO GCCode
    Ptr GCCode -> Int -> GCCode -> IO ()
    Ptr GCCode -> GCCode -> IO ()
    GCCode -> Int
    (GCCode -> Int)
    -> (GCCode -> Int)
    -> (Ptr GCCode -> Int -> IO GCCode)
    -> (Ptr GCCode -> Int -> GCCode -> IO ())
    -> (forall b. Ptr b -> Int -> IO GCCode)
    -> (forall b. Ptr b -> Int -> GCCode -> IO ())
    -> (Ptr GCCode -> IO GCCode)
    -> (Ptr GCCode -> GCCode -> IO ())
    -> Storable GCCode
    forall b. Ptr b -> Int -> IO GCCode
    forall b. Ptr b -> Int -> GCCode -> IO ()
    forall a.
    (a -> Int)
    -> (a -> Int)
    -> (Ptr a -> Int -> IO a)
    -> (Ptr a -> Int -> a -> IO ())
    -> (forall b. Ptr b -> Int -> IO a)
    -> (forall b. Ptr b -> Int -> a -> IO ())
    -> (Ptr a -> IO a)
    -> (Ptr a -> a -> IO ())
    -> Storable a
    $csizeOf :: GCCode -> Int
    sizeOf :: GCCode -> Int
    $calignment :: GCCode -> Int
    alignment :: GCCode -> Int
    $cpeekElemOff :: Ptr GCCode -> Int -> IO GCCode
    peekElemOff :: Ptr GCCode -> Int -> IO GCCode
    $cpokeElemOff :: Ptr GCCode -> Int -> GCCode -> IO ()
    pokeElemOff :: Ptr GCCode -> Int -> GCCode -> IO ()
    $cpeekByteOff :: forall b. Ptr b -> Int -> IO GCCode
    peekByteOff :: forall b. Ptr b -> Int -> IO GCCode
    $cpokeByteOff :: forall b. Ptr b -> Int -> GCCode -> IO ()
    pokeByteOff :: forall b. Ptr b -> Int -> GCCode -> IO ()
    $cpeek :: Ptr GCCode -> IO GCCode
    peek :: Ptr GCCode -> IO GCCode
    $cpoke :: Ptr GCCode -> GCCode -> IO ()
    poke :: Ptr GCCode -> GCCode -> IO ()
    Storable, Int -> GCCode -> ShowS
    [GCCode] -> ShowS
    GCCode -> String
    (Int -> GCCode -> ShowS)
    -> (GCCode -> String) -> ([GCCode] -> ShowS) -> Show GCCode
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> GCCode -> ShowS
    showsPrec :: Int -> GCCode -> ShowS
    $cshow :: GCCode -> String
    show :: GCCode -> String
    $cshowList :: [GCCode] -> ShowS
    showList :: [GCCode] -> ShowS
    Show)

    -- | A stack index
    newtype StackIndex = StackIndex { StackIndex -> CInt
    fromStackIndex :: CInt }
      deriving (Int -> StackIndex
    StackIndex -> Int
    StackIndex -> [StackIndex]
    StackIndex -> StackIndex
    StackIndex -> StackIndex -> [StackIndex]
    StackIndex -> StackIndex -> StackIndex -> [StackIndex]
    (StackIndex -> StackIndex)
    -> (StackIndex -> StackIndex)
    -> (Int -> StackIndex)
    -> (StackIndex -> Int)
    -> (StackIndex -> [StackIndex])
    -> (StackIndex -> StackIndex -> [StackIndex])
    -> (StackIndex -> StackIndex -> [StackIndex])
    -> (StackIndex -> StackIndex -> StackIndex -> [StackIndex])
    -> Enum StackIndex
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: StackIndex -> StackIndex
    succ :: StackIndex -> StackIndex
    $cpred :: StackIndex -> StackIndex
    pred :: StackIndex -> StackIndex
    $ctoEnum :: Int -> StackIndex
    toEnum :: Int -> StackIndex
    $cfromEnum :: StackIndex -> Int
    fromEnum :: StackIndex -> Int
    $cenumFrom :: StackIndex -> [StackIndex]
    enumFrom :: StackIndex -> [StackIndex]
    $cenumFromThen :: StackIndex -> StackIndex -> [StackIndex]
    enumFromThen :: StackIndex -> StackIndex -> [StackIndex]
    $cenumFromTo :: StackIndex -> StackIndex -> [StackIndex]
    enumFromTo :: StackIndex -> StackIndex -> [StackIndex]
    $cenumFromThenTo :: StackIndex -> StackIndex -> StackIndex -> [StackIndex]
    enumFromThenTo :: StackIndex -> StackIndex -> StackIndex -> [StackIndex]
    Enum, StackIndex -> StackIndex -> Bool
    (StackIndex -> StackIndex -> Bool)
    -> (StackIndex -> StackIndex -> Bool) -> Eq StackIndex
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: StackIndex -> StackIndex -> Bool
    == :: StackIndex -> StackIndex -> Bool
    $c/= :: StackIndex -> StackIndex -> Bool
    /= :: StackIndex -> StackIndex -> Bool
    Eq, Integer -> StackIndex
    StackIndex -> StackIndex
    StackIndex -> StackIndex -> StackIndex
    (StackIndex -> StackIndex -> StackIndex)
    -> (StackIndex -> StackIndex -> StackIndex)
    -> (StackIndex -> StackIndex -> StackIndex)
    -> (StackIndex -> StackIndex)
    -> (StackIndex -> StackIndex)
    -> (StackIndex -> StackIndex)
    -> (Integer -> StackIndex)
    -> Num StackIndex
    forall a.
    (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (Integer -> a)
    -> Num a
    $c+ :: StackIndex -> StackIndex -> StackIndex
    + :: StackIndex -> StackIndex -> StackIndex
    $c- :: StackIndex -> StackIndex -> StackIndex
    - :: StackIndex -> StackIndex -> StackIndex
    $c* :: StackIndex -> StackIndex -> StackIndex
    * :: StackIndex -> StackIndex -> StackIndex
    $cnegate :: StackIndex -> StackIndex
    negate :: StackIndex -> StackIndex
    $cabs :: StackIndex -> StackIndex
    abs :: StackIndex -> StackIndex
    $csignum :: StackIndex -> StackIndex
    signum :: StackIndex -> StackIndex
    $cfromInteger :: Integer -> StackIndex
    fromInteger :: Integer -> StackIndex
    Num, Eq StackIndex
    Eq StackIndex =>
    (StackIndex -> StackIndex -> Ordering)
    -> (StackIndex -> StackIndex -> Bool)
    -> (StackIndex -> StackIndex -> Bool)
    -> (StackIndex -> StackIndex -> Bool)
    -> (StackIndex -> StackIndex -> Bool)
    -> (StackIndex -> StackIndex -> StackIndex)
    -> (StackIndex -> StackIndex -> StackIndex)
    -> Ord StackIndex
    StackIndex -> StackIndex -> Bool
    StackIndex -> StackIndex -> Ordering
    StackIndex -> StackIndex -> StackIndex
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: StackIndex -> StackIndex -> Ordering
    compare :: StackIndex -> StackIndex -> Ordering
    $c< :: StackIndex -> StackIndex -> Bool
    < :: StackIndex -> StackIndex -> Bool
    $c<= :: StackIndex -> StackIndex -> Bool
    <= :: StackIndex -> StackIndex -> Bool
    $c> :: StackIndex -> StackIndex -> Bool
    > :: StackIndex -> StackIndex -> Bool
    $c>= :: StackIndex -> StackIndex -> Bool
    >= :: StackIndex -> StackIndex -> Bool
    $cmax :: StackIndex -> StackIndex -> StackIndex
    max :: StackIndex -> StackIndex -> StackIndex
    $cmin :: StackIndex -> StackIndex -> StackIndex
    min :: StackIndex -> StackIndex -> StackIndex
    Ord, Int -> StackIndex -> ShowS
    [StackIndex] -> ShowS
    StackIndex -> String
    (Int -> StackIndex -> ShowS)
    -> (StackIndex -> String)
    -> ([StackIndex] -> ShowS)
    -> Show StackIndex
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> StackIndex -> ShowS
    showsPrec :: Int -> StackIndex -> ShowS
    $cshow :: StackIndex -> String
    show :: StackIndex -> String
    $cshowList :: [StackIndex] -> ShowS
    showList :: [StackIndex] -> ShowS
    Show)

    --
    -- Number of arguments and return values
    --

    -- | The number of arguments consumed curing a function call.
    newtype NumArgs = NumArgs { NumArgs -> CInt
    fromNumArgs :: CInt }
      deriving (NumArgs -> NumArgs -> Bool
    (NumArgs -> NumArgs -> Bool)
    -> (NumArgs -> NumArgs -> Bool) -> Eq NumArgs
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: NumArgs -> NumArgs -> Bool
    == :: NumArgs -> NumArgs -> Bool
    $c/= :: NumArgs -> NumArgs -> Bool
    /= :: NumArgs -> NumArgs -> Bool
    Eq, Integer -> NumArgs
    NumArgs -> NumArgs
    NumArgs -> NumArgs -> NumArgs
    (NumArgs -> NumArgs -> NumArgs)
    -> (NumArgs -> NumArgs -> NumArgs)
    -> (NumArgs -> NumArgs -> NumArgs)
    -> (NumArgs -> NumArgs)
    -> (NumArgs -> NumArgs)
    -> (NumArgs -> NumArgs)
    -> (Integer -> NumArgs)
    -> Num NumArgs
    forall a.
    (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (Integer -> a)
    -> Num a
    $c+ :: NumArgs -> NumArgs -> NumArgs
    + :: NumArgs -> NumArgs -> NumArgs
    $c- :: NumArgs -> NumArgs -> NumArgs
    - :: NumArgs -> NumArgs -> NumArgs
    $c* :: NumArgs -> NumArgs -> NumArgs
    * :: NumArgs -> NumArgs -> NumArgs
    $cnegate :: NumArgs -> NumArgs
    negate :: NumArgs -> NumArgs
    $cabs :: NumArgs -> NumArgs
    abs :: NumArgs -> NumArgs
    $csignum :: NumArgs -> NumArgs
    signum :: NumArgs -> NumArgs
    $cfromInteger :: Integer -> NumArgs
    fromInteger :: Integer -> NumArgs
    Num, Eq NumArgs
    Eq NumArgs =>
    (NumArgs -> NumArgs -> Ordering)
    -> (NumArgs -> NumArgs -> Bool)
    -> (NumArgs -> NumArgs -> Bool)
    -> (NumArgs -> NumArgs -> Bool)
    -> (NumArgs -> NumArgs -> Bool)
    -> (NumArgs -> NumArgs -> NumArgs)
    -> (NumArgs -> NumArgs -> NumArgs)
    -> Ord NumArgs
    NumArgs -> NumArgs -> Bool
    NumArgs -> NumArgs -> Ordering
    NumArgs -> NumArgs -> NumArgs
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: NumArgs -> NumArgs -> Ordering
    compare :: NumArgs -> NumArgs -> Ordering
    $c< :: NumArgs -> NumArgs -> Bool
    < :: NumArgs -> NumArgs -> Bool
    $c<= :: NumArgs -> NumArgs -> Bool
    <= :: NumArgs -> NumArgs -> Bool
    $c> :: NumArgs -> NumArgs -> Bool
    > :: NumArgs -> NumArgs -> Bool
    $c>= :: NumArgs -> NumArgs -> Bool
    >= :: NumArgs -> NumArgs -> Bool
    $cmax :: NumArgs -> NumArgs -> NumArgs
    max :: NumArgs -> NumArgs -> NumArgs
    $cmin :: NumArgs -> NumArgs -> NumArgs
    min :: NumArgs -> NumArgs -> NumArgs
    Ord, Int -> NumArgs -> ShowS
    [NumArgs] -> ShowS
    NumArgs -> String
    (Int -> NumArgs -> ShowS)
    -> (NumArgs -> String) -> ([NumArgs] -> ShowS) -> Show NumArgs
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> NumArgs -> ShowS
    showsPrec :: Int -> NumArgs -> ShowS
    $cshow :: NumArgs -> String
    show :: NumArgs -> String
    $cshowList :: [NumArgs] -> ShowS
    showList :: [NumArgs] -> ShowS
    Show)

    -- | The number of results returned by a function call.
    newtype NumResults = NumResults { NumResults -> CInt
    fromNumResults :: CInt }
      deriving (NumResults -> NumResults -> Bool
    (NumResults -> NumResults -> Bool)
    -> (NumResults -> NumResults -> Bool) -> Eq NumResults
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: NumResults -> NumResults -> Bool
    == :: NumResults -> NumResults -> Bool
    $c/= :: NumResults -> NumResults -> Bool
    /= :: NumResults -> NumResults -> Bool
    Eq, Integer -> NumResults
    NumResults -> NumResults
    NumResults -> NumResults -> NumResults
    (NumResults -> NumResults -> NumResults)
    -> (NumResults -> NumResults -> NumResults)
    -> (NumResults -> NumResults -> NumResults)
    -> (NumResults -> NumResults)
    -> (NumResults -> NumResults)
    -> (NumResults -> NumResults)
    -> (Integer -> NumResults)
    -> Num NumResults
    forall a.
    (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (a -> a)
    -> (Integer -> a)
    -> Num a
    $c+ :: NumResults -> NumResults -> NumResults
    + :: NumResults -> NumResults -> NumResults
    $c- :: NumResults -> NumResults -> NumResults
    - :: NumResults -> NumResults -> NumResults
    $c* :: NumResults -> NumResults -> NumResults
    * :: NumResults -> NumResults -> NumResults
    $cnegate :: NumResults -> NumResults
    negate :: NumResults -> NumResults
    $cabs :: NumResults -> NumResults
    abs :: NumResults -> NumResults
    $csignum :: NumResults -> NumResults
    signum :: NumResults -> NumResults
    $cfromInteger :: Integer -> NumResults
    fromInteger :: Integer -> NumResults
    Num, Eq NumResults
    Eq NumResults =>
    (NumResults -> NumResults -> Ordering)
    -> (NumResults -> NumResults -> Bool)
    -> (NumResults -> NumResults -> Bool)
    -> (NumResults -> NumResults -> Bool)
    -> (NumResults -> NumResults -> Bool)
    -> (NumResults -> NumResults -> NumResults)
    -> (NumResults -> NumResults -> NumResults)
    -> Ord NumResults
    NumResults -> NumResults -> Bool
    NumResults -> NumResults -> Ordering
    NumResults -> NumResults -> NumResults
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: NumResults -> NumResults -> Ordering
    compare :: NumResults -> NumResults -> Ordering
    $c< :: NumResults -> NumResults -> Bool
    < :: NumResults -> NumResults -> Bool
    $c<= :: NumResults -> NumResults -> Bool
    <= :: NumResults -> NumResults -> Bool
    $c> :: NumResults -> NumResults -> Bool
    > :: NumResults -> NumResults -> Bool
    $c>= :: NumResults -> NumResults -> Bool
    >= :: NumResults -> NumResults -> Bool
    $cmax :: NumResults -> NumResults -> NumResults
    max :: NumResults -> NumResults -> NumResults
    $cmin :: NumResults -> NumResults -> NumResults
    min :: NumResults -> NumResults -> NumResults
    Ord, Int -> NumResults -> ShowS
    [NumResults] -> ShowS
    NumResults -> String
    (Int -> NumResults -> ShowS)
    -> (NumResults -> String)
    -> ([NumResults] -> ShowS)
    -> Show NumResults
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> NumResults -> ShowS
    showsPrec :: Int -> NumResults -> ShowS
    $cshow :: NumResults -> String
    show :: NumResults -> String
    $cshowList :: [NumResults] -> ShowS
    showList :: [NumResults] -> ShowS
    Show)