[Haskell-cafe] Consequences of implementing a library in Haskell
for C consumption?
dons at galois.com
Thu Sep 4 17:32:42 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.
You still need the GHC runtime support for the Haskell code (GC,
scheduler et al).
> It would be straightforward but tedious to write in C, which is why
> I'd rather use Haskell.
Easy enough to do,
Would be great to hear how you find the experience.
More information about the Haskell-Cafe