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

-- module HROOT.Class.Interface where

module HROOT.Class.TH2Poly.Interface where


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

import HROOT.Class.TH2Poly.RawType

import HROOT.Class.TH2.Interface


class (ITH2 a) => ITH2Poly a where

instance Existable TH2Poly where
  data Exist TH2Poly = forall a. (FPtr a, ITH2Poly a) => ETH2Poly a

upcastTH2Poly :: (FPtr a, ITH2Poly a) => a -> TH2Poly
upcastTH2Poly h = let fh = get_fptr h
                      fh2 :: ForeignPtr RawTH2Poly = castForeignPtr fh
                  in cast_fptr_to_obj fh2