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

-- module HROOT.Class.Interface where

module HROOT.Class.TPCON.Interface where


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

import HROOT.Class.TPCON.RawType

import HROOT.Class.TShape.Interface


class (ITShape a) => ITPCON a where

instance Existable TPCON where
  data Exist TPCON = forall a. (FPtr a, ITPCON a) => ETPCON a

upcastTPCON :: (FPtr a, ITPCON a) => a -> TPCON
upcastTPCON h = let fh = get_fptr h
                    fh2 :: ForeignPtr RawTPCON = castForeignPtr fh
                in cast_fptr_to_obj fh2