title: GCD pattern for chaining async operations while piping the results
body: <p>Coming from JavaScript world using async javascript promises, and I believe the same is done using GCD async queues in Swift.</p>
  
  <p>Can you point me to an example where 2 to 3 async functions are specified in a queue, with one async operation feeding the result to the second, and second feeding the result to the third (commonly known as piping the results) and then finally a result and error handler.</p>
  
  <p>All functions restrict to a single argument by design.</p>
  
  <p>If any error let's say during function 2, function 3 is skipped and error is passed straight down to the error handler. </p>
  
  <p>Looking for a native solution instead of any 3rd party <a href="https://en.wikipedia.org/wiki/Futures_and_promises" rel="nofollow">Promise</a> or <a href="https://en.wikipedia.org/wiki/Monad_(functional_programming)" rel="nofollow">Monad</a> library.</p>
  
  <p>Appreciate swift 3.0 code. </p>
  
  <p>Edit. Also learned from the example that steps are more like a manual linear path in GCD where developer is the one feeding result to the next and checking error each time, Any Functional Programming possible using <a href="https://en.wikipedia.org/wiki/Function_composition_(computer_science)" rel="nofollow">Function Compositions</a>?</p>
  
  <p>I want to avoid <a href="https://pbs.twimg.com/media/COYihdoWgAE9q3Y.jpg" rel="nofollow">Pyramid of Doom</a> and looking for a <a href="http://image.slidesharecdn.com/promisesqonline-130314132109-phpapp01/95/javascript-promisesq-library-11-638.jpg?cb=1363267354" rel="nofollow">linear async programming</a>. </p>