{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-} module HROOT.Core.TCollection.Cast where import Foreign.Ptr import FFICXX.Runtime.Cast import System.IO.Unsafe import HROOT.Core.TCollection.RawType import HROOT.Core.TCollection.Interface instance (ITCollection a, FPtr a) => Castable a (Ptr RawTCollection) where cast x f = f (castPtr (get_fptr x)) uncast x f = f (cast_fptr_to_obj (castPtr x)) instance Castable TCollection (Ptr RawTCollection) where cast x f = f (castPtr (get_fptr x)) uncast x f = f (cast_fptr_to_obj (castPtr x))