
On Wed, 2008-11-26 at 23:16 +0000, Malcolm Wallace wrote:
... to work out the C types and then map them to Haskell ones, to check they're the same as the declared types in the .hs files.
I'd like to point out that the FFI specification already has such a mechanism. That is, if you use the optional specification of a header file for each foreign import, and if your Haskell compiler can compile via C, then any checking that types match between Haskell and C can be performed automatically, by the backend C compiler.
Yes, it would have caught a similar problem in an argument position, but not in the result.
[ OK, so that is not the whole story, and there are good reasons why it might not always work out, but I still think it was an important principle in the original FFI design. ]
And covering those holes requires a tool that can grok C. Duncan