title: Is there some pipe operator to last argument or a way to define it in F#?
body: <p>I want a piping operator able to pipe as last parameter. For example, with this definitions:</p>
  <pre class="lang-ml prettyprint-override"><code>let download  (uri: String) scoped  =
      use client = new HttpClient()
      task {
          let! stream = client.GetStreamAsync(uri)
          let! r = scoped stream
          return r
      }
  
  let decompressStream stream scoped   =
      use decompressedStream = new GZipStream(stream, CompressionMode.Decompress)
      task {
          let! r = scoped decompressedStream
          return r
      }
  
  let writeToTempFile (stream: Stream) =
      let fileName = Path.GetTempFileName()
      use fileStream = File.OpenWrite(fileName)
      task {
          do! stream.CopyToAsync(fileStream)
          return fileName
      }
  </code></pre>
  <p>I want to be able to write this code (suppose the operator is |&amp;&gt; ):</p>
  <pre class="lang-ml prettyprint-override"><code>let downloadAndDecompress =
      download |&amp;&gt; decompressStream |&amp;&gt; writeToTempFile
  </code></pre>
  <p>So I can compose functions, putting right side as last parameter (parameter scoped) of the left side of the operator. The operator should be left associative. So at the end, In my example, I would use downloadAndDecompress passing an url and I would get the temp filename with the decompressed content as result.</p>
  <p>I'm trying with this code:</p>
  <pre class="lang-ml prettyprint-override"><code>type LastPipedArg = 
      static member inline (|&amp;&gt;)( f: 'a1 -&gt; 'r, lastArg: 'a1) =
          f lastArg
  
      static member inline (|&amp;&gt;)(f: 'a1 -&gt; 'a2 -&gt; 'r, lastArg: 'a2) =
          fun a1 -&gt; f a1 lastArg
  
      static member inline (|&amp;&gt;)( f: 'a1 -&gt; 'a2 -&gt; 'a3 -&gt; 'r, lastArg: 'a3) =
          fun a1 a2 -&gt; f a1 a2 lastArg
          
      static member inline (|&amp;&gt;)(f: 'a1 -&gt; 'a2 -&gt; 'a3 -&gt; 'a4-&gt; 'r, lastArg: 'a4) =
          fun a1 a2 a3 -&gt; f a1 a2 a3 lastArg
  </code></pre>
  <p>But, I cant get this to work.</p>
  <p>So, is there some implementation of this semantics or something very similar? How can implement the custom binary piping operator?</p>