{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-} -- module HROOT.Class.Interface where module HROOT.Core.TSystem.Interface where import Data.Word import Foreign.C import Foreign.Ptr import Foreign.ForeignPtr import FFICXX.Runtime.Cast import HROOT.Core.TSystem.RawType import HROOT.Core.TNamed.Interface ---- ============ ---- class (ITNamed a) => ITSystem a where processEvents :: a -> IO CInt instance Existable TSystem where data Exist TSystem = forall a. (FPtr a, ITSystem a) => ETSystem a upcastTSystem :: (FPtr a, ITSystem a) => a -> TSystem upcastTSystem h = let fh = get_fptr h fh2 :: ForeignPtr RawTSystem = castForeignPtr fh in cast_fptr_to_obj fh2 downcastTSystem :: (FPtr a, ITSystem a) => TSystem -> a downcastTSystem h = let fh = get_fptr h fh2 = castForeignPtr fh in cast_fptr_to_obj fh2