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

Ian Lynagh igloo at
Tue Mar 7 14:05:17 EST 2006

On Tue, Mar 07, 2006 at 07:57:50PM +0100, Tomasz Zielonka wrote:
> On Tue, Mar 07, 2006 at 04:35:27PM -0000, 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 monads (you say arbitrary) may use rather complicated
> machinery to implement their semantics (HOFs, laziness, algebraic data
> types). I don't think it's a good idea to try implementing their actions
> in C (if that's what you want).
> Why do you need that?

I tend to wrap FFI imports with functions that can be called in any
MonadIO monad. I sometimes think I should suggest the FFI should be able
to do this itself, but given I'm generally needing to convert types,
allocate memory etc in these functions too the gain would be fairly


More information about the Glasgow-haskell-users mailing list