    -- | Copyright  : Will Thompson and Iñaki García Etxebarria
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.GModule.Enums
        (

     -- * Enumerations

    -- ** ModuleError #enum:ModuleError#

        ModuleError(..)                         ,
        catchModuleError                        ,
        handleModuleError                       ,

        ) where

    import Data.GI.Base.ShortPrelude
    import qualified Data.GI.Base.ShortPrelude as SP
    import qualified Data.GI.Base.Overloading as O
    import qualified Prelude as P

    import qualified Data.GI.Base.Attributes as GI.Attributes
    import qualified Data.GI.Base.BasicTypes as B.Types
    import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
    import qualified Data.GI.Base.GArray as B.GArray
    import qualified Data.GI.Base.GClosure as B.GClosure
    import qualified Data.GI.Base.GError as B.GError
    import qualified Data.GI.Base.GHashTable as B.GHT
    import qualified Data.GI.Base.GVariant as B.GVariant
    import qualified Data.GI.Base.GValue as B.GValue
    import qualified Data.GI.Base.GParamSpec as B.GParamSpec
    import qualified Data.GI.Base.CallStack as B.CallStack
    import qualified Data.GI.Base.Properties as B.Properties
    import qualified Data.GI.Base.Signals as B.Signals
    import qualified Control.Monad.IO.Class as MIO
    import qualified Data.Coerce as Coerce
    import qualified Data.Text as T
    import qualified Data.Kind as DK
    import qualified Data.ByteString.Char8 as B
    import qualified Data.Map as Map
    import qualified Foreign.Ptr as FP
    import qualified GHC.OverloadedLabels as OL
    import qualified GHC.Records as R
    import qualified Data.Word as DW
    import qualified Data.Int as DI
    import qualified System.Posix.Types as SPT
    import qualified Foreign.C.Types as FCT

    -- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
    #if MIN_VERSION_base(4,18,0)

    #else

    #endif

    -- Enum ModuleError
    -- | Errors returned by @/g_module_open_full()/@.
    --
    -- /Since: 2.70/
    data ModuleError =
          ModuleErrorFailed
        -- ^ there was an error loading or opening a module file
        | ModuleErrorCheckFailed
        -- ^ a module returned an error from its @g_module_check_init()@ function
        | AnotherModuleError Int
        -- ^ Catch-all for unknown values
        deriving (Int -> ModuleError -> ShowS
    [ModuleError] -> ShowS
    ModuleError -> String
    (Int -> ModuleError -> ShowS)
    -> (ModuleError -> String)
    -> ([ModuleError] -> ShowS)
    -> Show ModuleError
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ModuleError -> ShowS
    showsPrec :: Int -> ModuleError -> ShowS
    $cshow :: ModuleError -> String
    show :: ModuleError -> String
    $cshowList :: [ModuleError] -> ShowS
    showList :: [ModuleError] -> ShowS
    Show, ModuleError -> ModuleError -> Bool
    (ModuleError -> ModuleError -> Bool)
    -> (ModuleError -> ModuleError -> Bool) -> Eq ModuleError
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ModuleError -> ModuleError -> Bool
    == :: ModuleError -> ModuleError -> Bool
    $c/= :: ModuleError -> ModuleError -> Bool
    /= :: ModuleError -> ModuleError -> Bool
    Eq)

    instance P.Enum ModuleError where
        fromEnum :: ModuleError -> Int
    fromEnum ModuleError
    ModuleErrorFailed = Int
    0
        fromEnum ModuleError
    ModuleErrorCheckFailed = Int
    1
        fromEnum (AnotherModuleError Int
    k) = Int
    k

        toEnum :: Int -> ModuleError
    toEnum Int
    0 = ModuleError
    ModuleErrorFailed
        toEnum Int
    1 = ModuleError
    ModuleErrorCheckFailed
        toEnum Int
    k = Int -> ModuleError
    AnotherModuleError Int
    k

    instance P.Ord ModuleError where
        compare :: ModuleError -> ModuleError -> Ordering
    compare ModuleError
    a ModuleError
    b = Int -> Int -> Ordering
    forall a. Ord a => a -> a -> Ordering
    P.compare (ModuleError -> Int
    forall a. Enum a => a -> Int
    P.fromEnum ModuleError
    a) (ModuleError -> Int
    forall a. Enum a => a -> Int
    P.fromEnum ModuleError
    b)

    instance GErrorClass ModuleError where
        gerrorClassDomain :: ModuleError -> Text
    gerrorClassDomain ModuleError
    _ = Text
    "g-module-error-quark"

    -- | Catch exceptions of type `ModuleError`. This is a specialized version of `Data.GI.Base.GError.catchGErrorJustDomain`.
    catchModuleError ::
        IO a ->
        (ModuleError -> GErrorMessage -> IO a) ->
        IO a
    catchModuleError :: forall a. IO a -> (ModuleError -> Text -> IO a) -> IO a
    catchModuleError = IO a -> (ModuleError -> Text -> IO a) -> IO a
    forall err a.
    GErrorClass err =>
    IO a -> (err -> Text -> IO a) -> IO a
    catchGErrorJustDomain

    -- | Handle exceptions of type `ModuleError`. This is a specialized version of `Data.GI.Base.GError.handleGErrorJustDomain`.
    handleModuleError ::
        (ModuleError -> GErrorMessage -> IO a) ->
        IO a ->
        IO a
    handleModuleError :: forall a. (ModuleError -> Text -> IO a) -> IO a -> IO a
    handleModuleError = (ModuleError -> Text -> IO a) -> IO a -> IO a
    forall err a.
    GErrorClass err =>
    (err -> Text -> IO a) -> IO a -> IO a
    handleGErrorJustDomain