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

-- module HROOT.Class.Interface where

module HROOT.Class.TFile.Interface where


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

import HROOT.Class.TFile.RawType

import HROOT.Class.TDirectoryFile.Interface


class (ITDirectoryFile a) => ITFile a where

instance Existable TFile where
  data Exist TFile = forall a. (FPtr a, ITFile a) => ETFile a

upcastTFile :: (FPtr a, ITFile a) => a -> TFile
upcastTFile h = let fh = get_fptr h
                    fh2 :: ForeignPtr RawTFile = castForeignPtr fh
                in cast_fptr_to_obj fh2