Scalaz.Task that can be run only once

58 views
Skip to first unread message

Edmondo Porcu

unread,
Feb 27, 2015, 3:18:52 AM2/27/15
to sca...@googlegroups.com
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



Reply all
Reply to author
Forward
0 new messages