{-# LANGUAGE DataKinds, FlexibleInstances, MultiParamTypeClasses,
UndecidableInstances, KindSignatures, TypeFamilies, TypeOperators #-}
#if !MIN_VERSION_base(4,8,0)
{-# LANGUAGE OverlappingInstances #-}
#endif
module Data.GI.Base.Constructible
( Constructible(..)
) where
import Control.Monad.IO.Class (MonadIO)
import Data.GI.Base.Attributes (AttrOp, AttrOpTag(..))
import Data.GI.Base.BasicTypes (GObject, ManagedPtr)
import Data.GI.Base.GObject (constructGObject)
class Constructible a (tag :: AttrOpTag) where
new :: MonadIO m => (ManagedPtr a -> a) -> [AttrOp a tag] -> m a
instance {-# OVERLAPPABLE #-}
(GObject a, tag ~ 'AttrConstruct) => Constructible a tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr a -> a) -> [AttrOp a tag] -> m a
new = (ManagedPtr a -> a) -> [AttrOp a tag] -> m a
(ManagedPtr a -> a) -> [AttrOp a 'AttrConstruct] -> m a
forall o (m :: * -> *).
(GObject o, MonadIO m) =>
(ManagedPtr o -> o) -> [AttrOp o 'AttrConstruct] -> m o
constructGObject