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

-- module HROOT.Class.Interface where

module HROOT.Class.TTUBE.Interface where


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

import HROOT.Class.TTUBE.RawType

import HROOT.Class.TShape.Interface


class (ITShape a) => ITTUBE a where

instance Existable TTUBE where
  data Exist TTUBE = forall a. (FPtr a, ITTUBE a) => ETTUBE a

upcastTTUBE :: (FPtr a, ITTUBE a) => a -> TTUBE
upcastTTUBE h = let fh = get_fptr h
                    fh2 :: ForeignPtr RawTTUBE = castForeignPtr fh
                in cast_fptr_to_obj fh2