I am doing some wrappers for c functions, and I need to access defines, enums, and structs.
I am doing this by writing access functions in c, so that I can call them from Haskell.
Is there a way to write this c code inline in the Haskell module?
You want to use a tool to make all this easier. There are various tools available: green-card, c2hs, and hsc2hs are the most commonly-used ones these days. Alastair Reid wrote a good comparison of the various tools (can't remember the link off hand though). There are examples of hsc2hs code in the libraries - particularly fptools/libraries/unix has examples of doing defines, enums and structs. Examples of green-card stuff can be found in fptools/libraries/HGL and fptools/libraries/X11. Take a look at Manuel's GtkHS for c2hs examples. Cheers, Simon