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