And some advice, too.
primIOToIO :: PrimIO a -> IO ato promote a `_ccall_' to the `IO' monad.
f x = _ccall_ foo xis not good enough, because the compiler can't work out what type `x' is, nor what type the `_ccall_' returns. You have to write, say:
f :: Int -> PrimIO Double f x = _ccall_ foo xThis table summarises the standard instances of these classes.
Type CCallable CReturnable Which is probably... ----------------------------------------------------------------------------------------- `Char' Yes Yes `unsigned char' `Int' Yes Yes `long int' `_Word' Yes Yes `unsigned long int' `_Addr' Yes Yes `char *' `Float' Yes Yes `float' `Double' Yes Yes `double' `()' No Yes `void' `[Char]' Yes No `char *' (null-terminated) `Array' Yes No `unsigned long *' `_ByteArray' Yes No `unsigned long *' `_MutableArray' Yes No `unsigned long *' `_MutableByteArray' Yes No `unsigned long *' `_State' Yes Yes nothing! `_StablePtr' Yes Yes `unsigned long *' `_MallocPtr' Yes Yes see laterThe brave and careful programmer can add their own instances of these classes for the following types:
Int Double data XDisplay = XDisplay Addr# data EFS a = EFS# MallocPtr#
instance _CCallable (EFS a) instance _CReturnable (EFS a)
data MyVoid = MyVoid instance _CReturnable MyVoid