The TimedFuture
effect is a thin shim on top of Scala’s
Future
. The only extra capability it has built-in is
timeouts, which are supported by passing in a
ScheduledExecutionContext
. Note that because
Future
represents a computation already taking place,
TimedFuture
is a function that returns a
Future
. This means if you start a computation before
passing the Future
into Eff, the Future
will
begin less predictably.
Now, let’s create some TimedFuture
effects:`> Some(1)`
You can also use other Future
or Task
effects:
monix
: depend on eff-monix
and import
org.atnos.eff.addon.monix.task._
There are corresponding syntax imports to be able to call
runAsync
methods in:
monix
:
org.atnos.eff.syntax.addon.monix.task._
Future
and Task
computations can also be
memoized to avoid expensive computations to be done several times. You
can either
futureMemo/taskMemo
operator with a (mutable)
cachefutureMemoized/taskMemoized
operator with the
Memoized
effect (you will need to provide the cache later)
`> there is only one invocation <=> true`