Suggestions…
```scala
private class SelfPopulatingMap[K, V] {
  // use Future rather than Promise because we only want a read-only view
  private val store = TrieMap[K, Future[V]]()

  // I removed the EC param because I reckon we don't need it, but if you do want it in, remember to prepare it!
  def putIfAbsent(k: K)(pf: K => V): Future[V] = {
    val p = Promise[V]
    store.putIfAbsent(k, p.future) match {
      case Some(f) => f
      case None =>
        p.complete(Try(pf(k))
        p.future
    }
  }
}
```