{-# LANGUAGE EmptyDataDecls, ExistentialQuantification, FlexibleContexts, FlexibleInstances, ForeignFunctionInterface, MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies, TypeSynonymInstances #-} module STD.Ostream.Interface where import Data.Word import Data.Int import Foreign.C import Foreign.Ptr import FFICXX.Runtime.Cast import STD.Ostream.RawType class () => IOstream a where upcastOstream :: forall a . (FPtr a, IOstream a) => a -> Ostream upcastOstream :: forall a. (FPtr a, IOstream a) => a -> Ostream upcastOstream a h = let fh :: Ptr (Raw a) fh = forall a. FPtr a => a -> Ptr (Raw a) get_fptr a h Ptr RawOstream fh2 :: Ptr RawOstream = forall a b. Ptr a -> Ptr b castPtr Ptr (Raw a) fh in forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj Ptr RawOstream fh2 downcastOstream :: forall a . (FPtr a, IOstream a) => Ostream -> a downcastOstream :: forall a. (FPtr a, IOstream a) => Ostream -> a downcastOstream Ostream h = let fh :: Ptr (Raw Ostream) fh = forall a. FPtr a => a -> Ptr (Raw a) get_fptr Ostream h fh2 :: Ptr (Raw a) fh2 = forall a b. Ptr a -> Ptr b castPtr Ptr (Raw Ostream) fh in forall a. FPtr a => Ptr (Raw a) -> a cast_fptr_to_obj Ptr (Raw a) fh2