How to find out the C type signature corresponding to a Haskell function type in FFI?

2006-03-07 Thread Brian Hulley
Hi - I've got a Haskell module with the following ffi import: foreign import ccall duma_init :: Int - IO Int However my problem is that I've got no idea what the type signature for the corresponding C function should be, and when I compile the above module with ghc -fglasgow-exts -fffi --make

Re: How to find out the C type signature corresponding to a Haskell function type in FFI?

2006-03-07 Thread Bulat Ziganshin
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

Getting GHC to print Done when it's finished linking?

2006-03-07 Thread Brian Hulley
Hi - I've set up my Visual Studio environment so that ghc is an external tool, where the output from ghc appears on the VS output pane. However when I use this to compile and link a Haskell program (I'm just using the plain text editor that comes with VC++ not the Haskell plugin because of its

Re: Getting GHC to print Done when it's finished linking?

2006-03-07 Thread Tomasz Zielonka
On Tue, Mar 07, 2006 at 06:45:52PM -, Brian Hulley wrote: Is there any flag to get ghc or the ghc linker to print Done or something when it's finished? In unix you could wrap ghc in a script that would print Done if ghc finished successfully. I am sure you can do it somehow in windows.

Re: Getting GHC to print Done when it's finished linking?

2006-03-07 Thread Neil Mitchell
In unix you could wrap ghc in a script that would print Done if ghc finished successfully. I am sure you can do it somehow in windows. ghc --make Whatever if errorfail 1 goto failed echo Success :-) goto end :failed echo Failure :-( :end Thanks Neil

Re: How to find out the C type signature corresponding to a Haskell function type in FFI?

2006-03-07 Thread Tomasz Zielonka
On Tue, Mar 07, 2006 at 04:35:27PM -, Brian Hulley wrote: A third point is, how would I pass an arbitrary monad instead of just using IO? What for? IO is the monad that most closely matches the imperative, C semantics. That's why FFI only supports the IO monad (and pure functions). Other

Re: Getting GHC to print Done when it's finished linking?

2006-03-07 Thread Tomasz Zielonka
On Tue, Mar 07, 2006 at 06:54:50PM +, Neil Mitchell wrote: In unix you could wrap ghc in a script that would print Done if ghc finished successfully. I am sure you can do it somehow in windows. ghc --make Whatever if errorfail 1 goto failed echo Success :-) goto end :failed echo

Re: How to find out the C type signature corresponding to a Haskell function type in FFI?

2006-03-07 Thread Ian Lynagh
On Tue, Mar 07, 2006 at 07:57:50PM +0100, Tomasz Zielonka wrote: On Tue, Mar 07, 2006 at 04:35:27PM -, Brian Hulley wrote: A third point is, how would I pass an arbitrary monad instead of just using IO? What for? IO is the monad that most closely matches the imperative, C semantics.

Re: Getting GHC to print Done when it's finished linking?

2006-03-07 Thread Brian Hulley
Neil Mitchell wrote: In unix you could wrap ghc in a script that would print Done if ghc finished successfully. I am sure you can do it somehow in windows. ghc --make Whatever if errorfail 1 goto failed echo Success :-) goto end failed echo Failure :-( end Thanks Neil - the script below,

Re: How to find out the C type signature corresponding to a Haskell function type in FFI?

2006-03-07 Thread Brian Hulley
Bulat Ziganshin wrote: Hello Brian, Tuesday, March 7, 2006, 7:35:27 PM, you wrote: foreign import ccall duma_init :: Int - IO Int int duma_init(int); Also, I really wanted to be able to use () - IO () but () doesn't seem to be allowed in FFI... void f(void); foreign import ccall f :: IO