{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies, MultiParamTypeClasses, OverlappingInstances, IncoherentInstances #-} module GDAL.OGRPoint.Cast where import Foreign.Ptr import FFICXX.Runtime.Cast import System.IO.Unsafe import GDAL.OGRPoint.RawType import GDAL.OGRPoint.Interface instance (IOGRPoint a, FPtr a) => Castable (a) (Ptr RawOGRPoint) where cast :: forall r. a -> (Ptr RawOGRPoint -> IO r) -> IO r cast a x Ptr RawOGRPoint -> IO r f = Ptr RawOGRPoint -> IO r f (Ptr (Raw a) -> Ptr RawOGRPoint 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 RawOGRPoint -> (a -> IO r) -> IO r uncast Ptr RawOGRPoint 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 RawOGRPoint -> Ptr (Raw a) forall a b. Ptr a -> Ptr b castPtr Ptr RawOGRPoint x)) instance () => Castable (OGRPoint) (Ptr RawOGRPoint) where cast :: forall r. OGRPoint -> (Ptr RawOGRPoint -> IO r) -> IO r cast OGRPoint x Ptr RawOGRPoint -> IO r f = Ptr RawOGRPoint -> IO r f (Ptr RawOGRPoint -> Ptr RawOGRPoint forall a b. Ptr a -> Ptr b castPtr (OGRPoint -> Ptr (Raw OGRPoint) forall a. FPtr a => a -> Ptr (Raw a) get_fptr OGRPoint x)) uncast :: forall r. Ptr RawOGRPoint -> (OGRPoint -> IO r) -> IO r uncast Ptr RawOGRPoint x OGRPoint -> IO r f = OGRPoint -> IO r f (Ptr (Raw OGRPoint) -> OGRPoint forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj (Ptr RawOGRPoint -> Ptr RawOGRPoint forall a b. Ptr a -> Ptr b castPtr Ptr RawOGRPoint x))