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