title: RamdaJS - How can I use pipe with sync and async functions?
body: <p>I'm trying to learn Ramda and how to use it on my daily work. So I have a quick question. "How can I use pipe with sync and async functions?" or best, how can I improve the following code?</p>
  
  <pre><code>const AuthService = () =&gt; ({
    async signIn(credentials: Credentials): Promise&lt;AuthSession&gt; {
      const result = await api.signIn(credentials)
  
      return R.pipe(
        signInResultToAuthSession,
        saveAuthSession
      )(result)
    }
  })
  </code></pre>
  
  <p>[EDITED]: A second alternative that I think be better.</p>
  
  <pre><code>const AuthService = () =&gt; ({
    async signIn(credentials: Credentials): Promise&lt;AuthSession&gt; {
      return api.signIn(credentials).then(
        R.pipe(
          signInResultToAuthSession,
          saveAuthSession
        )
      )
    }
  })
  </code></pre>