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.
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.
Reads the value from the ZRefM.
Writes a new value to the ZRefM, with a guarantee of immediate
consistency (at some cost to performance).
Writes a new value to the ZRefM without providing a guarantee of
immediate consistency.
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.
Transforms the set value of the ZRefM with the specified 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 errors of the ZRefM with the
specified 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 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 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, allowing access to
the state in transforming the set value but requiring unifying the error
type.
Transforms the get value of the ZRefM with the specified function.
Transforms the get value of the ZRefM with the specified effectual
function.
Returns a read only view of the 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.
Returns a write only view of the ZRefM.
A
ZRefM[RA, RB, EA, EB, A, B]is a polymorphic, purely functional description of a mutable reference. The fundamental operations of aZRefMaresetandget.settakes a value of typeAand sets the reference to a new value, requiring an environment of typeRAand potentially failing with an error of typeEA.getgets the current value of the reference and returns a value of typeB, requiring an environment of typeRBand potentially failing with an error of typeEB.When the error and value types of the
ZRefMare unified, that is, it is aZRefM[E, E, A, A], theZRefMalso supports atomicmodifyandupdateoperations.Unlike
ZRef,ZRefMallows performing effects within update operations, at some cost to performance. Writes will semantically block other writers, while multiple readers can read simultaneously.