
2 Feb
2008
2 Feb
'08
5:47 p.m.
Am Samstag, 2. Februar 2008 schrieb Tim Newsham:
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 function:
I suspect this has to do with printf returning 'undefined' if you use it with an IO type. Something in the code looks at the result and crashes. Your second version is equivalent to printf "foo" >>= \_ -> return (), i.e. it never evaluates printf's result but returns () instead. Fixing the first version would require some changes to Text.Printf, restricting the 'a' in PrintfType (IO a).
But the callback function is already of type "IO ()" as mentioned above.
HTH, Lukas
Tim Newsham http://www.thenewsh.com/~newsham/