title: Haskell FFI - can you obtain a C Pointer from a Haskell data structure?
body: <p>I have quite a few C structs structured like</p>
  
  <pre><code>typedef struct {
      unsigned int a;
      unsigned int b;
  } StructA;
  </code></pre>
  
  <p>And a lot of functions like</p>
  
  <pre><code>void doSomethingWith(StructA*,StructB*,StructC*);
  </code></pre>
  
  <p>Is there an easy way to call these functions with Haskell FFI? Like, is there something that behaves like the &amp; operator in C? (I imagine there isn't, but if there was I'd like to know). Do I <em>have</em> to make the Haskell side <code>data</code>'s instance of storeable (I don't have any constructor functions for these structs).</p>
  
  <p>Also: If I have to pass a struct instead of a struct pointer (not a hypothetical question, I have a few functions like that - it's not my code so I can't do anything about it), can I just pass the components of the struct instead? Like if I want to call</p>
  
  <pre><code>void function(StructA);
  </code></pre>
  
  <p>can I do this with</p>
  
  <pre><code>foreign import ccall "function" :: CUInt -&gt; CUInt -&gt; IO()
  </code></pre>
  
  <p>?</p>