[Haskell-cafe] weird behavior with FFI

Tim Newsham newsham at lava.net
Sat Feb 2 16:43:32 EST 2008

I am working on haskell bindings to C functions using FFI.  I have
a callback function that returns "IO ()".  When I pass in the callback
     foo = printf "foo"

it crashes (is there an easy way to debug this exception using ghc6.8.2?)
     bot: SilcClient_d1al: uncaught exception

however, if I pass in the callback function:
     foo = do
         printf "foo"
         return ()

it does not crash.  Is this a bug in my bindings?  In ghc/ffi?
Full code is at:

Tim Newsham

More information about the Haskell-Cafe mailing list