title: How do I use Haskell's FFI on structs?
body: <p>I have created the following C library for reading an image:</p>
  
  <pre><code>typedef struct {
      unsigned int height;
      unsigned int width;
  
      unsigned char* red; //length=height*width
      unsigned char* green;
      unsigned char* blue;
  } Contents;
  
  Contents readJPEGFile(const char* inFilename);
  </code></pre>
  
  <p>I can't really find any info using arrays and structs with the Foreign Function Interface.
  How would I proceed to be able to use my library in Haskell? </p>
  
  <p>I tried to use the following example as a base: <a href="http://therning.org/magnus/archives/315" rel="noreferrer">http://therning.org/magnus/archives/315</a> but then the hsc file was compiled down to a hs file that only contained the above c-code and nothing more (and of course it can't be compiled).</p>