[Haskell-cafe] weird behavior with FFI
newsham at lava.net
Sat Feb 2 17:47:17 EST 2008
> 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
> 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
More information about the Haskell-Cafe