{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A given range or subrange, to be used with t'GI.Atk.Interfaces.Value.Value'
-- 
-- t'GI.Atk.Structs.Range.Range' are used on t'GI.Atk.Interfaces.Value.Value', in order to represent the full
-- range of a given component (for example an slider or a range
-- control), or to define each individual subrange this full range is
-- splitted if available. See t'GI.Atk.Interfaces.Value.Value' documentation for further
-- details.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Atk.Structs.Range
    ( 

-- * Exported types
    Range(..)                               ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [copy]("GI.Atk.Structs.Range#g:method:copy"), [free]("GI.Atk.Structs.Range#g:method:free").
-- 
-- ==== Getters
-- [getDescription]("GI.Atk.Structs.Range#g:method:getDescription"), [getLowerLimit]("GI.Atk.Structs.Range#g:method:getLowerLimit"), [getUpperLimit]("GI.Atk.Structs.Range#g:method:getUpperLimit").
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveRangeMethod                      ,
#endif

-- ** copy #method:copy#

#if defined(ENABLE_OVERLOADING)
    RangeCopyMethodInfo                     ,
#endif
    rangeCopy                               ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    RangeFreeMethodInfo                     ,
#endif
    rangeFree                               ,


-- ** getDescription #method:getDescription#

#if defined(ENABLE_OVERLOADING)
    RangeGetDescriptionMethodInfo           ,
#endif
    rangeGetDescription                     ,


-- ** getLowerLimit #method:getLowerLimit#

#if defined(ENABLE_OVERLOADING)
    RangeGetLowerLimitMethodInfo            ,
#endif
    rangeGetLowerLimit                      ,


-- ** getUpperLimit #method:getUpperLimit#

#if defined(ENABLE_OVERLOADING)
    RangeGetUpperLimitMethodInfo            ,
#endif
    rangeGetUpperLimit                      ,


-- ** new #method:new#

    rangeNew                                ,




    ) 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


-- | Memory-managed wrapper type.
newtype Range = Range (SP.ManagedPtr Range)
    deriving (Range -> Range -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Range -> Range -> Bool
$c/= :: Range -> Range -> Bool
== :: Range -> Range -> Bool
$c== :: Range -> Range -> Bool
Eq)

instance SP.ManagedPtrNewtype Range where
    toManagedPtr :: Range -> ManagedPtr Range
toManagedPtr (Range ManagedPtr Range
p) = ManagedPtr Range
p

foreign import ccall "atk_range_get_type" c_atk_range_get_type :: 
    IO GType

type instance O.ParentTypes Range = '[]
instance O.HasParentTypes Range

instance B.Types.TypedObject Range where
    glibType :: IO GType
glibType = IO GType
c_atk_range_get_type

instance B.Types.GBoxed Range

-- | Convert 'Range' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Range) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_atk_range_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Range -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Range
P.Nothing = forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (forall a. Ptr a
FP.nullPtr :: FP.Ptr Range)
    gvalueSet_ Ptr GValue
gv (P.Just Range
obj) = forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Range
obj (forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Range)
gvalueGet_ Ptr GValue
gv = do
        Ptr Range
ptr <- forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Range)
        if Ptr Range
ptr forall a. Eq a => a -> a -> Bool
/= forall a. Ptr a
FP.nullPtr
        then forall a. a -> Maybe a
P.Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Range -> Range
Range Ptr Range
ptr
        else forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
P.Nothing
        
    


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Range
type instance O.AttributeList Range = RangeAttributeList
type RangeAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

-- method Range::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "lower_limit"
--           , argType = TBasicType TDouble
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "inferior limit for this range"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "upper_limit"
--           , argType = TBasicType TDouble
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "superior limit for this range"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "description"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "human readable description of this range."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Atk" , name = "Range" })
-- throws : False
-- Skip return : False

foreign import ccall "atk_range_new" atk_range_new :: 
    CDouble ->                              -- lower_limit : TBasicType TDouble
    CDouble ->                              -- upper_limit : TBasicType TDouble
    CString ->                              -- description : TBasicType TUTF8
    IO (Ptr Range)

-- | Creates a new t'GI.Atk.Structs.Range.Range'.
-- 
-- /Since: 2.12/
rangeNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Double
    -- ^ /@lowerLimit@/: inferior limit for this range
    -> Double
    -- ^ /@upperLimit@/: superior limit for this range
    -> T.Text
    -- ^ /@description@/: human readable description of this range.
    -> m Range
    -- ^ __Returns:__ a new t'GI.Atk.Structs.Range.Range'
rangeNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Double -> Double -> Text -> m Range
rangeNew Double
lowerLimit Double
upperLimit Text
description = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    let lowerLimit' :: CDouble
lowerLimit' = forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
lowerLimit
    let upperLimit' :: CDouble
upperLimit' = forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
upperLimit
    CString
description' <- Text -> IO CString
textToCString Text
description
    Ptr Range
result <- CDouble -> CDouble -> CString -> IO (Ptr Range)
atk_range_new CDouble
lowerLimit' CDouble
upperLimit' CString
description'
    forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rangeNew" Ptr Range
result
    Range
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Range -> Range
Range) Ptr Range
result
    forall a. Ptr a -> IO ()
freeMem CString
description'
    forall (m :: * -> *) a. Monad m => a -> m a
return Range
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Range::copy
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "src"
--           , argType = TInterface Name { namespace = "Atk" , name = "Range" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#AtkRange to copy" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Atk" , name = "Range" })
-- throws : False
-- Skip return : False

foreign import ccall "atk_range_copy" atk_range_copy :: 
    Ptr Range ->                            -- src : TInterface (Name {namespace = "Atk", name = "Range"})
    IO (Ptr Range)

-- | Returns a new t'GI.Atk.Structs.Range.Range' that is a exact copy of /@src@/
-- 
-- /Since: 2.12/
rangeCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Range
    -- ^ /@src@/: t'GI.Atk.Structs.Range.Range' to copy
    -> m Range
    -- ^ __Returns:__ a new t'GI.Atk.Structs.Range.Range' copy of /@src@/
rangeCopy :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Range -> m Range
rangeCopy Range
src = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Range
src' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
src
    Ptr Range
result <- Ptr Range -> IO (Ptr Range)
atk_range_copy Ptr Range
src'
    forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rangeCopy" Ptr Range
result
    Range
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Range -> Range
Range) Ptr Range
result
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
src
    forall (m :: * -> *) a. Monad m => a -> m a
return Range
result'

#if defined(ENABLE_OVERLOADING)
data RangeCopyMethodInfo
instance (signature ~ (m Range), MonadIO m) => O.OverloadedMethod RangeCopyMethodInfo Range signature where
    overloadedMethod = rangeCopy

instance O.OverloadedMethodInfo RangeCopyMethodInfo Range where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Atk.Structs.Range.rangeCopy",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.25/docs/GI-Atk-Structs-Range.html#v:rangeCopy"
        })


#endif

-- method Range::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "range"
--           , argType = TInterface Name { namespace = "Atk" , name = "Range" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#AtkRange to free" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "atk_range_free" atk_range_free :: 
    Ptr Range ->                            -- range : TInterface (Name {namespace = "Atk", name = "Range"})
    IO ()

-- | Free /@range@/
-- 
-- /Since: 2.12/
rangeFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Range
    -- ^ /@range@/: t'GI.Atk.Structs.Range.Range' to free
    -> m ()
rangeFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Range -> m ()
rangeFree Range
range = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Range
range' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
range
    Ptr Range -> IO ()
atk_range_free Ptr Range
range'
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
range
    forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data RangeFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod RangeFreeMethodInfo Range signature where
    overloadedMethod = rangeFree

instance O.OverloadedMethodInfo RangeFreeMethodInfo Range where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Atk.Structs.Range.rangeFree",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.25/docs/GI-Atk-Structs-Range.html#v:rangeFree"
        })


#endif

-- method Range::get_description
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "range"
--           , argType = TInterface Name { namespace = "Atk" , name = "Range" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #AtkRange" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "atk_range_get_description" atk_range_get_description :: 
    Ptr Range ->                            -- range : TInterface (Name {namespace = "Atk", name = "Range"})
    IO CString

-- | Returns the human readable description of /@range@/
-- 
-- /Since: 2.12/
rangeGetDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Range
    -- ^ /@range@/: an t'GI.Atk.Structs.Range.Range'
    -> m T.Text
    -- ^ __Returns:__ the human-readable description of /@range@/
rangeGetDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Range -> m Text
rangeGetDescription Range
range = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Range
range' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
range
    CString
result <- Ptr Range -> IO CString
atk_range_get_description Ptr Range
range'
    forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rangeGetDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
cstringToText CString
result
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
range
    forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'

#if defined(ENABLE_OVERLOADING)
data RangeGetDescriptionMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod RangeGetDescriptionMethodInfo Range signature where
    overloadedMethod = rangeGetDescription

instance O.OverloadedMethodInfo RangeGetDescriptionMethodInfo Range where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Atk.Structs.Range.rangeGetDescription",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.25/docs/GI-Atk-Structs-Range.html#v:rangeGetDescription"
        })


