{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-} -- module HROOT.Class.Interface where module HROOT.Core.TArray.Interface where import Data.Word import Foreign.C import Foreign.Ptr import Foreign.ForeignPtr import FFICXX.Runtime.Cast import HROOT.Core.TArray.RawType import HROOT.Core.Deletable.Interface ---- ============ ---- class (IDeletable a) => ITArray a where instance Existable TArray where data Exist TArray = forall a. (FPtr a, ITArray a) => ETArray a upcastTArray :: (FPtr a, ITArray a) => a -> TArray upcastTArray h = let fh = get_fptr h fh2 :: ForeignPtr RawTArray = castForeignPtr fh in cast_fptr_to_obj fh2 downcastTArray :: (FPtr a, ITArray a) => TArray -> a downcastTArray h = let fh = get_fptr h fh2 = castForeignPtr fh in cast_fptr_to_obj fh2