[Haskell-cafe] workarounds for Codec.Compression.Zlib errors in darcs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Nov 26 17:44:00 EST 2008


On Wed, 2008-11-26 at 14:30 -0800, Don Stewart wrote:

> > I think there is a need for a tool like c2hs but that works in a
> > checking mode rather than in a generating mode. It would use much of the
> > same code as c2hs but it would read the C header files and the .hs file
> > (via ghc api) and check that the FFI imports are using the right types.
> > That way it could be run to check a package without the checker tool
> > being needed at build time on every platform. The downside would be that
> > some C header files differ between platforms and c2hs handles this fine
> > while a checker tool might say it's ok on one platform and that may not
> > carry over to another. Still, it would be an improvement on just using
> > raw FFI imports (or hsc2hs, which is really the same thing).
> 
> Yes, this plagued xmonad's X11 bindings: almost all bugs in the last 12
> months were due to FFI bindings.
> 
> I'd love a hsc2hs -Wall mode.

Right, but it cannot be hsc2hs. The model of hsc2hs simply does cannot
support such a thing because it does not actually know the C types of
anything. It would have to be more on the model of c2hs, using
Language.C 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.

Duncan



More information about the Haskell-Cafe mailing list