#endif

-- method Range::get_lower_limit
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "range"
--           , argType = TInterface Name { namespace = "Atk" , name = "Range" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #AtkRange" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "atk_range_get_lower_limit" atk_range_get_lower_limit :: 
    Ptr Range ->                            -- range : TInterface (Name {namespace = "Atk", name = "Range"})
    IO CDouble

-- | Returns the lower limit of /@range@/
-- 
-- /Since: 2.12/
rangeGetLowerLimit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Range
    -- ^ /@range@/: an t'GI.Atk.Structs.Range.Range'
    -> m Double
    -- ^ __Returns:__ the lower limit of /@range@/
rangeGetLowerLimit :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Range -> m Double
rangeGetLowerLimit Range
range = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Range
range' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
range
    CDouble
result <- Ptr Range -> IO CDouble
atk_range_get_lower_limit Ptr Range
range'
    let result' :: Double
result' = forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
range
    forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'

#if defined(ENABLE_OVERLOADING)
data RangeGetLowerLimitMethodInfo
instance (signature ~ (m Double), MonadIO m) => O.OverloadedMethod RangeGetLowerLimitMethodInfo Range signature where
    overloadedMethod = rangeGetLowerLimit

instance O.OverloadedMethodInfo RangeGetLowerLimitMethodInfo Range where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Atk.Structs.Range.rangeGetLowerLimit",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.25/docs/GI-Atk-Structs-Range.html#v:rangeGetLowerLimit"
        })


#endif

-- method Range::get_upper_limit
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "range"
--           , argType = TInterface Name { namespace = "Atk" , name = "Range" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #AtkRange" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "atk_range_get_upper_limit" atk_range_get_upper_limit :: 
    Ptr Range ->                            -- range : TInterface (Name {namespace = "Atk", name = "Range"})
    IO CDouble

-- | Returns the upper limit of /@range@/
-- 
-- /Since: 2.12/
rangeGetUpperLimit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Range
    -- ^ /@range@/: an t'GI.Atk.Structs.Range.Range'
    -> m Double
    -- ^ __Returns:__ the upper limit of /@range@/
rangeGetUpperLimit :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Range -> m Double
rangeGetUpperLimit Range
range = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
    Ptr Range
range' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Range
range
    CDouble
result <- Ptr Range -> IO CDouble
atk_range_get_upper_limit Ptr Range
range'
    let result' :: Double
result' = forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
    forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Range
range
    forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'

#if defined(ENABLE_OVERLOADING)
data RangeGetUpperLimitMethodInfo
instance (signature ~ (m Double), MonadIO m) => O.OverloadedMethod RangeGetUpperLimitMethodInfo Range signature where
    overloadedMethod = rangeGetUpperLimit

instance O.OverloadedMethodInfo RangeGetUpperLimitMethodInfo Range where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Atk.Structs.Range.rangeGetUpperLimit",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.25/docs/GI-Atk-Structs-Range.html#v:rangeGetUpperLimit"
        })


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveRangeMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveRangeMethod "copy" o = RangeCopyMethodInfo
    ResolveRangeMethod "free" o = RangeFreeMethodInfo
    ResolveRangeMethod "getDescription" o = RangeGetDescriptionMethodInfo
    ResolveRangeMethod "getLowerLimit" o = RangeGetLowerLimitMethodInfo
    ResolveRangeMethod "getUpperLimit" o = RangeGetUpperLimitMethodInfo
    ResolveRangeMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRangeMethod t Range, O.OverloadedMethod info Range p) => OL.IsLabel t (Range -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveRangeMethod t Range, O.OverloadedMethod info Range p, R.HasField t Range p) => R.HasField t Range p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveRangeMethod t Range, O.OverloadedMethodInfo info Range) => OL.IsLabel t (O.MethodProxy info Range) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif