Obtain a snapshot of the current value of the Ref
, and a setter
for updating the value.
Obtain a snapshot of the current value of the Ref
, and a setter
for updating the value. The setter may noop (in which case false
is returned) if another concurrent call to access
uses its
setter first. Once it has noop'd or been used once, a setter
never succeeds again.
Like get
, but returns an F[Unit]
that can be used cancel the subscription.
Create an asynchronous, concurrent mutable reference.
Asynchronously set a reference.
Asynchronously set a reference. After the returned F[Unit]
is bound,
the task is running in the background. Multiple tasks may be added to a
Ref[A]
.
Satisfies: set(r)(t) flatMap { _ => get(r) } == t
.
Returns an F[A]
that evaluates and runs the provided fa
on each run.
Returns an F[A]
that evaluates and runs the provided fa
on each run.
Create an F[A]
from an asynchronous computation, which takes the form
of a function with which we can register a callback.
Create an F[A]
from an asynchronous computation, which takes the form
of a function with which we can register a callback. This can be used
to translate from a callback-based API to a straightforward monadic
version.
Promotes a non-strict value to an F
, catching exceptions in the process.
Promotes a non-strict value to an F
, catching exceptions in the process.
Evaluates a
each time the returned effect is run.
Obtain the value of the Ref
, or wait until it has been set
.
Repeatedly invoke tryModify(f)
until it succeeds.
The read-only portion of a Ref
.
Create an asynchronous, concurrent mutable reference, initialized to a
.
Begin asynchronous evaluation of f
when the returned F[F[A]]
is
bound.
Begin asynchronous evaluation of f
when the returned F[F[A]]
is
bound. The inner F[A]
will block until the result is available.
Try modifying the reference once, returning None
if another
concurrent set
or modify
completes between the time
the variable is read and the time it is set.