Hello Brian,

Tuesday, March 7, 2006, 7:35:27 PM, you wrote:

BH> foreign import ccall duma_init :: Int -> IO Int

int duma_init(int);

BH> I've tried looking at the wiki but that only seems to give specific
BH> examples. I'm trying to find what the mapping is between Haskell function
BH> signatures and C signatures is in general. Any ideas?

see official FFI documentation - 
http://www.cse.unsw.edu.au/~chak/haskell/ffi/ffi.pdf
and excellent paper "Tackling the awkward squad: monadic input/output, 
concurrency,
exceptions, and foreign-language calls in Haskell"
(http://research.microsoft.com/Users/simonpj/papers/marktoberdorf/marktoberdorf.ps.gz)

BH> Also, I really wanted to be able to use () -> IO () but () doesn't seem to
BH> be allowed in FFI...

void f(void);

foreign import ccall f :: IO ()

BH> A third point is, how would I pass an arbitrary monad instead of just using
BH> IO?

if you are sure what you do, you can even declare C function as pure:

foreign import ccall duma_init :: Int -> Int

-- 
Best regards,
 Bulat                            mailto:[EMAIL PROTECTED]

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to