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

-- module HROOT.Class.Interface where

module HROOT.Class.TCrown.Interface where


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

import HROOT.Class.TCrown.RawType

import HROOT.Class.TEllipse.Interface


class (ITEllipse a) => ITCrown a where

instance Existable TCrown where
  data Exist TCrown = forall a. (FPtr a, ITCrown a) => ETCrown a

upcastTCrown :: (FPtr a, ITCrown a) => a -> TCrown
upcastTCrown h = let fh = get_fptr h
                     fh2 :: ForeignPtr RawTCrown = castForeignPtr fh
                 in cast_fptr_to_obj fh2