Maps and filters the get
value of the ZRefM
with the specified partial
function, returning a ZRefM
with a get
value that succeeds with the
result of the partial function if it is defined or else fails with None
.
Maps and filters the get
value of the ZRefM
with the specified partial
function, returning a ZRefM
with a get
value that succeeds with the
result of the partial function if it is defined or else fails with None
.
Maps and filters the get
value of the ZRef.Synchronized
with the
specified effectual partial function, returning a ZRef.Synchronized
with a get
value that succeeds with the result of the partial function
if it is defined or else fails with None
.
Transforms the set
value of the ZRef.Synchronized
with the specified
function.
Transforms the set
value of the ZRef.Synchronized
with the specified
function.
Transforms the set
value of the ZRef
with the specified fallible
function.
Transforms the set
value of the ZRef
with the specified fallible
function.
Transforms the set
value of the ZRef.Synchronized
with the specified
effectual function.
Transforms both the set
and get
values of the ZRef.Synchronized
with the specified functions.
Transforms both the set
and get
values of the ZRef.Synchronized
with the specified functions.
Transforms both the set
and get
values of the ZRef
with the
specified fallible functions.
Transforms both the set
and get
values of the ZRef
with the
specified fallible functions.
Transforms both the set
and get
errors of the ZRef.Synchronized
with the specified functions.
Transforms both the set
and get
errors of the ZRef.Synchronized
with the specified functions.
Transforms both the set
and get
values of the ZRef.Synchronized
with the specified effectual functions.
Filters the set
value of the ZRef.Synchronized
with the specified
predicate, returning a ZRef.Synchronized
with a set
value that
succeeds if the predicate is satisfied or else fails with None
.
Filters the set
value of the ZRef.Synchronized
with the specified
predicate, returning a ZRef.Synchronized
with a set
value that
succeeds if the predicate is satisfied or else fails with None
.
Filters the set
value of the ZRef.Synchronized
with the specified
effectual predicate, returning a ZRef.Synchronized
with a set
value
that succeeds if the predicate is satisfied or else fails with None
.
Filters the get
value of the ZRef.Synchronized
with the specified
predicate, returning a ZRef.Synchronized
with a get
value that
succeeds if the predicate is satisfied or else fails with None
.
Filters the get
value of the ZRef.Synchronized
with the specified
predicate, returning a ZRef.Synchronized
with a get
value that
succeeds if the predicate is satisfied or else fails with None
.
Filters the get
value of the ZRef.Synchronized
with the specified
effectual predicate, returning a ZRef.Synchronized
with a get
value
that succeeds if the predicate is satisfied or else fails with None
.
Folds over the error and value types of the ZRef.Synchronized
.
Folds over the error and value types of the ZRef.Synchronized
.
Folds over the error and value types of the ZRef.Synchronized
,
allowing access to the state in transforming the set
value but
requiring unifying the error type.
Folds over the error and value types of the ZRef.Synchronized
,
allowing access to the state in transforming the set
value but
requiring unifying the error type.
Folds over the error and value types of the ZRef.Synchronized
,
allowing access to the state in transforming the set
value.
Folds over the error and value types of the ZRef.Synchronized
,
allowing access to the state in transforming the set
value. This is a
more powerful version of foldZIO
but requires unifying the environment
and error types.
Folds over the error and value types of the ZRef.Synchronized
.
Folds over the error and value types of the ZRef.Synchronized
. This is
a highly polymorphic method that is capable of arbitrarily transforming
the error and value types of the ZRef.Synchronized
. For most use cases
one of the more specific combinators implemented in terms of foldZIO
will be more ergonomic but this method is extremely useful for
implementing new combinators.
Reads the value from the ZRef
.
Reads the value from the ZRef
.
Transforms the get
value of the ZRef.Synchronized
with the specified
function.
Transforms the get
value of the ZRef.Synchronized
with the specified
function.
Transforms the get
value of the ZRef
with the specified fallible
function.
Transforms the get
value of the ZRef
with the specified fallible
function.
Transforms the get
value of the ZRef.Synchronized
with the specified
effectual function.
Returns a read only view of the ZRef.Synchronized
.
Returns a read only view of the ZRef.Synchronized
.
Writes a new value to the ZRef
, with a guarantee of immediate
consistency (at some cost to performance).
Writes a new value to the ZRef
, with a guarantee of immediate
consistency (at some cost to performance).
Writes a new value to the ZRef
without providing a guarantee of
immediate consistency.
Writes a new value to the ZRef
without providing a guarantee of
immediate consistency.
Performs the specified effect every time a value is written to this
ZRef.Synchronized
.
Performs the specified effect very time a value is read from this
ZRef.Synchronized
.
Returns a write only view of the ZRef.Synchronized
.
Returns a write only view of the ZRef.Synchronized
.
Maps and filters the get
value of the ZRefM
with the specified
effectual partial function, returning a ZRefM
with a get
value that
succeeds with the result of the partial function if it is defined or else
fails with None
.
Maps and filters the get
value of the ZRefM
with the specified
effectual partial function, returning a ZRefM
with a get
value that
succeeds with the result of the partial function if it is defined or else
fails with None
.
(Since version 2.0.0) use collectZIO
Transforms the set
value of the ZRefM
with the specified effectual
function.
Transforms the set
value of the ZRefM
with the specified effectual
function.
(Since version 2.0.0) use contramapZIO
Transforms both the set
and get
values of the ZRefM
with the
specified effectual functions.
Transforms both the set
and get
values of the ZRefM
with the
specified effectual functions.
(Since version 2.0.0) use dimapZIO
Filters the set
value of the ZRefM
with the specified effectual
predicate, returning a ZRefM
with a set
value that succeeds if the
predicate is satisfied or else fails with None
.
Filters the set
value of the ZRefM
with the specified effectual
predicate, returning a ZRefM
with a set
value that succeeds if the
predicate is satisfied or else fails with None
.
(Since version 2.0.0) use filterInputZIO
Filters the get
value of the ZRefM
with the specified effectual predicate,
returning a ZRefM
with a get
value that succeeds if the predicate is
satisfied or else fails with None
.
Filters the get
value of the ZRefM
with the specified effectual predicate,
returning a ZRefM
with a get
value that succeeds if the predicate is
satisfied or else fails with None
.
(Since version 2.0.0) use filterOutputZIO
Folds over the error and value types of the ZRefM
, allowing access to
the state in transforming the set
value.
Folds over the error and value types of the ZRefM
, allowing access to
the state in transforming the set
value. This is a more powerful version
of foldM
but requires unifying the environment and error types.
(Since version 2.0.0) use foldAllZIO
Folds over the error and value types of the ZRefM
.
Folds over the error and value types of the ZRefM
. This is a highly
polymorphic method that is capable of arbitrarily transforming the error
and value types of the ZRefM
. For most use cases one of the more
specific combinators implemented in terms of foldM
will be more
ergonomic but this method is extremely useful for implementing new
combinators.
(Since version 2.0.0) use foldZIO
Transforms the get
value of the ZRefM
with the specified effectual
function.
Transforms the get
value of the ZRefM
with the specified effectual
function.
(Since version 2.0.0) use mapZIO
A
ZRef.Synchronized[RA, RB, EA, EB, A, B]
is a polymorphic, purely functional description of a mutable reference. The fundamental operations of aZRef.Synchronized
areset
andget
.set
takes a value of typeA
and sets the reference to a new value, requiring an environment of typeRA
and potentially failing with an error of typeEA
.get
gets the current value of the reference and returns a value of typeB
, requiring an environment of typeRB
and potentially failing with an error of typeEB
.When the error and value types of the
ZRef.Synchronized
are unified, that is, it is aZRef.Synchronized[R, R, E, E, A, A]
, theZRef.Synchronized
also supports atomicmodify
andupdate
operations.Unlike an ordinary
ZRef
, aZRef.Synchronized
allows performing effects within update operations, at some cost to performance. Writes will semantically block other writers, while multiple readers can read simultaneously.ZRef.Synchronized
also supports composing multipleZRef.Synchronized
values together to form a singleZRef.Synchronized
value that can be atomically updated using thezip
operator. In this case reads and writes will semantically block other readers and writers.