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

-- module HROOT.Class.Interface where

module HROOT.Class.TBRIK.Interface where


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

import HROOT.Class.TBRIK.RawType

import HROOT.Class.TShape.Interface


class (ITShape a) => ITBRIK a where

instance Existable TBRIK where
  data Exist TBRIK = forall a. (FPtr a, ITBRIK a) => ETBRIK a

upcastTBRIK :: (FPtr a, ITBRIK a) => a -> TBRIK
upcastTBRIK h = let fh = get_fptr h
                    fh2 :: ForeignPtr RawTBRIK = castForeignPtr fh
                in cast_fptr_to_obj fh2