
On Wed, Nov 26, 2008 at 3:16 PM, Malcolm Wallace < malcolm.wallace@cs.york.ac.uk> 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.
[ 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. ]
Would this method work with return types since C compilers tend to let you ignore those? In this example that brought up this discussion it was in fact an ignored return value that caused the problem. Jason