sealed abstract class ZRefM[-RA, -RB, +EA, +EB, -A, +B] extends AnyRef
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.
- Self Type
- ZRefM[RA, RB, EA, EB, A, B]
- Alphabetic
- By Inheritance
- ZRefM
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
foldAllM[RC <: RA with RB, RD <: RB, EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ec: (EB) ⇒ EC, ca: (C) ⇒ (B) ⇒ ZIO[RC, EC, A], bd: (B) ⇒ ZIO[RD, ED, D]): ZRefM[RC, RD, EC, ED, C, D]
Folds over the error and value types of the
ZRefM
, allowing access to the state in transforming theset
value.Folds over the error and value types of the
ZRefM
, allowing access to the state in transforming theset
value. This is a more powerful version offoldM
but requires unifying the environment and error types. -
abstract
def
foldM[RC <: RA, RD <: RB, EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ca: (C) ⇒ ZIO[RC, EC, A], bd: (B) ⇒ ZIO[RD, ED, D]): ZRefM[RC, RD, EC, ED, C, D]
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 theZRefM
. For most use cases one of the more specific combinators implemented in terms offoldM
will be more ergonomic but this method is extremely useful for implementing new combinators. -
abstract
def
get: ZIO[RB, EB, B]
Reads the value from the
ZRefM
. -
abstract
def
set(a: A): ZIO[RA, EA, Unit]
Writes a new value to the
ZRefM
, with a guarantee of immediate consistency (at some cost to performance). -
abstract
def
setAsync(a: A): ZIO[RA, EA, Unit]
Writes a new value to the
ZRefM
without providing a guarantee of immediate consistency.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
collect[C](pf: PartialFunction[B, C]): ZRefM[RA, RB, EA, Option[EB], A, C]
Maps and filters the
get
value of theZRefM
with the specified partial function, returning aZRefM
with aget
value that succeeds with the result of the partial function if it is defined or else fails withNone
. -
final
def
collectM[RC <: RB, EC >: EB, C](pf: PartialFunction[B, ZIO[RC, EC, C]]): ZRefM[RA, RC, EA, Option[EC], A, C]
Maps and filters the
get
value of theZRefM
with the specified effectual partial function, returning aZRefM
with aget
value that succeeds with the result of the partial function if it is defined or else fails withNone
. -
final
def
contramap[C](f: (C) ⇒ A): ZRefM[RA, RB, EA, EB, C, B]
Transforms the
set
value of theZRefM
with the specified function. -
final
def
contramapM[RC <: RA, EC >: EA, C](f: (C) ⇒ ZIO[RC, EC, A]): ZRefM[RC, RB, EC, EB, C, B]
Transforms the
set
value of theZRefM
with the specified effectual function. -
final
def
dimap[C, D](f: (C) ⇒ A, g: (B) ⇒ D): ZRefM[RA, RB, EA, EB, C, D]
Transforms both the
set
andget
values of theZRefM
with the specified functions. -
final
def
dimapError[EC, ED](f: (EA) ⇒ EC, g: (EB) ⇒ ED): ZRefM[RA, RB, EC, ED, A, B]
Transforms both the
set
andget
errors of theZRefM
with the specified functions. -
final
def
dimapM[RC <: RA, RD <: RB, EC >: EA, ED >: EB, C, D](f: (C) ⇒ ZIO[RC, EC, A], g: (B) ⇒ ZIO[RD, ED, D]): ZRefM[RC, RD, EC, ED, C, D]
Transforms both the
set
andget
values of theZRefM
with the specified effectual functions. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
filterInput[A1 <: A](f: (A1) ⇒ Boolean): ZRefM[RA, RB, Option[EA], EB, A1, B]
Filters the
set
value of theZRefM
with the specified predicate, returning aZRefM
with aset
value that succeeds if the predicate is satisfied or else fails withNone
. -
final
def
filterInputM[RC <: RA, EC >: EA, A1 <: A](f: (A1) ⇒ ZIO[RC, EC, Boolean]): ZRefM[RC, RB, Option[EC], EB, A1, B]
Filters the
set
value of theZRefM
with the specified effectual predicate, returning aZRefM
with aset
value that succeeds if the predicate is satisfied or else fails withNone
. -
final
def
filterOutput(f: (B) ⇒ Boolean): ZRefM[RA, RB, EA, Option[EB], A, B]
Filters the
get
value of theZRefM
with the specified predicate, returning aZRefM
with aget
value that succeeds if the predicate is satisfied or else fails withNone
. -
final
def
filterOutputM[RC <: RB, EC >: EB](f: (B) ⇒ ZIO[RC, EC, Boolean]): ZRefM[RA, RC, EA, Option[EC], A, B]
Filters the
get
value of theZRefM
with the specified effectual predicate, returning aZRefM
with aget
value that succeeds if the predicate is satisfied or else fails withNone
. -
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
fold[EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ca: (C) ⇒ Either[EC, A], bd: (B) ⇒ Either[ED, D]): ZRefM[RA, RB, EC, ED, C, D]
Folds over the error and value types of the
ZRefM
. -
def
foldAll[EC, ED, C, D](ea: (EA) ⇒ EC, eb: (EB) ⇒ ED, ec: (EB) ⇒ EC, ca: (C) ⇒ (B) ⇒ Either[EC, A], bd: (B) ⇒ Either[ED, D]): ZRefM[RA with RB, RB, EC, ED, C, D]
Folds over the error and value types of the
ZRefM
, allowing access to the state in transforming theset
value but requiring unifying the error type. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
map[C](f: (B) ⇒ C): ZRefM[RA, RB, EA, EB, A, C]
Transforms the
get
value of theZRefM
with the specified function. -
final
def
mapM[RC <: RB, EC >: EB, C](f: (B) ⇒ ZIO[RC, EC, C]): ZRefM[RA, RC, EA, EC, A, C]
Transforms the
get
value of theZRefM
with the specified effectual function. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
readOnly: ZRefM[RA, RB, EA, EB, Nothing, B]
Returns a read only view of the
ZRefM
. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
tapInput[RC <: RA, EC >: EA, A1 <: A](f: (A1) ⇒ ZIO[RC, EC, Any]): ZRefM[RC, RB, EC, EB, A1, B]
Performs the specified effect every time a value is written to this
ZRefM
. -
final
def
tapOutput[RC <: RB, EC >: EB](f: (B) ⇒ ZIO[RC, EC, Any]): ZRefM[RA, RC, EA, EC, A, B]
Performs the specified effect very time a value is read from this
ZRefM
. -
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
writeOnly: ZRefM[RA, RB, EA, Unit, A, Nothing]
Returns a write only view of the
ZRefM
.