Use combinators to clean up mapJsonAsync in Suave.io
<p>In suave.io, there's a function <a href="https://github.com/SuaveIO/suave/blob/master/src/Suave/Json.fs" rel="nofollow">mapJson</a>:</p>

<pre><code>let mapJson (f: 'a -&gt; 'b) =
  request(fun r -&gt;
    f (fromJson r.rawForm) 
    |&gt; toJson
    |&gt; Successful.ok 
    &gt;=&gt; Writers.setMimeType "application/json")
</code></pre>

<p>Is there a way to make an async version of this similarly using combinators?  I can write it out by hand as follows</p>

<pre><code>let mapJsonAsync (f: 'a -&gt; Async&lt;'b&gt;) (ctx: HttpContext) =
  async {
    let! x = f(fromJson ctx.request.rawForm)
    let resp = Successful.ok (toJson x) &gt;&gt;= Writers.setMimeType "application/json"
    return! resp ctx
  }
</code></pre>

<p>but it would be nicer not to have to explicitly define <code>ctx</code> or the intermediate values.</p>