{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-} module GDAL.OGRPolygon.Cast where import Foreign.Ptr import FFICXX.Runtime.Cast import System.IO.Unsafe import GDAL.OGRPolygon.RawType import GDAL.OGRPolygon.Interface instance (IOGRPolygon a, FPtr a) => Castable (a) (Ptr RawOGRPolygon) where cast :: forall r. a -> (Ptr RawOGRPolygon -> IO r) -> IO r cast a x Ptr RawOGRPolygon -> IO r f = Ptr RawOGRPolygon -> IO r f (Ptr (Raw a) -> Ptr RawOGRPolygon forall a b. Ptr a -> Ptr b castPtr (a -> Ptr (Raw a) forall a. FPtr a => a -> Ptr (Raw a) get_fptr a x)) uncast :: forall r. Ptr RawOGRPolygon -> (a -> IO r) -> IO r uncast Ptr RawOGRPolygon x a -> IO r f = a -> IO r f (Ptr (Raw a) -> a forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj (Ptr RawOGRPolygon -> Ptr (Raw a) forall a b. Ptr a -> Ptr b castPtr Ptr RawOGRPolygon x)) instance () => Castable (OGRPolygon) (Ptr RawOGRPolygon) where cast :: forall r. OGRPolygon -> (Ptr RawOGRPolygon -> IO r) -> IO r cast OGRPolygon x Ptr RawOGRPolygon -> IO r f = Ptr RawOGRPolygon -> IO r f (Ptr RawOGRPolygon -> Ptr RawOGRPolygon forall a b. Ptr a -> Ptr b castPtr (OGRPolygon -> Ptr (Raw OGRPolygon) forall a. FPtr a => a -> Ptr (Raw a) get_fptr OGRPolygon x)) uncast :: forall r. Ptr RawOGRPolygon -> (OGRPolygon -> IO r) -> IO r uncast Ptr RawOGRPolygon x OGRPolygon -> IO r f = OGRPolygon -> IO r f (Ptr (Raw OGRPolygon) -> OGRPolygon forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj (Ptr RawOGRPolygon -> Ptr RawOGRPolygon forall a b. Ptr a -> Ptr b castPtr Ptr RawOGRPolygon x))