packages feed

gi-gobject-0.2.46.13: GI/GObject/Structs/TypeInstance.hs


{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

An opaque structure used as the base of all type instances.
-}

module GI.GObject.Structs.TypeInstance
    ( 

-- * Exported types
    TypeInstance(..)                        ,
    newZeroTypeInstance                     ,
    noTypeInstance                          ,


    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.GObject.Types
import GI.GObject.Callbacks

newtype TypeInstance = TypeInstance (ForeignPtr TypeInstance)
-- | Construct a `TypeInstance` struct initialized to zero.
newZeroTypeInstance :: MonadIO m => m TypeInstance
newZeroTypeInstance = liftIO $ callocBytes 8 >>= wrapPtr TypeInstance

noTypeInstance :: Maybe TypeInstance
noTypeInstance = Nothing

type family ResolveTypeInstanceMethod (t :: Symbol) (o :: *) :: * where
    ResolveTypeInstanceMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveTypeInstanceMethod t TypeInstance, MethodInfo info TypeInstance p) => IsLabelProxy t (TypeInstance -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTypeInstanceMethod t TypeInstance, MethodInfo info TypeInstance p) => IsLabel t (TypeInstance -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif