I am trying to wrap a Java API where some asynchronous operations should be submitted only once.
However, if I create a Task and then map it, I would like the Task to be executed only once:
val a:Task[A] = ....
val b = a map f1
val c = a map f2
When b and c are run , a is run twice, and this produces a wrong behavior in my application. What is the idiomatic approach to create a Task that can be run only once, much as the Scala Future?
Best