How to stack applicative functors in Scala
<p>Applicative functors are often mentioned as an alternative to monads when your computation steps are independent. One of their often-mentioned advantages is that you don't need transformers when you want to stack applicatives, because <code>F[G[X]]</code> is always also an applicative.
Let's say I have following functions:</p>

<pre><code>def getDataOption(): Option[Data]
def getUserFuture(): Future[User]
def process(data: Data, user: User)
</code></pre>

<p>I would like to have elegant stacking in order to get a <code>Future[Option[User]]</code> and <code>Future[Option[Data]]</code> and map that with <code>process</code>.</p>

<p>So far I only came up with this (using Cats):</p>

<pre><code>Applicative[Future]
  .compose[Option]
    .map2(
      Applicative[Future].pure(getDataOption()),
      getUserFuture().map(Applicative[Option].pure))(process)
</code></pre>

<p>but I'm sure it's far from ideal. Is there a more elegant and generic way to achieve the same?</p>