title: c2hs in- and out- type marshalling
body: <p>I'm looking at the <a href="https://hackage.haskell.org/package/haskell-mpi" rel="nofollow">haskell-mpi binding</a>, and we have e.g. this signature in <code>mpi.h</code>:</p>
  
  <pre><code>int MPI_Initialized (int *flag); 
  </code></pre>
  
  <p>which in <code>Internal.chs</code> is represented as follows: </p>
  
  <pre><code>{#fun unsafe Initialized as ^ {alloca- `Bool' peekBool*} -&gt; `()' discard*- #}
  </code></pre>
  
  <p>Q: I have some trouble understanding what's going on around the input parameter:</p>
  
  <ul>
  <li><p>what's the <code>-</code> modifier doing? The c2hs wiki says "the argument type of the Hs function is determined by the set of all marshalling specifications where the in marshaller is not followed by a minus sign", but I still don't get it.</p></li>
  <li><p>the C function takes a pointer to <code>int</code>; what is the output marshaller doing? AFAICT, it dereferences the pointer and converts the result to Boolean. Is this correct?</p></li>
  </ul>
  
  <p>NB: the <code>MPI_</code> prefix is introduced in the function names by a <code>{# context prefix="MPI"#}</code>.</p>
  
  <p>NB2: </p>
  
  <pre><code>peekBool :: (Storable a, Num a, Eq a) =&gt; Ptr a -&gt; IO Bool
  peekBool = liftM toBool . peek
  </code></pre>
  
  <p>NB3: <code>discard _ = return ()</code>, and the <code>*-</code> modifier serves to run a monadic action but discarding its result </p>