{-# OPTIONS_GHC -Wall #-} {-# LANGUAGE ForeignFunctionInterface , ScopedTypeVariables , TypeFamilies , FlexibleContexts #-} module Test1 where import Foreign.Ptr (Ptr,FunPtr,plusPtr) import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr) import Foreign.Storable import Foreign.C.Types import Foreign.C.String (CString,CStringLen,CWString,CWStringLen) import Foreign.Marshal.Alloc (alloca) import Foreign.Marshal.Array (peekArray,pokeArray) import Data.Int import Data.Word class (Storable (CType a)) => Gettable a where type CType a :: * type ReturnType a :: * get :: a -> IO (ReturnType a) data Trnif = Trnif instance Gettable Trnif where type CType Trnif = CUShort type ReturnType Trnif = Bool get _ = return True class Flags a where type RetType a :: * newtype F a = F a instance (Flags a) => Gettable (F a) where type CType (F a) = CUShort type ReturnType (F a) = Bool get _ = return True data Rstif = Rstif instance Flags Rstif where type RetType Rstif = Bool