HROOT-core-0.8: src/HROOT/Core/TArrayL64/Cast.hs
{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-}
module HROOT.Core.TArrayL64.Cast where
import Foreign.Ptr
import Foreign.ForeignPtr (castForeignPtr, newForeignPtr_)
import Foreign.ForeignPtr.Unsafe
import FFICXX.Runtime.Cast
import System.IO.Unsafe
import HROOT.Core.TArrayL64.RawType
import HROOT.Core.TArrayL64.Interface
instance (ITArrayL64 a, FPtr a) => Castable a (Ptr RawTArrayL64) where
cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_
instance Castable TArrayL64 (Ptr RawTArrayL64) where
cast = unsafeForeignPtrToPtr . castForeignPtr . get_fptr
uncast = cast_fptr_to_obj . castForeignPtr . unsafePerformIO . newForeignPtr_