Would you review/test my FFI library?

Maurí­cio CA mauricio.antunes at gmail.com
Fri Oct 16 23:41:03 EDT 2009


I've been working over the last months in what I call a
"preprocessor DSL for Haskell FFI" :) It started as a crude
attempt, with many problems. But by now it has evolved and been
sharped into something that I want to recomend as a professional
quality tool for practical FFI. By professional, I just mean it
generates reliable, predictable code, and the code you write
using it is portable and extremely easy to write and, even more,

I have to warn: it isn't really intelectually exciting. Don't
waste your time with it, unless you have a recurrent need for FFI.
I started it from a professional need, and it's not more than a
small set of preprocessor macros for hsc2hs. I have been able
to use it, though, to get bindings to very extensive C libraries
in just a few hours.

The main idea in this tool is to shift the way Haskell power is
applied over C code. Instead of mixing Haskell code and C names,
we write an almost transparent layer over C. On top of that, we
will then write our Haskell code. Although that FFI layer is just
"C on Haskell", you get a lot of flexibility in the Haskell cover.

Here it is, documentation, hackage package and an example from
DirectFB types:


I appreciate any comments you have, specially problems you see.


More information about the Libraries mailing list