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