[Haskell-cafe] Suggestions for #defines with FFI

John Goerzen jgoerzen at complete.org
Thu Jul 28 08:12:14 EDT 2005


On Wed, Jul 27, 2005 at 10:52:41PM +0200, Tomasz Zielonka wrote:
> On Wed, Jul 27, 2005 at 01:28:38PM -0500, John Goerzen wrote:
> > I'm writing a Haskell interface to a library that #defines about 100
> > constants corresponding to numeric exit codes.  It also defines hundreds
> > of contants, over the same numbering ranges, for other purposes.  The
> > exit codes are non-contiguous as well.
> > 
> > So my question is: is there a nice way I can represent this in Haskell,
> > preferably without having to key in all 100 constants?
> 
> Did you consider hsc2hs?

Yes.  That's what I'm using now.  It does pull in the values for the
consts, but that's about it.  I still have to key everything in
manually.

-- John


More information about the Haskell-Cafe mailing list