[Haskell-cafe] Consequences of implementing a library in Haskell for C consumption?

Justin Bailey jgbailey at gmail.com
Thu Sep 4 17:28:21 EDT 2008

I am thinking of writing a simple library in Haskell which would be
useful in a number of different scenarios, and not always with
programs written in Haskell. That makes me think the library should be
C-compatible and able to link with C programs. Reading over chapter 9
of the GHC manual ("Foreign function interface"), it seems simple to

However, what are the consequences of such an implementation? Would
any program using my library need to link the entire GHC runtime? The
library will not expose any higher-order functions or other business.
It would be straightforward but tedious to write in C, which is why
I'd rather use Haskell.

Thanks in advance for any thoughts.


More information about the Haskell-Cafe mailing list