A ZRefM[RA, RB, EA, EB, A, B] is a polymorphic, purely functional
description of a mutable reference. The fundamental operations of a ZRefM
are set and get. set takes a value of type A and sets the reference
to a new value, requiring an environment of type RA and potentially failing
with an error of type EA. get gets the current value of the reference and
returns a value of type B, requiring an environment of type RB and
potentially failing with an error of type EB.
When the error and value types of the ZRefM are unified, that is, it is a
ZRefM[E, E, A, A], the ZRefM also supports atomic modify and update
operations.
Unlike ZRef, ZRefM allows performing effects within update operations, at
some cost to performance. Writes will semantically block other writers, while
multiple readers can read simultaneously.
- Companion:
- object
Value members
Abstract methods
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.
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.
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.
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.
Concrete methods
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 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.
Transforms the set value of the ZRefM with the specified function.
Transforms the set value of the ZRefM with the specified function.
Transforms the set value of the ZRefM with the specified effectual
function.
Transforms the set value of the ZRefM with the specified effectual
function.
Transforms both the set and get values of the ZRefM with the
specified functions.
Transforms both the set and get values of the ZRefM with the
specified functions.
Transforms both the set and get errors of the ZRefM with the
specified functions.
Transforms both the set and get errors of the ZRefM with the
specified functions.
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.
Filters the set value of the ZRefM with the specified 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 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.
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 get value of the ZRefM with the specified 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 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.
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.
Folds over the error and value types of the ZRefM.
Folds over the error and value types of the ZRefM.
Folds over the error and value types of the ZRefM, 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 ZRefM, allowing access to the
state in transforming the set value but requiring unifying the error
type.
Writes a new value to the RefM, returning the value immediately before
modification.
Writes a new value to the RefM, returning the value immediately before
modification.
Atomically modifies the RefM with the specified function, returning the
value immediately before modification.
Atomically modifies the RefM with the specified function, returning the
value immediately before modification.
Atomically modifies the RefM with the specified partial function,
returning the value immediately before modification. If the function is
undefined on the current value it doesn't change it.
Atomically modifies the RefM with the specified partial function,
returning the value immediately before modification. If the function is
undefined on the current value it doesn't change it.
Transforms the get value of the ZRefM with the specified function.
Transforms the get value of the ZRefM with the specified function.
Transforms the get value of the ZRefM with the specified effectual
function.
Transforms the get value of the ZRefM with the specified effectual
function.
Atomically modifies the RefM with the specified function, which
computes a return value for the modification. This is a more powerful
version of update.
Atomically modifies the RefM with the specified function, which
computes a return value for the modification. This is a more powerful
version of update.
Atomically modifies the RefM with the specified function, which
computes a return value for the modification if the function is defined
in the current value otherwise it returns a default value. This is a more
powerful version of updateSome.
Atomically modifies the RefM with the specified function, which
computes a return value for the modification if the function is defined
in the current value otherwise it returns a default value. This is a more
powerful version of updateSome.
Performs the specified effect every time a value is written to this
ZRefM.
Performs the specified effect every time a value is written to this
ZRefM.
Performs the specified effect very time a value is read from this ZRefM.
Performs the specified effect very time a value is read from this ZRefM.
Atomically modifies the RefM with the specified function.
Atomically modifies the RefM with the specified function.
Atomically modifies the RefM with the specified function, returning the
value immediately after modification.
Atomically modifies the RefM with the specified function, returning the
value immediately after modification.
Atomically modifies the RefM with the specified partial function. If
the function is undefined on the current value it doesn't change it.
Atomically modifies the RefM with the specified partial function. If
the function is undefined on the current value it doesn't change it.
Atomically modifies the RefM with the specified partial function. If
the function is undefined on the current value it returns the old value
without changing it.
Atomically modifies the RefM with the specified partial function. If
the function is undefined on the current value it returns the old value
without changing it.