title: Is there a way to chain functions like withCString?
body: <p>Is there a way to chain functions like <code>withCString</code>? By that I mean any
  function that looks something like <code>f :: Foo -&gt; (CFoo -&gt; IO a) -&gt; IO a</code>.</p>
  
  <p>For example, lets say there is a function <code>cFunc :: CString -&gt; CFoo -&gt; CBar -&gt; IO ()</code></p>
  
  <p>Usualy, I would do something like:</p>
  
  <pre><code>haskellFunc string foo bar =
    withCString string $ \ cString -&gt;
      withCFoo foo $ \ cFoo -&gt;
        withCBar bar $ \ cBar -&gt;
          cFunc cString cFoo cBar
  </code></pre>
  
  <p>But i would like to do something like:</p>
  
  <pre><code>haskellFunc = (withCString |.| withCFoo |.| withCBar) cFunc
  </code></pre>
  
  <p>with some appropriate composition operator <code>|.|</code>.</p>
  
  <p>I'm writing library with a lot of C bindings, and this boilerplate comes
  often. Am I doing something wrong?</p>