title: How do pipes and monads work together in JavaScript?
body: <p>I have looked at similar questions and answers and have not found an answer that directly addresses my question. I am struggling to understand how to use <code>Maybe</code> or <code>Either</code>or <code>Monads</code> in conjunction with piping functions. I want to pipe functions together, but I want the pipe to stop and return an error if one occurs at any step. I am trying to implement Functional Programming concepts in a node.js app, and this is really my first serious exploration of either, so no answer will be so simple as to insult my intelligence on the subject. </p>
  
  <p>I have written a pipe function like this: </p>
  
  <pre><code>const _pipe = (f, g) =&gt; async (...args) =&gt; await g( await f(...args))
  
  module.exports = {arguments.
      pipeAsync: async (...fns) =&gt; {
          return await fns.reduce(_pipe)
      }, 
  ...
  </code></pre>
  
  <p>I am calling it like this: </p>
  
  <pre><code>    const token = await utils.pipeAsync(makeACall, parseAuthenticatedUser, syncUserWithCore, managejwt.maketoken)(x, y)  
  </code></pre>