{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, 
             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}

-- module HROOT.Class.Interface where

module HROOT.Class.TArray.Interface where


import Data.Word
import Foreign.ForeignPtr
import HROOT.TypeCast

import HROOT.Class.TArray.RawType

import HROOT.Class.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