sealed trait 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 thesetvalue.Folds over the error and value types of the
ZRefM, allowing access to the state in transforming thesetvalue. This is a more powerful version offoldMbut 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 offoldMwill 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
ZRefMwithout 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
getvalue of theZRefMwith the specified partial function, returning aZRefMwith agetvalue 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
getvalue of theZRefMwith the specified effectual partial function, returning aZRefMwith agetvalue 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
setvalue of theZRefMwith 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
setvalue of theZRefMwith 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
setandgetvalues of theZRefMwith the specified functions. -
final
def
dimapError[EC, ED](f: (EA) ⇒ EC, g: (EB) ⇒ ED): ZRefM[RA, RB, EC, ED, A, B]
Transforms both the
setandgeterrors of theZRefMwith 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
setandgetvalues of theZRefMwith 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
setvalue of theZRefMwith the specified predicate, returning aZRefMwith asetvalue 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
setvalue of theZRefMwith the specified effectual predicate, returning aZRefMwith asetvalue 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
getvalue of theZRefMwith the specified predicate, returning aZRefMwith agetvalue 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
getvalue of theZRefMwith the specified effectual predicate, returning aZRefMwith agetvalue 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 thesetvalue 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
getvalue of theZRefMwith 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
getvalue of theZRefMwith 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.