{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-} module HROOT.Class.TCollection.Cast where import Foreign.Ptr import Foreign.ForeignPtr import HROOT.TypeCast import System.IO.Unsafe import HROOT.Class.TCollection.RawType import HROOT.Class.TCollection.Interface instance (ITCollection a, FPtr a) => Castable a (Ptr RawTCollection) where cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_ instance Castable TCollection (Ptr RawTCollection) where cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_